I'm confused about a few points on how to best calibrate an accelerometer, whose data will be used in an orientation sensor fusion algorithm.
As a summary, the most common approaches I've seen take measurements in 6 different orientations (1G in +x, -x, +y, -y, +z, -z), to then arrive at a max, min measured value. Offsets are then calculated as averages:
(max - min)/2. And then a scaling factor is calculated. There's a few aspects of this that I'm unclear about, and was hoping it's okay to ask in a single question, since they are related.
1) the examples calculate the average as written above, rather than
sum all vals / N vals. Isn't that approach more error-prone?
2) should the offset per axis be calculated once for each orientation, and then summed?
3) what's the best approach to calculate scale bias?
Example 1 (pseudo-code):
chordlengthX = (max - min)/2 chordlengthY = (max - min)/2 chordlengthZ = (max - min)/2 avg_rad = (chordlengthX + chordlengthY + chordlengthZ)/3 scaleX = avg_rad/chordlengthX calibratedX = (x - offset)*scaleX
rawrange = max - min refrange = refmax - refmin // 1G?? calibratedX = (((x - min)*refrange)/rawrange) +refmin
Something else altogether (as you can probably tell I need to revise my maths)?
4) if my surface is not completely level, I cannot trust my measurements since my 1G reference is not accurate?