Do we need to know the angle of take-off?
This springs from another night’s sleep and a general concern about angles:
- I have a strong suspicion that now angles alone are what are causing drift
- There will be a slight mismatch between angles from the accelerometer and gyros unless both are perfectly calibrated – the initial take-off platform angles is determined by the accelerometers alone, and then angles throughout the flight come from both gyro and accelerometer ‘fused’ by the complimentary filter.
- Another one of those long term niggles that I’m sure the flight controllers for off-the-shelf quadcopters don’t need to be aligned accurately with the quad frame itself.
So lets run through the thought experiment:
- Phoebe is sat on a a very tilted take-off platform – lets call this the base-frame – her nose is pointing downwards compared to horizontal – a positive pitch angle compare to horizontal in the earth-frame. But critically, we do not measure any angles of gravity here – angles are relative to the base-frame so pitch, roll and yaw are all zero
- Her flight plan in her quadcopter reference frame (which the sensors live in) is zero velocities Vqx and Vqy on the X and Y axes, and a fixed velocity Vqz in the Z axis direction.
- She takes off
- Because of the pitch of the base-frame compared to horizontal, gravity starts acting on her X axis such that Vqx starts to increase.
- The result of the PID processing is that the she rotates negatively around her Y axis until Vqx is 0, and as a result, she ends up horizontal without any knowledge of what ‘horizontal’ is – this is all simply about zero movement detected by her X axis accelerometer.
- There still needs to be a record of gravity in the base-frame, so that it can be tracked / updated in the quad-frame to get velocities.
There’s bound to be details I’ve missed, but essentially I believe this could fly (ahem). But why bother?
- angular control is now completely (and therefore consistently) with the gyros
- velocity control is now completely in the quad-frame
- the above removes most of the time consuming rotation matrices, reducing them to just one – rotation of distributed gravity from the previous orientation to the next orientation of the quad-frame based upon the change in gyro angles.
It’s actually a relatively small rework of the code. I have two known unknowns:
- what does this do with the Butterworth filter extracting gravity from acceleration in the earth frame – if this is still needed then the 3rd advantage listed above ceases to exist – can it be throw away now we don’t use the accelerometer for angles, and instead just use a start of flight fixed reading for distributed gravity
- similarly, how to handle flight plans in the earth-frame? This doesn’t matter for take-off and hover, but it does for lateral movement to maintain a fixed vertical height and a fixed horizontal speed.
Not sure yet – more sleep needed to work this out more.