Programming Mecanum Drive


#1

Our team wants to try using mecanum wheels for our robot, problem is, there are a lot of tutorials on how to program it but only on RobotC and we’re using VEX Coding Studio. This is what I have so far (I tried following RobotC tutorials).

#include “robot-config.h”
// Mecanum drive motors:
// Motor1 = left front wheel
// Mototr2 = left back wheel
// Motor3 = right front wheel
// Motor4 = right back wheel

int main() {
while(1){
//drive
Motor1.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis1.value() + Controller1.Axis4.value(), velocityUnits::pct));
Motor2.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis1.value() - Controller1.Axis4.value(), velocityUnits::pct));
Motor3.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis1.value() - Controller1.Axis4.value(), velocityUnits::pct));
Motor4.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis1.value() + Controller1.Axis4.value(), velocityUnits::pct));

task::sleep(20);
}
}
Thank you for your help.