Surprise surprise…

though not the nice kind Cilla Black used to host on prime time UK TV until the turn of the millenium.

Very wonky pitch angles

Very wonky pitch angles

Although angles have been ‘sorted’ for a long while now, I took a look at them from the last test flight to try to work out why Phoebe insisted on thinking she was drifting backwards, resulting in her real world compensation of drifting forwards.

Look at the 3 green lines – they start off well (she took off with her nose up by about 10°), but around 3 seconds, the gyro (i_pitch) and the accelerometer (e_pitch) clearly have a major disagreement.  Net result of the complementary filter (c_pitch) is that Phoebe thinks her nose is pointing upwards, and as a result, she’s going to think she’s going backwards (which is exactly what yesterday’s graph shows), and so she compensates by dropping her nose, and hence start moving forwards, which is what happened yesterday in real life.

At a guess the complementary filter is now paying way too much heed to the gyro now I’ve got everything so beautiful tuned and averaged with the accelerometer readings.

Time to tweak tau in the complementary filter down from 0.5s to something a lot smaller, and see what happens although to be honest, that’s just a workaround / hack – I’d rather understand why the gyro and accelerometer suddenly disagree so much, but for the moment, I’m very short of ideas – perhaps it’s time to retire the gyro from angle calculations completely and instead use it solely for angular stability?  Hmm now, there’s a thought.

3 thoughts on “Surprise surprise…

  1. Perhaps what is needed is a ‘testbed’ which just records what it thinks it’s angular orientation is over a period? First test, no movement, second test a bit of pitch up/down, and so on.
    Going to have to look over the theory again, as just at the moment I don’t quite see why there are e_pitch and e_roll from the accelerometers. (Of course, doesn’t help that my head feels like a big ball of cotton wool at the moment).

    • If the quadcopter isn’t accelerating, then the only force is gravity (and perhaps some drag – but lets leave that out for now); if the quad is at an angle, then each sensor detects a portion of total gravity. Trigonometry then gives angles.

      However if there is acceleration in addition to gravity, then the angles are wrong from just this source; that’s where the gyro steps in – integrating the rotation rate from the gyro over time gives angles too. This is fine for short term, but gyros are known to drift (not sure if this is mechanical or the integration).

      And that’s where the complementary filter steps in – the integrated gyro is used for short term changes, but the accelerometer is used for long term on the basis that a flight happens primarily at stable velocities.

      I’ve tested the accelerometer readings on a testbed as you describe, and after calibration the results are extremely accurate. I haven’t tried the gyros due to the need for rotation in the testbed. I’ll give it a go and see what it yields, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.