Mecanum Drive Coding on VEXCode Blocks

Currently I am experimenting with a mecanum drive/base and have finished building it. Although I am not sure how to code a mecanum base on VEXCode Blocks. Any help would be appreciated

1 Like

google is your friend. Searching box in the vexforum is your friend. There are a lot of threads and information there.

I’m sorry but I haven’t found anything for VEXCode Blocks. @langchen

If you look at the Wiki 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:
meca-blockly

6 Likes

you need to understand the concept/math behind the mecanum. Here is the good one.

http://www.robotc.net/blog/2011/11/22/vex-mecanum-drive-using-robotc/

DougMoyers also gave a good resource for you to start.

2 Likes

here ya go
image

1 Like

MechanControl.v5blocks (9.9 KB)