Rev 2033 | Rev 2049 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2033 | Rev 2035 | ||
---|---|---|---|
Line 108... | Line 108... | ||
108 | and care has been taken that all other constants (gyro to degree factor, and |
108 | and care has been taken that all other constants (gyro to degree factor, and |
109 | 180 degree flip-over detection limits) are corrected to it. Because the |
109 | 180 degree flip-over detection limits) are corrected to it. Because the |
110 | division by the constant takes place in the flight attitude code, the |
110 | division by the constant takes place in the flight attitude code, the |
111 | constant is there. |
111 | constant is there. |
Line 112... | Line 112... | ||
112 | 112 | ||
113 | The control loop executes every 2ms, and for each iteration |
113 | The control loop executes at 488Hz, and for each iteration |
114 | gyro_ATT[PITCH/ROLL] is added to gyroIntegral[PITCH/ROLL]. |
114 | gyro_ATT[PITCH/ROLL] is added to gyroIntegral[PITCH/ROLL]. |
115 | Assuming a constant rotation rate v and a zero initial gyroIntegral |
115 | Assuming a constant rotation rate v and a zero initial gyroIntegral |
Line 116... | Line 116... | ||
116 | (for this explanation), we get: |
116 | (for this explanation), we get: |
117 | 117 | ||
118 | gyroIntegral = |
118 | gyroIntegral = |
Line 119... | Line 119... | ||
119 | N * gyro / HIRES_GYRO_INTEGRATION_FACTOR = |
119 | N * gyro / HIRES_GYRO_INTEGRATION_FACTOR = |
Line 120... | Line 120... | ||
120 | N * I * H * v / HIRES_GYRO_INTEGRATION_FACTOR |
120 | N * I * H * v / HIRES_GYRO_INTEGRATION_FACTOR |
Line 121... | Line 121... | ||
121 | 121 | ||
Line 122... | Line 122... | ||
122 | where N is the number of summations; N = t/2ms. |
122 | where N is the number of summations; N = t*488. |
Line 123... | Line 123... | ||
123 | 123 | ||
124 | For one degree of rotation: t*v = 1: |
124 | For one degree of rotation: t*v = 1: |
125 | 125 | ||
126 | gyroIntegralXXXX = t/2ms * I * H * 1/t = INTEGRATION_FREQUENCY * I * H / HIRES_GYRO_INTEGRATION_FACTOR. |
126 | gyroIntegralXXXX = t * 488 * I * H * 1/t = INTEGRATION_FREQUENCY * I * H / HIRES_GYRO_INTEGRATION_FACTOR. |
127 | 127 | ||
Line 128... | Line 128... | ||
128 | This number (INTEGRATION_FREQUENCY * I * H) is the integral-to-degree factor. |
128 | This number (INTEGRATION_FREQUENCY * I * H) is the integral-to-degree factor. |
129 | 129 | ||
130 | Examples: |
130 | Examples: |
Line 293... | Line 293... | ||
293 | * Zero-offset accelerometers and write the calibration data to EEPROM. |
293 | * Zero-offset accelerometers and write the calibration data to EEPROM. |
294 | */ |
294 | */ |
295 | void analog_calibrateAcc(void); |
295 | void analog_calibrateAcc(void); |
Line 296... | Line 296... | ||
296 | 296 | ||
Line 297... | Line 297... | ||
297 | 297 | ||
298 | void analog_setGround(); |
298 | void analog_setGround(void); |
Line 299... | Line 299... | ||
299 | 299 |