Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.11 reset icm20689 accel calibration? #14777

Closed
dagar opened this issue Apr 28, 2020 · 9 comments
Closed

v1.11 reset icm20689 accel calibration? #14777

dagar opened this issue Apr 28, 2020 · 9 comments
Assignees
Labels
bug Drivers 🔧 Sensors, Actuators, etc

Comments

@dagar
Copy link
Member

dagar commented Apr 28, 2020

With the new icm20689 the scale factor offset comes out close to 0. Existing setups calibrated with PX4 v1.10 (the mpu6000 driver) seem to have an offset on one axis that's nearly 2.

This is a bit hacky, but at param import time we can identify this in the parameters and reset the offset if it exists only on one axis and exceeds some arbitrary value.

FYI @MaEtUgR

@dagar dagar added bug Drivers 🔧 Sensors, Actuators, etc labels Apr 28, 2020
@dagar dagar added this to the Release v1.11.0 milestone Apr 28, 2020
@dagar dagar self-assigned this Apr 28, 2020
@MaEtUgR
Copy link
Member

MaEtUgR commented Apr 28, 2020

@dagar I didn't see a scale of 2 in my cases. Is that a different issue?

I was reporting the case where I had to recalibrate the accelerometer on both vehicles that had a Firmware older than 2 months ago and I updated to master. I recalibrated because both vehicles showed a steep pitch angle when completely level in the attitude estimate represented by QGC's virtual horizon after updating.

The quadrotor uses a pixhawk 4 mini
The plane uses a pixhawk 4

quad before quad after plane before plane after
CAL_ACC0_ID 3932170 3932170 3866634 3932170
CAL_ACC0_XOFF 1.581990 -0.173167 -2.507170 -0.041409
CAL_ACC0_XSCALE 0.932632 1.001169 0.925561 0.999273
CAL_ACC0_YOFF 0.150241 0.251485 0.071872 0.041645
CAL_ACC0_YSCALE 0.997267 0.999228 1.003336 0.985294
CAL_ACC0_ZOFF -0.238199 -0.227139 -0.043277 0.089027
CAL_ACC0_ZSCALE 0.987909 0.985522 0.984737 0.978124

These are always the primary accelerometers and what I see is a clear change in x-axis offset which would also explain the pitch error. I do not know how the same calibration was considered perfectly level before since I flew both platforms a lot without issues or need to recalibrate the accel.

As a solution to the offset problem I only see recalibration. Maybe it would have not even armed because of consistency checks but I didn't dare to try.

@dagar dagar changed the title v1.11 reset icm20689 accel scale factor if ~ 2 v1.11 reset icm20689 accel calibration? Apr 28, 2020
@dagar
Copy link
Member Author

dagar commented Apr 28, 2020

The root cause appears to be this undocumented register applied to ICM devices in the old mpu6000 driver. This mpu6000 driver was used for the mpu6000, icm20602, icm20608g, icm20689 up until recently.

https://github.com/PX4/Firmware/blob/ccaa103164a09d66ff9faf4fcdfb39a09ba834a1/src/drivers/imu/mpu6000/MPU6000.cpp#L194

@dagar
Copy link
Member Author

dagar commented Apr 28, 2020

I think the only question then is if we force recalibration of everything if the offset is this bad or can we get away with only clearing the single offset under the right conditions.

@bys1123

This comment has been minimized.

@bys1123

This comment has been minimized.

@bys1123
Copy link
Contributor

bys1123 commented May 2, 2020

After upgrade to 1.11, pre-flight check will tell users accel inconsistent, so may not cause un-safety?

@dagar
Copy link
Member Author

dagar commented May 2, 2020

After upgrade to 1.11, pre-flight check will tell users accel inconsistent, so may not cause un-safety?

Yes, so this is more about trying to make the upgrade experience less unpleasant.

@bys1123
Copy link
Contributor

bys1123 commented May 3, 2020

I flash back to 1.10, shows accel is uncalibrated.

@dagar
Copy link
Member Author

dagar commented Jun 18, 2020

I've decided to leave it alone. If the offset is sufficiently different and beyond the estimator bias limits you'll be unable to arm until you recalibrate.

This is a good reminder that we should be a bit more discerning before letting undocumented magic "fixes" slip into the code base. https://github.com/PX4/Firmware/blob/6afa7e4368c4bb925b298f2f50aa3c50cdebdf71/src/drivers/imu/mpu6000/MPU6000.cpp#L666-L669

@dagar dagar closed this as completed Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Drivers 🔧 Sensors, Actuators, etc
Projects
None yet
Development

No branches or pull requests

3 participants