It’s been niggling me how to make a quadcopter turn. I knew how to make it got forwards, backwards, left and right by tilting down in the required direction, but all the time, there was nothing which would make it rotate.
Until that is my last cup of coffee and cigarette (don’t nag, I know!). On the quad, diagonally opposite blades spin in the same direction. If one of these pairs spins slower than the other pair, it’s still possible to maintain a stable hover, but the faster rotation of two of the motors (say) clockwise will cause a slight anti-clockwise rotation of the drone itself.
Which then leads me to realize the point of the z-axis gyroscope – a stable, non-spinning hover is going to need the z-axis input to detect and compensate for any spin – a slight clockwise spin is going to need the ant-clockwise blades to spin faster and vice versa.
For the moment I still need to run some live hover tests, but when they work, I can add the z gyro into the PID to control spinning.
That then means the drone always flies mostly flat, and the accelerometer inputs (and their independent PIDs) are used solely to control speed of movement in any dimension.
Bloomin’ obvious once you’ve worked it out, or someone tells you, but a flash of inspiration when it all falls into place in your mind while you’re not really thinking about it.
Gotta love the way a brain works – even if it’s aged and been invaded!