|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
||||
|
||||
|
Re: Gyro Calibration
Quote:
gyro.h. Specifically, you need to change /add /delete some #define statements to select your gyro, sampling rate, and number of samples. I have copied/pasted below part of the gyro.h file that has worked for me for the BEI GyroChip AQRS-0075. Note the four #define statements that have the // removed #define GYROCHIP_75 // BEI GyroChip AQRS-00075-xxx #define TENTHS_OF_A_DEGREE #define GYRO_CAL_FACTOR 1000/1000 #define GYRO_SAMPLE_RATE_1600HZ In order to calibrate, I download the program after compiling with the settings for the BEI Gyrochip, make sure the gyro is steady and let the Terminal display output about 5 times. I have read the gyro angle to be about 0 degrees. Then I slowly turn the gyro 180 degrees (about 6 seconds for the turn) and read the gyro angle display. It should read about 1800, since the #define is set to TENTHS_OF_A_DEGREE. Next, I return the gyro to it's original position (slowly) and it should read about 0 degrees. If you turn it quickly, you will probably see that it won't read the 1800 and return to 0 degrees. Why? // Pick your gyro by removing the // from one of the six lines below. #define GYROCHIP_75 // BEI GyroChip AQRS-00075-xxx // #define ADXRS300 // Analog Devices' ADXRS300EB // Pick the angular unit by removing the // from one of these two lines. // #define MILLIRADIANS #define TENTHS_OF_A_DEGREE // For optimum performance, you'll need to calibrate the scaling factor // to match that of your gyro's. One way to calibrate your gyro is to // mount it very securely to a hefty, square or rectangular object. // Mounting the gyro to a hefty object will help dampen higher frequency // vibrations that can adversly effect your measurements. Place the // mounted gyro against another square object and start the included // demonstration software. To get good results, the mount must be // absolutely still when the "Calibrating Gyro Bias..." message appears // on the terminal screen. After a few seconds, the gyro angular rate // and angle will be sent to the terminal screen. If the angle drifts // rapidly while the mounted gyro is motonless, you need to restart the // software to acquire a new gyro bias measurement. Again, gyros are // very sensitive and must be still while the bias is calculated. Once // the gyro is running with little drift, rotate the mount 180 degrees // and note the reported angle. If the angular units are set to tenths // of a degree, the ideal reported angle is 1800. If set to milliradians, // the ideal angle 1s 3142 (Pi times a thousand). For every tenth of a // percent that the angle is high, decrease the GYRO_CAL_FACTOR numerator // by one. Conversly, for every tenth of a percent low, increase the // numerator by one. Repeat until you're satisfied with the accuracy. #define GYRO_CAL_FACTOR 1000/1000 // Pick a gyro sample rate by uncommenting one of these lines. Faster // is better, but your CPU will spend more time servicing interrupts. // Pick the slowest sample rate that still meets your performace criteria. // These #defines are used below to set the value of GYRO_SAMPLE_RATE and // to set the timer 2 update rate in gyro.c/Initialize_Timer_2(). // #define GYRO_SAMPLE_RATE_200HZ // #define GYRO_SAMPLE_RATE_400HZ // #define GYRO_SAMPLE_RATE_800HZ #define GYRO_SAMPLE_RATE_1600HZ // Number of ADC samples that will be averaged for each gyro update. More // is better, but your update rate will decrease proportionatly. This must // be sixty-four or less. The gyro sample rate divided by number of samples // per update should be at least equil to fifty, which is the number of // gyro updates per second. #define GYRO_SAMPLES_PER_UPDATE 64 // If you modify stuff below this line, you'll break the software. #define ADC_VOLTS_PER_BIT 5/1024 #define MILLIRADIANS_PER_DEGREE 349/20 #define TENTHS_OF_A_DEGREE_PER_DEGREE 10 #ifdef GYRO_SAMPLE_RATE_200HZ #define GYRO_SAMPLE_RATE 200 #endif #ifdef GYRO_SAMPLE_RATE_400HZ #define GYRO_SAMPLE_RATE 400 #endif #ifdef GYRO_SAMPLE_RATE_800HZ #define GYRO_SAMPLE_RATE 800 #endif #ifdef GYRO_SAMPLE_RATE_1600HZ #define GYRO_SAMPLE_RATE 1600 #endif // BEI GyroChip AQRS-00075-xxx (sensitivity = 30.0mV/deg/sec) #ifdef GYROCHIP_75 #define GYRO_SENSITIVITY 33 // in units of deg/sec/volt #endif // Analog Devices' ADXRS300 (sensitivity = 5.0mV/deg/sec) #ifdef ADXRS300 #define GYRO_SENSITIVITY 200 // in units of deg/sec/volt #endif |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Updated: Example Gyro Interface Code | Kevin Watson | Programming | 2 | 28-03-2005 04:36 |
| Example gyro code released. | Kevin Watson | Programming | 60 | 17-03-2005 18:32 |
| Gyro Troubles | SteveO | Programming | 13 | 30-01-2005 16:46 |
| ADXRS150 gyro yaw rate sensor | Brian M. | Electrical | 13 | 17-10-2004 02:28 |
| Wierd gyro code problems...pls help | Salik Syed | Programming | 4 | 14-03-2004 01:29 |