Tridge, I just looked thru 2.32 specifically for the level thing. Maybe you did,t see my previous comment here. I did this this on my head tracker on a imu v3. You need to have a < g.manual_level == 1>. Wait for gyros to get their offsets, and then trig the accelerometers and plug that into the <Matrix3<T>::from_euler> and initialize the DCM with that matrix.
I see what you mean, but that's very much a second order effect. The time constant on the PI controller in DCM is just a few seconds. So even if you startup with the plane upside down it gets the right attitude in a few seconds with MANUAL_LEVEL==1. I just tried it, and from upside down it works things out in 9 seconds. From a 20 degree tail dragger pitch it takes 3 seconds to get the right attitude after booting. I don't think many people will manage to take off within 3 seconds of booting.
The only problem with this is that it pushes omegaI off by a small amount, but we have a slope limit on that, so it doesn't matter much. omegaI matters on the order of minutes, not seconds.
I could do the from_euler() or just ask DCM to advance the omegaP by a big factor for a second after startup, but it's not a big deal.
There is one situation where it does matter, and that is an airstart. In that case those few seconds could cost you the plane, but that applies regardless of the setting of MANUAL_LEVEL. So it would be nice to have a ahrs.fast_level() function that pushes up _kP by a factor of 10x for the next second. We could call that on airstart as well as startup with MANUAL_LEVEL==1.
I don't think using trig on the accels isn't the right solution btw, as it won't work in all attitudes. Pushing up _kP is a much better bet, as that uses the normal maths for correcting attitude, and just runs it faster for a while.
Tridge, You're right, it wasn't an issue so it wasn't needed. I did for head tracking googles. I had plans for making a level fixture with a bubble level on it an I had a light bulb moment above my head. I have a digital gravimeter. Leave the goggles still for the init and then the thing is ready to go. It freaked me out how accurate it was. I mounted it on a cam tripod for calibration and testing. I need to make a video. And I did a manual mag calibration and also did a mag scale normalizer.
I think we should fix it for airstart though, and if we fix it there, we may as well use the same method for MANUAL_LEVEL=1.
Do you want to try putting together a patch that adds a ahrs.fast_level() function? The way I imagine it would work is:
Then we can call ahrs.fast_level() on airstart and when MANUAL_LEVEL is 1. It will very quickly get the right level on startup, even if there is lots of vibration.
This could save someones plane someday, as right now if you airstart (ie. APM reboots unexpectedly in the air) then the attitude could be way off for several seconds. That is enough time for it to crash.
That would cover every thing. I just thought being still during start up would take care of the G and at least the gyro offsets would calibrate. An air start??? I will think about it.
Hi, thank you very much.
Looking forward to test it later today.