We are using JAR template to code our autons. For some reason, about half the time the second turn function runs, the bot turns to some (seemingly) random value and then continues like normal. It never has any other problems with any other turn, just the 2nd one. I have tried many things like adjusting the turn value, adding a null turn that turns to the same angle as before the actual turn to “cancel” out the bad 2nd turn, restarting both vex code v5 pro and the robot, replugging in the inertial, etc. None of these things have fixed this problem. This was not a problem for us last year, and we had the same basis for the code, so I’m not sure why this is popping up now. The code from the segment is below, and the turn acting up is the chassis.turn_to_angle(-83);.
default_constants();
armSensor.setReversed(true);
armSensor.setPosition(0, degrees);
diskDetector.setLightPower(100);
diskDetector.setLight(ledState::on);
backClamp.set(!backClamp);
chassis.drive_timeout = 1000;
chassis.turn_timeout = 400;
chassis.drive_distance(-22);
chassis.turn_to_angle(-33);
chassis.drive_max_voltage = 4;
chassis.drive_distance(-16);
backClamp.set(!backClamp);
extender.set(!extender);
intakeSecondStage.spin(fwd, -100, pct);
chassis.drive_max_voltage = 12;
chassis.drive_distance(17);
//chassis.turn_to_angle(-33);
chassis.turn_to_angle(-83);
wait(0.1, seconds);
claw.set(!claw);
wait(0.1, seconds);
chassis.turn_to_angle(-90);
chassis.turn_max_voltage = 6;
chassis.drive_distance(-6);
chassis.turn_to_angle(-105);
claw.set(!claw);
}