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
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)
edit: screen cap of one motor with 3 signals:
you need to understand the concept/math behind the mecanum. Here is the good one.
DougMoyers also gave a good resource for you to start.
here ya go
MechanControl.v5blocks (9.9 KB)
This code worked wonders for my robot! How would you suggest coding autonomous periods? Would it be more useful just to use a standard 4 motor drivetrain or is there a simple way to program the strafing functions and use a value that all motors (or some) would drive for?
Welcome to the forum. It would be a good way to get started to work with the standard drivetrain code. Once you get a sense for how it works, you could look to create your own code to strafe for a specified distance.
Just a heads up, reviving old threads is considered bad form. Probably hard to see here, since this thread got bumped nearly a year after a previous post. A fresh thread saying “I found some sources here that got me started coding mecanum driver control in blocks, anyone have tips on coding autonomous?” would be the preferred.
Hey this was soo awesome I wanted to ask one question how would I get it drive forward regularly?
what would you mean by that?