Yet more musings about how to calibrate the accelerometer outputs without having to account for temperature shift by doing so each flight.
There are 3 lots of accelerometer readings:
- rx, ry, and rz are the raw accelerometer readings along Phoebe’s axes – these each have gain and offset errors meaning they live in an non-centered ellipsoid space
- qx, qy, and qz are the calibrated readings along Phoebe’s axes – i.e. with offset / gain calibration placing the readings in a centered spherical space
- ex, ey, ez are the calibrated readings in the earth’s axes in the same spherical space but with earth’s axes.
With Phoebe sat still on a slightly sloping take-off platform (let’s call it “the ground”), there are a few assertions that can be made with the above due to the fact the only force in play is vertical gravity:
qx = (rx + rxoff) * rxgain qy = (ry + ryoff) * rygain qz = (rz + rzoff) * rzgain qx2 + qy2 + qz2 = 1 ex = 0 ey = 0 ez = 1
The relationship between q* and e* is defined by the matrix converting between quad and earth axes based upon the angles of pitch and roll.
|ex| |cos(pitch), 0, -sin(pitch)||qx| |ey| = | 0, cos(roll), -sin(roll)||qy| |ez| |sin(pitch), sin(roll), cos(pitch).cos(roll)||qz|
where pitch and roll angles are defined by the accelerometers output also
pitch = atan(qx / qz) roll = atan(qy / qz)
What I’m wondering is whether there’s enough information here to calculate the r* to q* mappings, perhaps by using some approximations such as the following
- if the ‘ground’ is only a slight slope, then
pitch ≅ qx / qz roll ≅ qy / qz
- as the r* gains are all roughly one, can the r* space be assumed to be spherical and only the offsets need to be derived? That gives 3 variables and more than 3 equations to derive them from.
I’m pretty certain this is possible as Gustavo pointed me at a calibration algorithm in a comment the other day; the trouble is the details are lost inside some numpy processing, and I’d rather understand those details rather than just use the magic incantations. Help / guidance much appreciated please.
P.S. Having spent a few minutes looking at the numpy algorithm, it seems to be doing dynamically in Python what I did via my excel spreadsheet – essentially calculating a set of gain / offsets from a set of predefined data – essentially moving the raw data from the off-centre ellipsoidal space to a centred spherical space but applying gain / offsets, which is great from the point of view of reassuring me my approach is correct, but not helpful in getting mine any more accurate.