-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* MPU calibration When the bot is in a steady horizontal position the value recorded by the gyroscope and accelerometer of the MPU6050 should be : gx = 0 gy = 0 gz = 0 and ax = 0 ay = 0 az = 16384 But, we get some error in the values at the steady horizontal position. This PR aims to add a function to calculate optimum offsets for MPU6050. Subtracting these offsets from accelerometer and gyroscope raw values will account for the zero error caused. The approach followed is as follows: 1. Keep the bot in a horizontal stable state when the flashed code starts running. 2. Take an average of 1000 readings and set the offset to these readings. 3. Take the average of next 1000 readings, but deduct the offset obtained in step 2 from each raw reading. 4. Add this average to the offset. 5. Repeat this process until the average becomes close to zero. * Add documentation and made requested changes. * changed while loop to for loop * Move the warning statement out of the for loop i will never be equal to the MAX_CALIBRATION_ATTEMPTS. Move the if condition out of the loop to fix this condition. * fix the typo in G_RAW_VALUE and remove comments Co-authored-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
- Loading branch information
1 parent
27e65bc
commit 942e6df
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters