|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Gyro not working in Autonomous?
The students and I have been banging our head on this one:
Our gyro is working fine during regular operation, but during autonmous mode Get_Gyro_Angle() always returns 0. I've even managed to reduce this down to the fairly minimal code below: Code:
void User_Autonomous_Code(void)
{
pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata);
Camera_Handler();
Servo_Track();
printf("%d ",(int)Get_Gyro_Angle());
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata);
}
}
}
|
|
#2
|
|||||
|
|||||
|
Re: Gyro not working in Autonomous?
Have you called BOTH Start_Gyro_Bias_Calc() and Stop_Gyro_Bias_Calc() before autonomous executes?
|
|
#3
|
||||
|
||||
|
Re: Gyro not working in Autonomous?
Quote:
Code:
Initialize_Gyro(); Initialize_ADC(); Set_Gyro_Bias(1092); //1092 for kit gyro, 1003 for ADXSR300 |
|
#4
|
|||
|
|||
|
Re: Gyro not working in Autonomous?
We are having the same problem, see our symptoms in the gyro code sticky thread. I've also posted the code we are trying to use.
|
|
#5
|
|||
|
|||
|
Re: Gyro not working in Autonomous?
It's a simple problem to fix:
The call to update the gyro is preformed in Process_Data_From_Local_IO, which is not called during autonomous mode. If you copy the code for it to the User_Autonomous_Code loop, everything will work. To be specific, this code needs to be in your autonomous loop: Code:
if(Get_ADC_Result_Count())
{
Process_Gyro_Data();
Reset_ADC_Result_Count();
}
![]() |
|
#6
|
|||
|
|||
|
Devicenull,
YOU ARE AWESOME! I was just getting ready to type a note asking why the Process_data... function might not be running in my code and there was your note! It is very confusing since I've been working with the EDU all summer and it appears to run that function during autonomous. You're a life saver! |
|
#7
|
||||
|
||||
|
Re: Gyro not working in Autonomous?
Quote:
|
|
#8
|
||||
|
||||
|
Re: Gyro not working in Autonomous?
I've updated the gyro documentation to make it clear that Process_Gyro_Data( ) needs to be called from User_Autonomous_Code( ). For grins, I also updated the code in frc_gyro.zip.
-Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Labview used to debug the Gyro | joshR515 | National Instruments LabVIEW and Data Acquisition | 1 | 09-02-2006 20:56 |
| Autonomous robots working & interacting with each other & their environment. | Elgin Clock | Math and Science | 0 | 19-05-2005 01:00 |
| Next Years Game? | Jeremy | General Forum | 49 | 27-04-2004 01:53 |
| Despite what IFI says, you can configure autonomous from OI... | TedP | Programming | 19 | 31-03-2004 10:09 |