Yet more indoor testing, indirectly GERMS related, more aimed at investigating drift against the accelerometer dlpf setting.
Speculatively, the net is that
- alpf of 3 or less (>= 41Hz) means there is no vertical drift, but there is horizontal drift because real X- and Y-axis noise is not being filtered out and the motion processing thinks there’s X- / Y-axis acceleration when there isn’t.*
- alpf of 4 or higher (<= 20Hz) gives no horizontal drift, but there is vertical drift because real Z-axis acceleration is being filtered out as noise meaning the motion processing thinks there’s less acceleration than there is.*
Again speculative, I think X- and Y- axis noise was due to unbalanced props leading to asymmetric noise which when integrated leads to non-zero drift velocity: if one of the props has slight damage, this will generate the assymeteric noise very well.
My props do have nicks and muck on them, so I cleaned them up, and tried alpf 3 again, but the drift still remained – to some extent expected as the cleaned props still had nicks in them. So out came a set of unflown props. Balanced as best I can, I tried again at alpf 3. Some vertical drift had appeared unexpectedly, so I tried alpf 2, and it was perfect. So that’s what I’ll be sticking with.
The only down side of this is that the noise getting through at alpf 2 means my germs idea in its basic form is a no go. It’s shelved for the moment as it’s no longer necessary for my short flights, and instead, I’ll see how far I can extend the complementary filter to see how long a zero drift flight can be achieved.
*To be more precise, it the integration of the acceleration (i.e. the velocites) that are wrong. The Z-axis velocity is greater than zero in reality but zero according to the motion processing due to the acceleration that had been filtered out. In contrast, the X- and Y- velocities are zero according to motion processing, but drifting in reality as the dlpf is letting through asymmetric noise.
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
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.
Went to the park again today to test my new angles calculation; complete garbage – with Phoebe whizzing 25m forward before I killed the flight. The change to the angles had left me worried about calibration, specifically for the accelerometer, and to be honest I still do, but luckily I can leave that for another day: after checking the stats, the cause is quite clearly the complementary filter.
As I mentioned, the flight had Phoebe whizzing forwards across the park – i.e. nose down, and that’s quite clear from the integrated gyro pitch angle (i-pitch); it’s not surprising that it’s not visible in e-pitch, the Euler angles, but the fact the complementary filter (c-pitch) had effectively ignored the i-pitch clearly shows the problem. The tau was set to 0.25s but quite clearly from the graph the i-pitch contains critical, accurate information for at least a few seconds without obvious signs of drift. I think I need to start playing with tau at nearer 2.5s!
Just for comparison, I’ve dug out some stats from when I first added the complementary filter; in this test, the blades were not running, I was just manually tilting Phoebe – look how the i-pitch and e-pitch track each other, while the filter output (c-pitch) cancels out the gyro integral drift (i-pitch) – all shown in shades of blue:
Hopefully with tau sorted, I can go back to checking my new angles and putting my mind at rest about whether gravity calibration is correct / useful – more on that once I’ve made a decision.
Just an afterthought: it’s clear from the tests that the accelerometer Euler angles are varying wildly, so perhaps it’s better, at the same time as (say) doubling up tau to 0.5, I also increase the dlpf to 5Hz. Only testing will tell.
P.S. The big downward spike at the end was Phoebe doing a forward roly-poly at the end of the flight as her front legs clipped the ground while she was still travelling at several mph. Funny to watch and zero damage.
It’s a lovely day here at the edge of the Cotswold; bright sunshine and absolutely no wind. So I went to the park.
First flight was perfect – wow I thought, wish I’d brought my camera.
Second flight drifted by 10m and I was glad I hadn’t bothered.
After numerous flights trying to work out what on earth was causing the drift, lots of watching take-off for common features revealed the truth: take-off from non-horizontal ground means there is some lateral power applied by the blades, leading to the drift. As the take-off tilt is corrected, the drift stops accelerating, but still continues at constant speed due to momentum. Hence the overall drift across the flight.
By having pre-flight Euler angle checks, Phoebe knows immediately she’d not on a flat surface, so the problem is all due to how fast she can compensate and get herself level using the mix of the DLPF and complementary filters along with the absolute angle PID. Now I know I’ve mentioned these loads of times; the difference here is that I now have a greater understanding of how they are interacting. And with that in mind, I could watch a take-off carefully, looking at the take-off angle, watch how long into the flight it took for Phoebe to correct that angle, and therefore how much drift speed she gained until she levelled out.
And as a result, I have a much better set of default configuration figures for DLPF, complementary filters and absolute angle PID gains – not perfect perhaps, but possibly good enough that if there is wind on another day, I can rely on these default to then start looking at the horizontal drift kill testing using the horizontal velocity PID. And that is a big step forwards because once that’s sorted, it’s on to phase 2 and a remote control
I took Phoebe for a play in the village park just now – it was a huge amount of fun for us both! When the local kids are at school, it’s empty, and there’s a football pitch sized area of just grass. It’s also just a few meters higher than our garden (we’re at the lowest point in the village), so while our lawn is currently somewhere between a quagmire and a lake, the park just had soft grass to land on, which, it turned out, is a very good thing!
The only downside is our garden has 6 – 10′ stone walls around it shielding it from the worst of any wind; the park is next to an open field, and today a 20mph wind was blowing. So I sat, back to the wind and let her rip. Off she flew at probably 20mph and reached the other side of the pitch in no time at all. Her wind-drift protection wasn’t engaged so that’s actually what I’d expected (which is why I sat where I did), but I was surprised at how effective the wind was!
She did takeoff at a tilt and self corrected as the complementary filter started kicking in. With dlpf set to 5Hz, I think I should be able to pull in the accelerometer much quicker. I got it down to 10ms but I suspect I could go lower still.
And best of all, it was fun – there was nobody and nothing other than me that Phoebe could harm, meaning I could just watch the details of the flight and the change of behaviour as I tweak the config – very satisfying!
I’ll definitely be back there next time it’s not raining – Monday’s forecast is looking promising, and the wind is only expected to be just 14mph!
P.S. After reviewing the stats from the final flight, something useful has come from the 20mph flights too: I’d been tuning the DLPF / complementary filter the wrong way round. Under the belief that a low DLFP cuts out noise, I’d been reducing the fraction of time that accelerometer Euler angles became dominant. But as a result, the stats showed I was tuning out the integrated gyro data. This meant long term stability was fine, but Phoebe lacked the ability to react to the initial tilt she took off with. So Tuesday’s priority is to see the net effect of the changes I’ve made – to allow more accelerometer data through (DLPF @ 10Hz rather than 5Hz), but then take longer to allow it through the complementary filter (0.2s rather than 0.01s). Looking forward to seeing the result.
Today, I’ve been able to do more testing in one day than I’d managed throughout the whole of January – perhaps as many as 30 flights of 10s! How did this come about? Partly due to perfect weather, but mostly due to a lack of any radically unpredictable behaviour and hence no unexpected crashes.
And actually, the lack of any manic unpredictable behaviour has made the multiple testing necessary – I’ve run out of blatantly obvious problems, leaving me with only subtle ones – mostly based upon depedencies between the dlpf, tau, accelerometer noise and the PIDs that use them. Because of the many interactions, only a series of flights can actually show the flight style variations caused by a minor configuration change.
Which means I’m going to have to be more structured in my testing, and the fact the flights are getting better means I can. Each test needs to be run several times sequentially to check consistency. Once any common factor between all flights are identified, then a tweak to flight parameters can be made and the tests rerun.
So the plans for Thursday’s testing are:
- see if I can turn off the inner stability PID Ki gain – I suspect it’s making the response to the absolute angle PID sluggish and that in turn is leading to drift. I dropped this by 50% with no problem so I’m pretty sure I’ll be safe to take it down slowly to zero carefully
- If that works, then it’s back to fiddling with dlpf and complementary filters to minimise noise while ensuring meaningful changes don’t get filtered out
P.S. Despite no unexpected crashes, there were breakages which ended my testing. My new blades are fantastically strong, but one took on the kids swing (because I didn’t stop it), and as with the last time that happened, the swing won. Oh, and I lost another leg – the flexibility designed into these legs just doesn’t work as well in the cold. The plastic they are made from becomes a lot more rigid and so snaps on impact – although that’s pretty rare at the moment – normally they sink a couple of inches deep into the quagmire that’s the lawn!