2015 Mecanum Drive/Joystick Example

The programmers on my team are having issues using 2015 LabVIEW to program our mecanum drive. We seem to be having trouble figuring out where to implement the joystick code with the mecanum code in the teleop.vi. Could someone please show us how the new joystick index array works with our type of drive system?


There’s always a default project that utilizes mecanum. You could just use HolonomicDrive and wire it up like arcade drive.

My team hooked up a Xbox controller with joysticks so the left joystick would move the robot north-south-east-west. then we used the RB and the LB to control rotation. Here is a guide we found extremely helpful.

Mechanum Sample for 2015 seems to be faulty.

We have noticed (and fixed) a few problems in the sample Holonomic Mechanum Cartesian code:

  1. The joystick inputs have Rotation, X and Y messed up. We had to fine-tooth-comb which should be hooked to what, but once we found the right VI, it was not difficult.

  2. The motor comments that specify which motor gets which port has an error which prevents lateral X motion. We switched the wires between port/motor 1 and 3 and now it works fine.

Not sure how this slipped through, I hope this helps other teams (particularly newbies) to get their mechanums working.


Would you please mind sharing an example of your mecanum code? I’m having difficulty fine tuning it myself.

In “WPI_RobotDriveMecanumDrive_Cartesian.vi” (accessed by double clicking on the “Drive – Holonomic Drive” block in the Teleop vi) over on the far left toward the bottom you see “Rotation”, “X”, “Y” inputs. By rewiring which goes to which input, you can control which joystick motion/wheel controls what behavior.

Please see this image, this is what works for us:

We use the z-axis input for side-to-side motion. On our old joystick that’s a little wheel just below the handle.


P.S. Also, don’t forget to swap the wires for motors 1 and 3.

We found that Z axis controls strafing too, though moving forward was a great issue.

After methodically testing the motors on our breadboard with the original, unchanged holonomic drive roboRIO project, we discovered that the only issue with the program is that the Y and Z (Rotation) axes coming from the array going into the Holonomic Drive VI are switched. It was a minor wiring issue and once corrected, everything worked fine. I have attached a copy of the table showing the correct mapping including the rotational directions of our motors and the true axis to which each belongs.

On the attachment, CW=clockwise, CCW=counter-clockwise

Hope this helps.

Joystick to Holonomic Drive Mapping.png
Screenshot of Fixed Holonomic Program.png

Joystick to Holonomic Drive Mapping.png
Screenshot of Fixed Holonomic Program.png

Thank you so much for the suggestion! I got almost crazy here and then I started making a chart with the movements and how it is supposed to be. Turned out that the Motors 1 and 2 at the begin.vi had to be switched. I am so happy!http://www.sunfinger.de/somachtmandas.png

This is the exact control scheme I am going for. I tried everything else in this thread as well as the pdf you linked (which is code-wise outdated but still a great resource). The motors are just not behaving correctly. Would you be willing to share you code so I can figure out what I’m doing wrong?

If you are able to built a similar table showing the outcome of your code, you may find your bug. Or others can more quickly identify the issues with the wheels, motor addressing, or joystick mapping.

Greg McKaskle

Alright, I made the diagram which helped me get four of six the basic directions/functions working. However, the last one isn’t lining up correctly with the mecanum function meaning I can’t switch the two around to make them work. I don’t see a basic way to make it work without messing up the other directions. (i might be misinterpreting turning/rotating)

Holonomic Code
Table Showing Wheel Directions
Teleop Code

I am going for the same control scheme as ProfessorGordo on the Xbox controller.

Your Desired(moveLeft) arrows are incorrect.

So are the Desired(moveRight).

They should be swapped with each other.

Change to front right and back left motor in the begin.vi and it would work perfectly. then you just have to figure out the Controller. Good luck!

Just to be clear: are you recommending swapping the front right and back left motors?

Yep, give it a try. And then you have to set up the controls right. But at least you get the sideway drive running.

I assume he meant switching back right and front right, because that lined up correctly and got the drive working.
I initially read the wheel rotation wrong on the diagram that I was looking at so that screwed me up (brain wasn’t working apparently). Thanks for your help.

No. He seems to have meant what he said. That’s why I asked him to confirm.

…because that lined up correctly and got the drive working.

Perhaps he didn’t see post #13.