|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Gyro Autonomous Problems
The problem is that when you switch to autnomous code the gyro gains numbers very rapidly into the 10000's then once we go back to Process_Data_From_Master_uP the gyro gains numbers normally. What is the problem with this.
|
|
#2
|
|||||
|
|||||
|
Re: Gyro Autonomous Problems
Sounds like you're adding the current gyro value in rapidly in autonomous, but slowly in Operator mode without taking the rate into account.
Are you using Kevin Watson's code as a base? How and where in the code are you updating the gyro? |
|
#3
|
||||
|
||||
|
Re: Gyro Autonomous Problems
The Code looks like this in autonomous
while (autonomous_mode) { if(Get_ADC_Result_Count()) { Process_Gyro_Data(); } etc etc etc. The only gyro things in here are gyro = Get_Gyro_Angle(); and gyro is a variable declared as long gyro; We are using kevins camera code as a base and combined the encoder and gyro code into it using his instructions. in Process_Data_From_Master_uP the Gyro is initialized in User_Initialization and is calibrated in Process_Data_From_Master_uP using the stop and start bias offset. Then it is using kevins temp_gyro_angle = Get_Gyro_Angle(); to get the angle of the gyro. If you have anymore question feel free to ask. |
|
#4
|
|||||
|
|||||
|
Re: Gyro Autonomous Problems
Code:
if(Get_ADC_Result_Count())
{
Process_Gyro_Data();
Reset_ADC_Result_Count();
}
If you follow the default style then the code above would be in Process_Data_From_Local_IO() and you'd need to add a call to Process_Data_From_Local_IO() within the User_Autonomous_Code() autonomous_mode loop (but outside the 26.2ms slow loop). |
|
#5
|
|||||
|
|||||
|
Re: Gyro Autonomous Problems
Have you caclulated the Bias for the gyro?
This is the value for the null (Not Rotating) output of the gyro. Until you calculate and save this value, the Gyro code will "Think" it's rotating very fast conter clockwise. The bias is caclulated by taking the average of many gyro values while the robot is stationary. Kevin has provided an easy way to do this... First you call Start_Gyro_Bias_Calc() and then a few seconds later you call Stop_Gyro_Bias_Calc(). You must be calling Process_Gyro_Data() thoughout this time interval. You probably don't want to do this at the start of tele-operated mode, or autonomous mode, unless you are willing to keep the robot still for a few seconds. In our code we do this ONCE when the robot enters "Disabled" mode. We figure that it will be in that state for at least two seconds. Just in case we save the gyro bais in EEPROM. If we don't get a full two seconds in disable mode we use the last saved vale from EEPROM. To debug this, print out the "Rate" value every second. That way you'll know if the gyro thinks it's turning or not. Use Get_Gyro_Rate(); |
|
#6
|
||||
|
||||
|
Re: Gyro Autonomous Problems
Thanks, The Reset_ADC_Result_Count(); did the trick thank you so much Mark Mcleod. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with the Gyro | Guy_E | Programming | 21 | 04-12-2006 17:23 |
| Gyro not working in Autonomous? | kaszeta | Programming | 7 | 11-02-2006 01:28 |
| Problems with the gyro | Conan | Programming | 7 | 06-02-2006 01:45 |
| Yaw Rate Gyro Problems | RetroKamikaze | Programming | 3 | 27-01-2006 20:55 |
| Gyro Code Problems | railerobotics | Programming | 8 | 27-01-2006 10:45 |