Code Check for X Drive VCS

#1

Hello. I am trying to get a head start on the new season by CAD and learning VCS. We are planning on using and X drive this year and I made this really simple code for driver control but have no way of testing until late summer probably. Anybody with more skills than me is welcome to point out anything wrong. Thanks! (Bleft is back left, Fleft is front left, etc.)

void usercontrol( void ) {
  // User control code here, inside the loop
  while (1){
      
      Bleft.spin(vex::directionType::fwd, Controller1.Axis2.value() + Controller1.Axis4.value() - Controller1.Axis1, vex::velocityUnits::pct);
      Fleft.spin(vex::directionType::fwd, Controller1.Axis2.value() + Controller1.Axis4.value() + Controller1.Axis1, vex::velocityUnits::pct);
      Bright.spin(vex::directionType::fwd, Controller1.Axis2.value() - Controller1.Axis4.value() + Controller1.Axis1, vex::velocityUnits::pct);
      Fright.spin(vex::directionType::fwd, Controller1.Axis2.value() - Controller1.Axis4.value() - Controller1.Axis1, vex::velocityUnits::pct);
 
    vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources. 
  }
}
0 Likes

I need help with coding an x-drive in c++
#2

this looks correct. if it helps this code would be the same as a mecanum drive

0 Likes

#3

You are missing .value() on the Controller1.Axis1

Also I would recommend learn/using PROS.
Link to their tutorials if your interested.

0 Likes