The YouTube motion control video got me thinking: in their setup, their sponge ball tracking systems gives them centimeter accuracy of the speed, position and orientation of the quad(s).
Phoebe uses the accelerometer with coordinates reorientated to the earth’s axes using the various angle calculations to do the same for speed and position. She currently doesn’t track yaw ( => orientation) – I just try to minimize it using the z-axis gyro – I’ll need a compass to track it accurately.
And despite all my best attempts, she drifts and I’m really struggling to track down why, primarily due to a lack of a plan. I’d just assumed the drift was due to bad PID tuning, or poor angles reorientating the quad accelerometer axis to earth coordinates; my approach has just been to tweak PIDs and other config parameters in search of the holy grail combination, but so far to no avail.
So in today’s tests, I’ve converted her sensor plots into a map of where Phoebe thinks she’d been compared to where I saw her go.
And actually, despite having to double integrate acceleration to distance, it’s a reasonable match of the flight.
She moves forward by roughly 0.9 meters, and moves to the right (negative is reverse / right direction) by about 0.5 meter.
- it’s clear she’s trying to correct left / right drift for a bit before she just goes off on one
- it’s also clear she doesn’t make a similar effort to correct the forward drift
- the left / right scale is out by a factor of 5 – she eventually drifted right by about 2.5 meters
The first problem suggests that once the complementary filters starts to favour the accelerometer, then drift protection starts to fail.
The second problem suggests I may have my forward / backward drift compensation the wrong way round, so she accelerates forward in compensation for forward acceleration – though I’m not convinced here.
The cause of the third problem I can’t explain, but the difference in resolution in the accelerometer axes makes it hard for consistent calculations for drift – not good
For me, I’m delighted, as by mapping her path, I’ve found lots of useful facts that previously I’ve just been speculating on.
Further thoughts a few hours later…
The consistent forward acceleration (rather than drift compensation) is due to a bug I fixed a while back that seems to have crept back in – my bad.
The short term left / right drift compensation seems to just need PID tuning – I think oscillations like this are usually due to an excessive P, so I need to reduce that, and consider adding some I (for “return to where you a started”) and D (for “get a shift on now!”.
The longer term left / right drift’s (lack of) compensation is most interesting: the equidistant dots suggest strongly Phoebe believes she is moving to the right at constant speed and is horizontal; that matches what I saw. Bearing in mind this is sensor data, it’s used as PID feedback, so the Y axis horizontal speed PID should do something about this, yet it doesn’t appear to. For the moment, I have no idea how this can come about so it’s frustrating – interesting too, but primarily frustrating.
I have no idea where to start about the factor of five scaling difference between the axes; I’ll just have to keep my eye on it during Monday’s testing. Currently, the only solution is a dirty hack to multiply the left-right earth coordinate acceleration by 5 before integrating.
Finally, I’m still delighted that producing this map works, and provides a new kind of insight into flight problems.
P.S. Anyone else think this looks like an eagle soaring?