Field controller breaks our autonomous

We are coding in the latest version of VexCode. Our autonomous works perfectly on a competition switch. When we plug the controller into a field controller, only the drive base motors function in autonomous. This continues for each iteration of autonomous until we restart the robot. All motors work well in teleop.

Our autonomous function:

void autonomous(void)
{
  // ..........................................................................
  // Insert autonomous user code here.
  // ..........................................................................
  setAllDriveVelocity(80);
  setIntakeVelocity(127);
  setTiltVelocity(60);

  setAllDriveVelocity(60);

  Motor_Intake_Right.spin(directionType::rev);
  Motor_Intake_Left.spin(directionType::rev);

  wait(250, msec);

  rotateAllDriveMotorsFor(50);
  wait(4500, msec);

  setAllDriveVelocity(127);

  rotateAllDriveMotorsFor(-46);
  wait(2250, msec);

  setAllDriveVelocity(90);
  rotateRightDriveFor(14.8);
  rotateLeftDriveFor(-14.8);
  wait(1500, msec);

  setAllDriveVelocity(80);
  rotateAllDriveMotorsFor(17);
  Motor_Intake_Right.stop();
  Motor_Intake_Left.stop();
  wait(2000, msec);
  
  setIntakeVelocity(-127);

  rotateTiltFor(26.5);
  wait(2000, msec);

  Motor_Intake_Right.spin(directionType::rev);
  Motor_Intake_Left.spin(directionType::rev);
  wait(1000, msec);

  rotateAllDriveMotorsFor(-10);
  wait(5000, msec);
}

The associated helper functions within autonomous:


void rotateAllDriveMotorsFor(double dist)
{
  dist = dist / (4 * M_PI);

  Motor_BLeft.rotateFor(dist, rotationUnits::rev, false);
  Motor_FLeft.rotateFor(dist, rotationUnits::rev, false);
  Motor_BRight.rotateFor(dist, rotationUnits::rev, false);
  Motor_FRight.rotateFor(dist, rotationUnits::rev, false);
}

void rotateRightDriveFor(double dist)
{
  dist = dist / (4 * M_PI);
  
  Motor_BRight.rotateFor(dist, rotationUnits::rev, false);
  Motor_FRight.rotateFor(dist, rotationUnits::rev, false);
}

void rotateLeftDriveFor(double dist)
{
  dist = dist / (4 * M_PI);

  Motor_BLeft.rotateFor(dist, rotationUnits::rev, false);
  Motor_FLeft.rotateFor(dist, rotationUnits::rev, false);
}

void rotateTiltFor(double dist)
{
  dist = dist / (4 * M_PI);

  Motor_Tilt.rotateFor(dist, rotationUnits::rev, false);
}

void setAllDriveVelocity(int speed)
{
  Motor_BLeft.setVelocity(speed, velocityUnits::rpm);
  Motor_FLeft.setVelocity(speed, velocityUnits::rpm);
  Motor_FRight.setVelocity(speed, velocityUnits::rpm);
  Motor_BRight.setVelocity(speed, velocityUnits::rpm);
}

void setIntakeVelocity(int speed)
{
  Motor_Intake_Left.setVelocity(speed, velocityUnits::rpm);
  Motor_Intake_Right.setVelocity(speed, velocityUnits::rpm);
}

void setTiltVelocity(int speed)
{
  Motor_Tilt.setVelocity(speed, velocityUnits::rpm);
}

We tried updating all of the firmware and creating an entirely new project but the issue still remains.

1 Like

I have the same problem. I’ve tried everything. All I have left is to force an update and see if that solves it because that’s what some people told me to try. You might wanna try that too

@ME_9228A do you have any code in your preAuton() function?

Please see this comment by @jpearman, he recommends not to use motor.setVelocity() function and instead pass max velocity as an argument to rotateTo() function call.

We had a similar problem using pros we just got a very specific start of plunging into the field before we start the program. I Don’t know why it works but some how doing the program on before plunging doesn’t work for us and we mange with that method.

Make sure you plug into the field before starting your program.

Send me or attach to this topic the whole project (use export and save as a zip file).

1 Like