|
Re: EDU Mini Controller & 2005 Nav Code
Ok guys, here is my gyro "issue":
Here is an extract from gyro.c (I added all the printf's)
Specifically it is from the Process_Gyro_data() function:
else
{
// get the latest measured gyro rate
temp_gyro_rate = (int)Get_ADC_Result(GYRO_CHANNEL) - gyro_bias;
printf("gyro_bias = %d\n", gyro_bias);
printf("temp_gyro_rate = %d\n", temp_gyro_rate);
// update reported gyro rate and angle only if
// measured gyro rate lies outside the deadband
if(temp_gyro_rate < -GYRO_DEADBAND || temp_gyro_rate > GYRO_DEADBAND)
{
// update the gyro rate
gyro_rate = temp_gyro_rate;
printf("gyro_rate = %d\n", gyro_rate);
// integrate the gyro rate to derive the heading
gyro_angle += (long)temp_gyro_rate;
printf("gyro_angle = %d\n", gyro_angle);
}
Here is some sample output:
gyro_bias = 1944
temp_gyro_rate = -820
gyro_rate = -820
gyro_angle = -1
gyro_bias = 1944
temp_gyro_rate = -788
gyro_rate = -788
gyro_angle = -1
gyro_bias = 1944
temp_gyro_rate = -766
gyro_rate = -766
gyro_angle = -1
I was worried that the gyro was not working or the ADE was not working but they appears to be working fine. All the calculations seem to be working fine until it gets to the "gyro_angle += (long)temp_gyro_rate;" line of code. All that the variable gyro_angle will ever be is -1 or 0. I can move the gyro and get it to change from 0 to -1 and visa versa. Any ideas? I'm guessing my C abilities are getting in the way?
Last edited by jaustin : 14-11-2005 at 23:51.
Reason: I messed up the sample data area
|