Hi, so my team and I are having trouble trying to program our mecanum wheel drive. the motors won’t move unless we angle the joysticks a certain way.
Heres our logic:
#include “robot-config.h”
int main() {
while(true){
//*************************Forward and Backwards
Back_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
//**************** Striafe L and R (invesrse in right)*********************
Back_left.spin(vex::directionType::fwd, Controller1.Axis1.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::rev, Controller1.Axis1.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis1.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::rev, Controller1.Axis1.value(), vex::velocityUnits::pct);
//Turning left***
if(Controller1.ButtonL1.pressing()) {
Back_left.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
}
else if(Controller1.ButtonR1.pressing()) {
Back_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
}
else {
Back_left.stop(brakeType::hold);
Back_right.stop(brakeType::hold);
Front_left.stop(brakeType::hold);
Front_right.stop(brakeType::hold);
}
}
}
Heres our logic
PORT11 IIIIIIIIIIIIII PORT1
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
PORT20 IIIIIIIIIIIIIII PORT10
#include “robot-config.h”
int main() {
while(true){
//*************************Forward and Backwards
Back_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
//**************** Striafe L and R (invesrse in right)*********************
Back_left.spin(vex::directionType::fwd, Controller1.Axis1.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::rev, Controller1.Axis1.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis1.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::rev, Controller1.Axis1.value(), vex::velocityUnits::pct);
//Turning left***
if(Controller1.ButtonL1.pressing()) {
Back_left.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
}
else if(Controller1.ButtonR1.pressing()) {
Back_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Back_right.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_right.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct);
Front_left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
}
else {
Back_left.stop(brakeType::hold);
Back_right.stop(brakeType::hold);
Front_left.stop(brakeType::hold);
Front_right.stop(brakeType::hold);
}
}
}