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

Accelerometer calibration problem on FMUV5 #11695

Closed
RomanBapst opened this issue Mar 21, 2019 · 12 comments · Fixed by #11713
Closed

Accelerometer calibration problem on FMUV5 #11695

RomanBapst opened this issue Mar 21, 2019 · 12 comments · Fixed by #11713
Assignees
Labels
Board: Pixhawk fmu-v5 FMU-v5 including pixhawk 4, pixhack v5, etc bug

Comments

@RomanBapst
Copy link
Contributor

RomanBapst commented Mar 21, 2019

Describe the bug
We noticed a high magnitude of the accelerometer Z component which we could not eliminate even after several accelerometer calibrations. It seems that only the first instance of the sensor_accel topic is affected. Furthermore, the problem does not occur with 1.8.2 on the same hardware with the same parameters.

image

@RomanBapst RomanBapst added bug Board: Pixhawk fmu-v5 FMU-v5 including pixhawk 4, pixhack v5, etc labels Mar 21, 2019
@RomanBapst
Copy link
Contributor Author

@bkueng @dagar FYI

@dagar
Copy link
Member

dagar commented Mar 21, 2019

Were the calibration parameters changing between attempts or relative to 1.8.2?

@RomanBapst
Copy link
Contributor Author

@dagar No

@RomanBapst
Copy link
Contributor Author

@dagar Sorry, I should explain better. Calibration params were not changed when moving between master and 1.8. We are able to reproduce this on several devices.

@dagar dagar added this to the Release v1.9.0 milestone Mar 21, 2019
@dagar dagar self-assigned this Mar 21, 2019
@julianoes
Copy link
Contributor

Selection_001

Two things that caught my eye:

The X-offset is really high (~2 m/s^2) although this seems to be correct for my Pixhawk 4.
The Z-offset is small but if I change the sign of it, we reach 9.81 much more accurate.

@dagar
Copy link
Member

dagar commented Mar 24, 2019

I reproduced this locally and confirmed both stable (v1.8.2) and current master produce effectively the same calibration parameters on the same hardware.

@dagar
Copy link
Member

dagar commented Mar 24, 2019

The raw data looks equivalent, but the scaling changed.

master

scaling: 0.0048

stable

scaling: 0.005

EDIT: Disregard, only the listener float print format changed. Confirmed scaling didn't change.

@bresch
Copy link
Member

bresch commented Mar 24, 2019

@dagar After bisecting the commits, I found the guilty one:

commit d299d439c626e2cbdb94d506d857fb7e664cfe18
Author: Daniel Agar <daniel@agar.ca>
Date:   Mon Jan 14 16:15:23 2019 -0500

    mpu6000 use new PX4Accelerometer and PX4Gyroscope classes

On commit d299d43

INFO  [sensors] accel status:
INFO  [ecl/validation] validator: best: 1, prev best: 1, failsafe: NO (0 events)
INFO  [ecl/validation] sensor #0, prio: 75, state: OK
INFO  [ecl/validation] 	val:  -0.0356, lp:  -0.0269 mean dev:  -0.0076 RMS:   0.0773 conf:   1.0000
INFO  [ecl/validation] 	val:   0.2122, lp:   0.1995 mean dev:   0.0003 RMS:   0.0184 conf:   1.0000
INFO  [ecl/validation] 	val: -10.3720, lp: -10.3181 mean dev:   0.0002 RMS:   0.0437 conf:   1.0000
INFO  [ecl/validation] sensor #1, prio: 99, state: OK
INFO  [ecl/validation] 	val:  -0.1478, lp:  -0.1488 mean dev:  -0.0033 RMS:   0.0398 conf:   1.0000
INFO  [ecl/validation] 	val:   0.1883, lp:   0.1141 mean dev:  -0.0006 RMS:   0.0232 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7528, lp:  -9.7770 mean dev:   0.0004 RMS:   0.0521 conf:   1.0000

On the previous one (91dcfb7):

INFO  [sensors] accel status:
INFO  [ecl/validation] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [ecl/validation] sensor #0, prio: 100, state: OK
INFO  [ecl/validation] 	val:  -0.0584, lp:  -0.0613 mean dev:  -0.0028 RMS:   0.0488 conf:   1.0000
INFO  [ecl/validation] 	val:   0.0588, lp:   0.0928 mean dev:  -0.0001 RMS:   0.0169 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7833, lp:  -9.8157 mean dev:   0.0007 RMS:   0.0701 conf:   1.0000
INFO  [ecl/validation] sensor #1, prio: 99, state: OK
INFO  [ecl/validation] 	val:  -0.1555, lp:  -0.1432 mean dev:  -0.0003 RMS:   0.0179 conf:   1.0000
INFO  [ecl/validation] 	val:   0.0595, lp:   0.0846 mean dev:  -0.0001 RMS:   0.0224 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7305, lp:  -9.7932 mean dev:   0.0001 RMS:   0.0733 conf:   1.0000

