# Understanding the Holonomic Drive

So, my team is trying to code a Holonomic Drive (Edit: It’s an X-Drive) for this year’s competition and I am just trying to understand how to program the controller for it (like the concepts, not the actual code- although that would be helpful).
Can someone please explain it to me (also I know how to code at an intermediate level, so please go easy-ish on me)?

3 Likes

It’s important to specify what kind of holonomic drive first: X-Drive, meccanum, or H-Drive?

Sorry, it’s an X-Drive.

1 Like

The search bar is your friend, searches for terms like “x-drive programming” returned lots of results with discussion of this topic.

This thread looked particularly useful; it’s got code examples in ROBOTC but shouldn’t be too hard to write equivalent code in whatever V5 programming setup you prefer.

10 Likes

Thanks for the help!

1 Like

So, I made a sample code for our x-drive and it can go forward and backward and it can turn, but it won’t strife left to right or go diagonal. Am I missing something? (I followed the threads and this is what I came up with)

Here is the code (it’s in Vex coding studio):

What happens when you try to strafe? do the wheels fight each other, does the robot turn?

1 Like

At a glance the code looks fine, I’m not really sure what went wrong here.

When the robot tries to strafe, it turns.

You might have to switch around some of the + and - for the strafing inputs

here is my code that I made for a mecanum drive (should work for an x-drive too):

``````    fwdAmt = Controller1.Axis3.position();
turnAmt = Controller1.Axis1.position();
strafeAmt = Controller1.Axis4.position();

LeftFront.spin(directionType::fwd, fwdAmt + turnAmt - strafeAmt, velocityUnits::pct);
LeftBack.spin(directionType::fwd, fwdAmt + turnAmt + strafeAmt, velocityUnits::pct);

RightFront.spin(directionType::fwd, fwdAmt - turnAmt - strafeAmt, velocityUnits::pct);
RightBack.spin(directionType::fwd, fwdAmt - turnAmt + strafeAmt, velocityUnits::pct);``````

note: the right side motors are both reversed in the config

3 Likes

Thank you so much !

1 Like