Mecanum Drive Coding on VEXCode Blocks

If you look at the Wiki - #33 by technik3k that is forming up, you can see some images and code relating to mecanum drives.

The general concept is that you will combine 3 joystick signals together to give a motor value to each of the 4 wheels. One signal for Y (forward/reverse), one signal for X (strafe) and one signal for W (turn).

If you open the example project for Arcade Left (or Right) you will see how the signals for Y and W are combined on one joystick to control a typical inline drive. You can start with that code, and add the lines needed to give a value to each of your 4 drive motors. To strafe, you will add (or subtract) the horizontal axis signal from the other joystick for each motor.

Typically it would look something like:

motorName = Y signal + X signal + W signal
frontLeft = axis3 + axis1 + axis4
backLeft = axis3 - axis1 + axis4
frontRight = axis3 - axis1 - axis4
backRight = axis3 + axis1 - axis4 

If you look at the diagrams in the wiki, the reason for adding or subtracting is there. (It’s possible I goofed them up, so check my work) :slight_smile:

edit: screen cap of one motor with 3 signals:

8 Likes