Today’s aim was to work out how to sort out correct vertical take-off speed / height, combined with reduced drift with a sloped take-off surface.
She’s taking off vertically now, but her vertical scale is out, she rose to 2m+ before attaining hover. Then I had to kill the flight as she drifted slowly towards the kids’ paddling pool!
The stats show she thinks risen to 1m, suggesting that I’m integrating accelerometer readings incorrectly or rotating the earth axis targets to quad frame wrongly. Very hard to judge which of these or another issue is the cause.
I’d dearly like to understand this before the CamJam, but time is very much running out.
Started up this morning upgrading to use the new Epiphany web browser on my workhorse pi. This is the only RPi I have that’s not headless, so it’s the one I use for transferring files between Phoebe and my PC. And the update failed catastrophically. So I’m downloading the latest image and will try again. No real impact on Phoebe other than wasted time.
Up for testing today were
- refined dynamic accelerometer calibration
- tinkering with dlpf to see if 5Hz is workable
- try take-offs from near horizontal as compromised indoor demo @CamJam
Together these yielded the best behaviour yet. From a sloping takeoff platform, Phoebe shot off in the direction of the slope for a few meters, before stopping and hovering. From a horizontal platform, nigh on zero drift, but lack of accuracy in height. Just about safe enough for an indoor demo.
Phoebe’s initial drift from a non-horizontal take-off is an irritation, but I think the fix / enhancement is too large for me to try prior to the Jam. What’s required is both angular and motion correction PIDs running in parallel: the angular PID would level her up on take-off, and the motion PID would then stop any drift.
There are other cases where both PIDs are needed such as flying in a circle: she needs a fixed angle on one axis to produce centripetal force, but she needs a fixed velocity on the other axis to make her move around the circle at that level of inward tilt.
Because flying in circles uses only one of the two PIDs per axis, this could be simple to implement but the case of vertical takeoff from a slope needs a mix of both and I suspect they will conflict; vertical take off requires a 0° angle while 0m drift requires a dynamic angle.
For the CamJam though, I’ll stick with a horizontal take-off platform for safety.
A few minor changes for
- enhanced accuracy of averaged / integrated acceleration
- PID tuning leading to better flight behaviour, but with excessive climbing
- applying scale / units for sensor outputs only when needed rather than at each reading (thanks Dave).
Nothing really to report, but still on track.
A day spent inconclusively tuning horizontal PIDs’ gains, with some integration tweaks to get better accuracy of velocities from the accelerometer, as yet untested, due to a bad beer last night (just 1 pint, guv) which left me after lunch today, staring down a toilet bowl, with undigested lunch staring back up at me.
The PID tuning goes loosely along these lines:
- the P gain is there to maintain a fixed target velocity
- the I gain is there to return Phoebe back to any point she drifts away from
- the D gain is there to apply additional acceleration / braking to stop drift.
It’s visible working, but it is very sensitive – change one gain, and the effect on the others’ change radically – to some extent you can use some structure, but ultimately it’s also a lot of guess work and gut-feel which doesn’t sit well, the way my gut is currently feeling.
- one bug fix to integrated the gyros rather than just using the last sample
- one deletion of redundant conversion from horizontal velocity to required angle whose PID is ancient history
- retune the horizontal PIDs’ gains
- test flight leading to a number of literally flipping crashes as my guestimate PID gains were way too high
- fix resultant Phoebe who wouldn’t boot after crashes – SD card socket damaged irreparably – new model A (reserved for the now unnecessary radio control)
- retune again with much reduced PID gains resulting in…
- final test flight of the day: she takes off at the angle she was tilted on the ground resulting in rapid backward movements which then slows, stops, and she then returns to the point she took off from.
Net: probably the best motion tracking flight yet, but the day would have been much more satisfying had I not had been forced to rebuild her mid-way through. Still on track for CamJam in 1 week.
I’ve committed Phoebe to go to the CamJam on September 6th. To be honest, it suits her, she definitely needs committing.
At the moment, she’s in pretty good form – suitable for outdoor demos – and I hope to beat her into shape for an indoor demo. No promises on that though – time is running out, and tuning is becoming a lot more of a zen experience – diagnostics disturb the flight behaviour significantly (hey Schrödinger, how’s the cat?).
So now, understanding of flight behaviour comes only from the Force – Phoebe and I have been together for over 20 months as she’s grown up. Fingers crossed I can get her to stable adulthood from cranky teenager in the next few weeks.
Wish us luck!
P.S. You may have noticed that mixed metaphors amuse me, as does alliteration’s artful aid!
P.P.S. Some advice – never blog with a beer fridge in the same room!
I’m reaching the stage where I think Phoebe is just about all she can be. I need to get a video to prove it, but her recent flights have been (mostly) safe and consistent.
And I’m already planning what short term upgrades I’ll do next.
- reinstating her legs – the dome ball on the underside has saved me a fortune in broken legs and propellers due to aborted flights, but now her behaviour has improved significantly she can have her legs back – I actually like the soft sponge dome but it stops me from…
- putting her WiFi antenna back between her legs to get better reception – currently she’s on a nano dongle and I only get about 5m coverage
- customizing the RPi.GPIO.wait_for_event() code for performance reasons. This will allow me to wait on the MPU6050 data ready interrupt and hopefully improve the code response to availability of fresh sensor data even if only marginally
- moving to a model A+ when available due to it’s more efficient power usage, and layout which allows…
- fitting a custom PCB akin to a breadboard attached directly to the GPIO pins and the standoff holes. This will reduce weight and lower the MPU6050 nearer Phoebe’s center of gravity which in turn means that rotation doesn’t trigger the accelerometer, and hence greater accuracy.
None of these are radical changes and they are already in progress. I’m hoping I can complete then before early September so I can show her off at the next CamJam.
Scary Mug Shot
I went to the Raspberry Pi Jam in Cambridge yesterday, and really enjoyed it. Lots of interesting presentations, lots of kit for sale, interesting projects to chat with people about and a nice relaxed atmosphere. If you have a Jam near you and haven’t been to one yet, go along and have a look. I really enjoyed it!
If you were there, and didn’t spot me, here’s a scary mug shot for next time!
Yay! Got a ticket for the afternoon part of the 8th February CamJam. Really looking forward to it, just to mooch around and be nosey. Not sure yet whether I’ll scrounge a bed from my old college, or just head home. The decision hinges on beer – are there pub + beer meetings afterwards? Please let me know via comments so I can make up my mind!