Note that I didn't do any calibration between the two tests, It's then not a calibration issue.

@dagar
Copy link
Member

dagar commented Mar 24, 2019

The raw data is equivalent between stable (left) and master (right).

Screenshot from 2019-03-24 13-07-52

@dagar
Copy link
Member

dagar commented Mar 24, 2019

It's even more apparent looking at the absolute value of the filtered accel data. Again stable left, master right.

Screenshot from 2019-03-24 13-13-30

@dagar
Copy link
Member

dagar commented Mar 24, 2019

It looks like this is coming from floating point loss of precision. In PX4 master the sensor data is rotated after being scaled and stored as floats (raw data is int16). In stable the rotation is done with the data still scaled (2048 G/LSB), then scaled down.

dagar added a commit that referenced this issue Mar 24, 2019
 - prevents loss of numerical precision
 - fixes #11695
@dagar
Copy link
Member

dagar commented Mar 24, 2019

@dagar After bisecting the commits, I found the guilty one:

commit d299d439c626e2cbdb94d506d857fb7e664cfe18
Author: Daniel Agar <daniel@agar.ca>
Date:   Mon Jan 14 16:15:23 2019 -0500

    mpu6000 use new PX4Accelerometer and PX4Gyroscope classes

On commit d299d43

INFO  [sensors] accel status:
INFO  [ecl/validation] validator: best: 1, prev best: 1, failsafe: NO (0 events)
INFO  [ecl/validation] sensor #0, prio: 75, state: OK
INFO  [ecl/validation] 	val:  -0.0356, lp:  -0.0269 mean dev:  -0.0076 RMS:   0.0773 conf:   1.0000
INFO  [ecl/validation] 	val:   0.2122, lp:   0.1995 mean dev:   0.0003 RMS:   0.0184 conf:   1.0000
INFO  [ecl/validation] 	val: -10.3720, lp: -10.3181 mean dev:   0.0002 RMS:   0.0437 conf:   1.0000
INFO  [ecl/validation] sensor #1, prio: 99, state: OK
INFO  [ecl/validation] 	val:  -0.1478, lp:  -0.1488 mean dev:  -0.0033 RMS:   0.0398 conf:   1.0000
INFO  [ecl/validation] 	val:   0.1883, lp:   0.1141 mean dev:  -0.0006 RMS:   0.0232 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7528, lp:  -9.7770 mean dev:   0.0004 RMS:   0.0521 conf:   1.0000

On the previous one (91dcfb7):

INFO  [sensors] accel status:
INFO  [ecl/validation] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [ecl/validation] sensor #0, prio: 100, state: OK
INFO  [ecl/validation] 	val:  -0.0584, lp:  -0.0613 mean dev:  -0.0028 RMS:   0.0488 conf:   1.0000
INFO  [ecl/validation] 	val:   0.0588, lp:   0.0928 mean dev:  -0.0001 RMS:   0.0169 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7833, lp:  -9.8157 mean dev:   0.0007 RMS:   0.0701 conf:   1.0000
INFO  [ecl/validation] sensor #1, prio: 99, state: OK
INFO  [ecl/validation] 	val:  -0.1555, lp:  -0.1432 mean dev:  -0.0003 RMS:   0.0179 conf:   1.0000
INFO  [ecl/validation] 	val:   0.0595, lp:   0.0846 mean dev:  -0.0001 RMS:   0.0224 conf:   1.0000
INFO  [ecl/validation] 	val:  -9.7305, lp:  -9.7932 mean dev:   0.0001 RMS:   0.0733 conf:   1.0000

Note that I didn't do any calibration between the two tests, It's then not a calibration issue.

Ha, thanks @bresch. I only just saw your reply now.

LorenzMeier pushed a commit that referenced this issue Mar 24, 2019
 - prevents loss of numerical precision
 - fixes #11695
RomanBapst pushed a commit that referenced this issue Apr 26, 2019
 - prevents loss of numerical precision
 - fixes #11695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Board: Pixhawk fmu-v5 FMU-v5 including pixhawk 4, pixhack v5, etc bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants