Issues for a persistent perfect level : accel calibration + autotrim/save trim

I was trying to get a perfect level with a small copter (250mm) indoor and while doing this I’ve observed some strange things.
I’ve made the 3 axis accel calibration, after that I started the save trim radio procedure to fine tuning the level.
I tried the autotrim function too, but indoor I prefer the savetrim for a more precise tuning.
In this log I was doing ONLY the save trim procedure, in the middle the position was already with a really small drifting. But for correcting a smal roll drifting I had to put a quite high roll trim (about 5 degres). In the final part you can see this happening with the roll raises while the aircraft was still fix keeping its position.

At the end I’ve saved this trims, and the console confirm the saved trims, bring back to 0 the trims on the radio, reboot.
The second log is the fly after reboot, and you can see already on the ground a not leveled roll. When the copter goes in its “perfect level” it flyes away so I repeatedly needed to bring it back in the center of the room. In the final part of the log I was keeping the quad leveled with the radio and you can see the offset on the roll and pitch.

first log / save trim
second log flying after the above same trim

From the observation I don’t understand if I have a problem that in flying the perfect level is changing or the level change at the reboot. Because I’ve experienced various flights where the level changed a little bit in fly.
Maybe I have some wrong parameters which affects the IMU performance ?

I’ve tried the INS_ACCEL_FILTER at 20 and 40Hz without difference.
I’m also taking advance of a INS_NOTCH filter that maybe has to be fine tuned as well.
If I’ll find a good level is it a good idea to set INS_TRIM_OPTION to 0 to prevent leveling on boot on uneven floor?



The INS_TRIM_OPTION can be left at “1” I think. This is only used as part of the accelerometer calibration - we don’t re-do the accel calibration or set the AHRS_TRIM after a reboot. If INS_TRIM_OPTION is set to “1”, then during the first step of the accelerometer calibration, the AHRS_TRIM is set assuming the vehicle’s is being held level.

Re the vehicle not flying level after a reboot… I can imagine a few possible causes:

  • we have an issue in our save-trim procedure in which the values being saved are not quite correct (perhaps there is a roll vs pitch ordering issue).
  • an AHRS/EKF issue in which the attitude takes a while to become correct after reboot (this could happen with the GPS enabled/disabled).

Sorry to ask you to do more investigation but I wonder if you could turn off the GPS and/or also try with Copter-3.5.7 to see if the same issue happens?

Thanks Randy, after intensive days of tests I’ve found out the issues was determineted by the notch filter, disabling it made the copter fly and behave as normal.

Fortunatly today I’ve read on the ChiBios room in gitter @Paul_Atkin1 is reporting the same issues on chibios with the Notch filter:

on a different topic - can anybody point me what module has a handling of the ‘INS_NOTCH_FREQ’ and whole notch filtering? i tried grepping whole code base by the ‘INS_NOTCH’ and it returned me nothing - not sure why.
Paul Atkin
ott 22 15:16
this image above is what i am trying to fix - but it produces very strabge effect with drone flipping and not even able to liftoff with notch filter activated.
damn, found it, and cannot edit earlier post - /git/ardupilot/libraries./Filter it is.

we have an issue in our save-trim procedure in which the values being saved are not quite correct (perhaps there is a roll vs pitch ordering issue).

Instead about the save trim procedure I’ve observed that while I put trim in both pitch and roll, the saved trim always save only on one of the two. I guess could be a issue on this, could you have a look?