I have a problem of turning with the inertial sensor. When I don’t calibrate it , the robot does not stop at all when it reaches the target angle. However, calibrating in autonomous wastes time. In the actual competition, is there a way to calibrate the inertial sensor before the autonomous starts, or are there any problems in my code below?
void turn1(double angle){
Inertial13.setRotation(0, degrees);
if(angle > 0){
LF.spin(forward, 20, percent);
LR.spin(forward, 20, percent);
RF.spin(reverse, 20, percent);
RR.spin(reverse, 20, percent);
waitUntil((Inertial13.rotation(degrees) >= angle));
}else if(angle < 0){
LF.spin(reverse);
LR.spin(reverse);
RF.spin(forward);
RR.spin(forward);
waitUntil((Inertial13.rotation(degrees) <= angle));
}
LF.stop();
LR.stop();
RF.stop();
RR.stop();
}