I have been writing a lot of gyro code for my autons and I saw that none of my code was working. I tested the gyro by just having it print the value of the Gyro in a loop so I could see if it was a problem with the Gyro. I found that the gyro is just always decreasing its value towards -360, then rolling over to -1 and doing it again.
I don’t know why the Gyro is just randomly incrementing, and we have US Open very soon. Any help would be greatly appreciated.
When we used Cortex, we did this “special” initialization:
pre_auton()
{
// flash LED indicating Gyro calibration about to begin
SensorType[in8] = sensorNone;
wait1Msec(500); // Let user notice LED
//Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
SensorType[in8] = sensorGyro;
wait1Msec(1350); // 1300 is just enough
// Turn LED off
}
While Gyro is initializing your robot needs to remain stationary, so that gyro could calculate “null” drift.