You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
accelerationResolution / gyroscopeResolution are calculated in MPU6050_Base::initialize, however these values are not updated when calling setFullScaleAcceRange / setFullScaleGyroRange. This is seen when calling get_acce_resolution / get_gyro_resolution, as it does not have the updated value from setFullScaleAcceRange / setFullScaleGyroRange.
In the steps to reproduce, the problem is seen at step 9.
Setup:
Library version 1.4.1
MPU6050 breakout board
ESP32 WROOM microcontroller
Wire I2C
ESP boards version 2.0.4 (outdated, but I don't think it effects this problem)
Problem:
accelerationResolution / gyroscopeResolution are calculated in MPU6050_Base::initialize, however these values are not updated when calling setFullScaleAcceRange / setFullScaleGyroRange. This is seen when calling get_acce_resolution / get_gyro_resolution, as it does not have the updated value from setFullScaleAcceRange / setFullScaleGyroRange.
In the steps to reproduce, the problem is seen at step 9.
Setup:
Steps to reproduce:
Open the MPU6050_raw.ino sketch
Comment out the other Serial.print's in loop
Add this snippet to loop:
Serial.print("accel range: \t");
Serial.print(mpu.getFullScaleAccelRange());
Serial.print("\t resolution: \t");
Serial.println(mpu.get_acce_resolution(),8);
Serial.print("gyro range: \t");
Serial.print(mpu.getFullScaleGyroRange());
Serial.print("\t resolution: \t");
Serial.println(mpu.get_gyro_resolution(),8);
delay(500);
Compile and Upload
The Serial Monitor says:
accel range: 0 resolution: 0.00012207
gyro range: 0 resolution: 0.01525879
The range is correct based on the default.
The resolution is correct based on the default.
Check the math...
accel resolution: 2.0 / 16384.0 = 0.00012207
gyro resolution: 250.0 / 16384.0 = 0.015258789
This result passes.
mpu.setFullScaleAccelRange(MPU6050_ACCEL_FS_4);
mpu.setFullScaleGyroRange(MPU6050_GYRO_FS_500);
Compile and Upload
The Serial Monitor says:
accel range: 1 resolution: 0.00012207
gyro range: 1 resolution: 0.01525879
The range is correct based on the changes in step 7.
The resolution is not correct, and gives the same result as step 5.
This result does not pass.
Comment out the two lines from step 7
Comment out initialise in setup
// mpu.initialize();
Add this below the line for step 11:
mpu.initialize(ACCEL_FS::A4G, GYRO_FS::G500DPS);
Compile and Upload
14: The Serial Monitor says:
The range is correct based on the paramaters passed to initialise.
The resolution is correct based on the paramaters passed to initialise.
Check the math...
accel resolution: 4.0 / 16384.0 = 0.00024414
gyro resolution: 500.0 / 16384.0 = 0.030517578
This result passes.
Solution:
Added switch statement to setFullScaleAccelRange / setFullScaleGyroRange that sets accelerationResolution / gyroscopeResolution based on the range.
Removed accelerationResolution / gyroscopeResolution lines in the switch statements in both initialize functions
Validation:
Follow Steps to Reproduce step 1 - 8 inclusive
The Serial Monitor says:
accel range: 1 resolution: 0.00024414
gyro range: 1 resolution: 0.03051758
Check the math...
accel resolution: 4.0 / 16384.0 = 0.00024414
gyro resolution: 500.0 / 16384.0 = 0.030517578
This result passes.
The text was updated successfully, but these errors were encountered: