We’re trying to use the Inertial Sensor for our turns but the sensor seems to be giving very small values (as it rotates, while printing the Rotation to the screen, it starts at 0 and goes up in very small increments. After a full 360degree turn, it’s around 4.1)
Parameters:
Robot: 4-motor
Sensor: Inertial (originally mounted upside down, now right-side up with no difference)
Sensor Feedback: when accessed through the Brain Devices, all the numbers make sense.
Firmware: up-to-date
Software: VEXcode Pro
void ROTATECCW(int DEGREES, int PERCENT) { //ROTATE ROBOT COUNTER-CLOCKWISE
Inertial10.setRotation(0,degrees);
Brain.Screen.clearScreen(green);
// Rotate CCW
while (fabs(Inertial10.rotation(degrees)) <= abs(DEGREES)) {
Brain.Screen.print("DEGREES: %.2f", Inertial10.rotation(degrees));
Brain.Screen.print(" PERCENT: %.2f", PERCENT);
Brain.Screen.newLine();
FL.spin(reverse, PERCENT, velocityUnits::pct); //front-left motor
FR.spin(forward, PERCENT, velocityUnits::pct); //front-right motor
BL.spin(reverse, PERCENT, velocityUnits::pct); //back-left motor
BR.spin(forward, PERCENT, velocityUnits::pct); //back-right motor
wait(20,msec);
}
FL.stop(brakeType::brake);
FR.stop(brakeType::brake);
BL.stop(brakeType::brake);
BR.stop(brakeType::brake);
}
With the above code, it just spins (probably because it’s only seeing small numbers, not the actual rotation in degrees)…
Thanks.