d-ronin / dRonin

The dRonin flight controller software.
http://dronin.org
Other
289 stars 167 forks source link

Flight: Add CF Accel Cutoff (Experimental - Not for merge) #2252

Open jihlein opened 5 years ago

jihlein commented 5 years ago

This PR adds an accel cutoff to the complementary attitude filter. It's purpose is to prevent the bias calculations from running away when the aircraft is subjected to flight loads above and below 1 G.

There is a new UAVObject, AccCutoff, in the attitude settings that defines how sharp the cutoff is. It defaults to 0.1. An accel confidence factor is calculated from the cutoff and current magnitude of the accel vector. The accel confidence ranges from 0 to 1, and is multiplied against accKi and accKp, effectively freezing the bias terms during dynamic maneuvering.

This has not been flight tested. On the bench it does not do anything strange. Comments and flight test help appreciated. I used this concept on a different project quite a few years back. It seemed to work as desired. But as always, test carefully.

tracernz commented 5 years ago

build artifacts please

dronin-ci commented 5 years ago

Artifacts built, by request of @tracernz

glowtape commented 5 years ago

I need to test some other attitude changes this weekend, I'll slap this on, too.

fxbisto commented 5 years ago

Awesome, I'll get involved too. Now that I've seen how it can fly without the constant gyro biasing it'll be a good comparison. Probably won't be for a couple of days

glowtape commented 5 years ago

Just did a living room hover test. The 0.1 default in this patch is definitely too low. It never gets the chance to debias and I think it even started drifting a bit more. 0.25 works in the living room.

glowtape commented 5 years ago

So I went just flying a pack outside, with fake gyro drift and BiasCorrectOn and 0.25 cutoff. At the end, there was still a bit of unnecessary gyrobias, based on the tilt in leveling, but it was reduced a lot compared to before. So this is worthwhile to explore.

jihlein commented 5 years ago

That’s a great start. I think we need to tune the cutoff for the smallest value that works in hover, then see what happens in fast forward and acrobatic flight. I don’t know if I’ll get to this this weekend or not....

glowtape commented 5 years ago

The origin of that idea/code is GPL 3.0, for reference. https://github.com/vedderb/QuadcopterSystem/blob/master/LICENSE

jihlein commented 5 years ago

Added the accelConfidence factor to the AttitudeActual UAVO for analysis purposes.

mlyle commented 5 years ago

We played with this exact idea before --- I cannot find the pull request. Consensus was that it didn't work (at least how I tuned/implemented it). Would love for that to be wrong / for gating attitude updates to make sense.

mlyle commented 5 years ago

jenkins, build artifacts please

mlyle commented 5 years ago

jenkins, test this please

dronin-ci commented 5 years ago

Artifacts built, by request of @mlyle