jdl

  • ***
  • 246
Issue with Accel & Gyro Calibration Procedures in Next.589
« on: April 03, 2018, 09:43:27 am »
Seems like calibration of accelerometers and gyros will produce erroneous final results in next.589 if the initial accel_bias is not "0" and accel_scale is not "1" (and gyro_bias is not "0", respectively). I've noticed this on Revo, not tested with CC3D yet.

I mean if the calibrations are done on freshly erased board, they are ok as the biases and scales are at their defaults. But subsequent calibrations produce more and more shifted values as the calibration results are applied over the old calibration data.

The issue is easily reproduced if we set gyro_bias to some insane values, eg. 10,50,200 for x,y,z and do the gyro calibration. "Raw gyrostate" in the scopes shows the proportional to the initial gyro_bias giant deviations from the zero.

Same can be done for accels.

This issue should be quite easy to be fixed in the firmware. Meanwhile it's enough the user to set manually biases and scales to default in Object Browser: Settings | AccelGyroSettings | accel_bias , etc. and then do the calibrations.


« Last Edit: April 03, 2018, 01:27:21 pm by jdl »

Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #1 on: April 03, 2018, 04:10:27 pm »
After doing thermal calibration, you must redo gyro calibration for the gyro noise to be centered on zero again.  This is for 16.09.  It may be that you need to additionally recal accels in next.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #2 on: April 03, 2018, 06:28:34 pm »
I can't reproduce your issue, maybe i don't understand what do you mean.

While starting Accel calibration, scales are set to 1 and biases to 0 so the 6 point calibration is fine at end for Accels.
If you do wrong calib (like miss a orientation and finally the result is not consistent) and at end the calibration fails, previous values are copied.

Quote
The issue is easily reproduced if we set gyro_bias to some insane values, eg. 10,50,200 for x,y,z and do the gyro calibration. "Raw gyrostate" in the scopes shows the proportional to the initial gyro_bias giant deviations from the zero.
Here, while doing Gyro bias calibration starting with wrong biases, the final biases are ok after calibration.
You talk about "giant deviations": biases just shift values, and do not result in bigger deviations.
Maybe you changed Gyro scales ?
Gyro scales should not be manually changed since the gyro calibration only handle Gyro biases, not Gyro scales.

In all cases the new calibration numbers are copied after you click the Save button.

jdl

  • ***
  • 246
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #3 on: April 03, 2018, 10:52:44 pm »
I'll try to explain better, sorry, I don't speak English very well... I now see that I used term "deviations" incorrectly, I meant "shifts"...

I don't change gyro_scales, they are "1" as by default.

My suggestion is the the initial gyro_bias.x,y,z are not cleared on the start of calibration procedure and participate in calculations in some way.

I just reproduced the issue. Here is what I do:

1. In Object Browser I set :
    - Settings | AccelGyroSettings | gyro_bias.[X] = 1
    - Settings | AccelGyroSettings | gyro_bias.[Y] = 100
    - Settings | AccelGyroSettings | gyro_bias.[Z] = 1000

2. As a result, in the scopes Raw GyroState shows values for
    - X: 21 deg/s
    - Y: -92 deg/s
    - Z: -999 deg/s

3. I perform Configuration | Attitude | Calibration | Gyro Bias Calibration | Start ....... Save

This is with the UAV perfectly still, in quiet environment. Thermal calibration was done before for that FC, range -10..90C, in complete darkness and motionless, presumably no air pressure changes.

4. In the scopes Raw GyroState shows values for
    - X: -23.6 deg/s
    - Y: -6.6 deg/s
    - Z: -0.2 deg/s

These values are far from expected +-0.1 deg/s.

5. I perform again Configuration | Attitude | Calibration | Gyro Bias Calibration | Start ....... Save

6. In the scopes Raw GyroState shows values for
    - X: -0.05 deg/s
    - Y: 0.05 deg/s
    - Z: 0.65 deg/s

These values are much better but Z axle is still shifted unpleasantly.

Of course, in normal situation starting gyro biases won't have so abnormally high values. But they still mess the subsequent gyro bias calibrations.

7. Finally, I set manually in Object Browser :
    - Settings | AccelGyroSettings | gyro_bias.[X] = 0
    - Settings | AccelGyroSettings | gyro_bias.[Y] = 0
    - Settings | AccelGyroSettings | gyro_bias.[Z] = 0

8. In the scopes I see uncalibrated Raw GyroState values :
    - X: -0.9 deg/s
    - Y: 0.75 deg/s
    - Z: 0.7 deg/s

9. I perform Configuration | Attitude | Calibration | Gyro Bias Calibration | Start ....... Save

10. In the scopes I now see very nice Raw GyroState values, approximately :
    - X: 0 deg/s
    - Y: 0 deg/s
    - Z: 0 deg/s

So: If gyro_bias is cleared manually in Object Browser before starting Gyro Bias Calibration procedure, the results of calibration are perfect, otherwise not.

Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #4 on: April 03, 2018, 11:07:23 pm »
A related item:  I recall that I limited my thermal cal to +70C because there are some components that are limited ... to +70C?

I mention this because I wonder if thermal calibration outside of spec range could cause bad values which pull the whole temperature scale into a mismatch?

Just something to keep in the back of your mind.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #5 on: April 04, 2018, 01:50:17 am »
Please try to reproduce de Gyro_bias issue you describe while setting the AttitudeSettings > BoardLevelTrim (Roll/Pitch) set to 0.

jdl

  • ***
  • 246
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #6 on: April 05, 2018, 10:49:04 am »
Tested it.

You are right: when BoardLevelTrim values are set to 0, the calibration produces correct results no matter what the old gyro_bias.x,y,z were before calibration start.

Having either or both BoardLevelTrim values non-zero, calibration procedure produces shifted from 0 results if gyro_bias were non-zero on start of it.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #7 on: April 05, 2018, 08:44:08 pm »
Ok, thanks for testing.
Can you open a Jira issue ?

jdl

  • ***
  • 246
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #8 on: April 07, 2018, 08:30:32 am »
Sure. I'm just away for a few days...

I'd also like to test more thoroughly if this applies to accelerometer calibration too. And describe both in the jira issue. Or better open two issues if necessary?

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #9 on: April 07, 2018, 10:47:00 am »
Quote
I'd also like to test more thoroughly if this applies to accelerometer calibration too.
The answer is yes.

One Jira ticket will be enough.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Issue with Accel & Gyro Calibration Procedures in Next.589
« Reply #10 on: April 10, 2018, 07:45:47 pm »
Thanks for Jira.
Pull request is here, please test and approve if result is ok.