|
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();
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org
FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
|