My team has been using the inertial sensor for turning throughout this season. We just made a new robot and we are starting to code it. I am using the exact same functions, but the robot just keeps turning. I do not know what to change since the code worked on the other robot. Does anyone have any suggestions?
'void turnRightPoint(double turnAmount, double speed){ //method for a right point turn
/*resets the rotation that the sensor is at
so it can do a bunch of tasks in a row without pausing
*/
inertial4.resetRotation();
/sets each motor to the velocity specified in the method,
negative for the left side since it’s a point turn/
bLeft.setVelocity(-speed,vex::velocityUnits::pct);
mLeft.setVelocity(-speed,vex::velocityUnits::pct);
fLeft.setVelocity(-speed,vex::velocityUnits::pct);
bRight.setVelocity(speed,vex::velocityUnits::pct);
mRight.setVelocity(speed,vex::velocityUnits::pct);
fRight.setVelocity(speed,vex::velocityUnits::pct);
fRight.spin(directionType::fwd);
mRight.spin(directionType::fwd);
bRight.spin(directionType::fwd);
fLeft.spin(directionType::fwd);
mLeft.spin(directionType::fwd);
bLeft.spin(directionType::fwd);
/* each of the motors will spin until the inertial
reaches the desired amount in degrees*/
waitUntil(inertial4.rotation(degrees)>=turnAmount);
//all motors stop once turn amount is reached
fRight.setVelocity(0,vex::velocityUnits::pct);
mRight.setVelocity(0,vex::velocityUnits::pct);
bRight.setVelocity(0,vex::velocityUnits::pct);
fLeft.setVelocity(0,vex::velocityUnits::pct);
mLeft.setVelocity(0,vex::velocityUnits::pct);
bLeft.setVelocity(0,vex::velocityUnits::pct);
}’