Kevin,
This is just a thought and should be implemented by teams as they feel their needs require.
In the teleop.c file, you currently have the gyro bias calculation process happen in the Teleop function.
Code:
void Teleop(void)
{
static unsigned int i = 0;
static unsigned int j = 0;
int temp_gyro_rate;
long temp_gyro_angle;
int temp_gyro_bias;
i++;
j++; // this will rollover every ~1000 seconds
if(j == 10)
{
printf("\rCalculating Gyro Bias...");
}
if(j == 60)
{
// start a gyro bias calculation
Start_Gyro_Bias_Calc();
}
if(j == 300)
{
// terminate the gyro bias calculation
Stop_Gyro_Bias_Calc();
// reset the gyro heading angle
Reset_Gyro_Angle();
printf("Done\r");
}
if(i >= 30 && j >= 300)
{
temp_gyro_bias = Get_Gyro_Bias();
temp_gyro_rate = Get_Gyro_Rate();
temp_gyro_angle = Get_Gyro_Angle();
printf(" Gyro Bias=%d\r\n", temp_gyro_bias);
printf(" Gyro Rate=%d\r\n", temp_gyro_rate);
printf("Gyro Angle=%d\r\n\r\n", (int)temp_gyro_angle);
i = 0;
}
Update_OI_LEDs(); // located in ifi_code.c
}
This may be fine in some instances, but in competition, the robot is powered up in disabled mode, then transitions into autonomous(Hybrid) then back to disabled and finally into teleop. The gyro bias would never be calculated until well after it may be needed.
Wouldn't it be better if this code were placed in the disabled.c file in the Disabled function. An additional flag could be set to prevent the bias calc process from running during any additional disabled periods.