Holonomic Arcade Help PLS

Okay, so our program just made the switch to VexCode Pro this year. Don’t Judge Pls :). We have never programmed a holonomic drive either, the problem is, we have multiple teams doing one and we have no idea how to program it. I can’t speak for the other team, but I know how we want ours to drive. My team wants arcade, which we have also never programmed.
We want out left stick to do all 8 movements (Top, Right, Diagonal, etc.) and we want our right stick to do our turning. Can we please get some help with this?

1 Like

There are 8 possible movements and 4 directions on the joystick. X±, and Y±. I do not believe it is possible to control all eight movements with one joystick.

EDIT : by X ± and Y±, I mean what ever the numbers are and the opposing direction…

Congrats on your switch to VEXcode Pro!

Here are some steps you can use to program drivercontrol base code for any base type.

1 - Make a diagram of the base movements.
This means mapping out all the wheel spinning directions for each type of movement. Basically, this would mean making a sketch of the robot and wheel placement and drawing arrows in the directions that the wheels would have to spin.

Holonomic X-drive example (forward movement):

2 - Map the directions to your controller joysticks.
Take the direction diagrams and map them to your controller joysticks.

OPTIONAL: For use later, also take all your diagrams and “layer” the directions together. This means adding or subtracting the directions from each other, until you have all your statements layered together. We’ll be using this in the motor commands with the speed value as the stick output programming way later.


I want stick 3 to control forward and backward. This means that if stick 3 gives a positive value, the motors will spin forward. If stick 3 gives a negative value, the motors will spin backward. Therefore, the speed value that is passed into my motors is proportional to the value that stick 3 outputs.

Do this for all motors you want to control with the joysticks.

3 - Write the spin commands
Now, with your logic all figured out, just write the commands! You can use 2 easy methods for programming this: 1, using if statements, and 2, using motor commands with the speed value as the stick output.

If statement way:
This way, you’re programming in pretty much English. If the stick value goes above a certain percentage (in the example, it’s 30), then the motors will spin in a certain direction.


if (Controller1.Axis3.position(percent) > 30) {

Motor commands with the speed value as the stick output way:
With this, you will be using the layered statements and passing them directly into your motor’s speed. This way, the speed will be dependent on the value of the axis, so if you’re slamming the stick into the top of the rim it’ll go faster than if you are holding it just above the center of the circle.
Just pass the layered statements into the place where you’d put the speed, and you’re done. (Don’t forget to test & debug if it doesn’t work the first time.)


Motor1.spin(directionType::fwd, Controller.Axis3.value(), velocityUnits::pct);
Motor2.spin(directionType::fwd, Controller.Axis3.value(), velocityUnits::pct);
Motor3.spin(directionType::rev, Controller.Axis3.value(), velocityUnits::pct);
Motor4.spin(directionType::rev, Controller.Axis3.value(), velocityUnits::pct);

Why is the direction type on my last 2 motors reversed?

In this example, the last 2 motors are the motors on my left side. The motors on the left side are facing the opposite direction as my right motors, so they spin the opposite direction. To compensate for this, I changed the directionType to reverse.

Hope that helps, and good luck programming!