Inertial Sensor Turning Problems

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. Our coder is 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);

}’

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();

/<em>sets each motor to the velocity specified in the method,
negative for the left side since it’s a point turn</em>/

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);

}

put ``` before and after your code to make it more readable

1 Like

Look into PID. What you have now just spins the bot forever in a circle.