# Sensor corrections

1)The accelerometer and gyroscopic sensors will (probably) be arranged in three orthogonal direction (XYZ) Actual manufacturing will undoubtedly have some misalignment and will need correction. During manufacturing and test, the misalignment shall be measures and a correction matrix will be generated.

The misalignment correction to the measured numbes (Vector Vm) will just be

```Vgood =  C * Vm
```

for example

```Wgood = Cgyro * Wm
Agood = Cacc * Am
```

where C is a 3x3 matrixes , A is a vector of acceleration, and W is vector of rotations.

2) Other corrections TBD.

3) Additional data shaping. The numbers reported by the accelerometers and gyros are probably not in convenient units. each measurement needs to be multiplied by a scalar, and possibly offset by another scalar.

While we are at the shaping, Accelerations and Angular rates are nice numbers to have, but what is really needed is the angular displacement and velocity change during the measurment interval. another scalar multiplication.

And of course just because you measure the angular rate at x deg/sec per bit change, doesn't mean that this is what you want to do your trig functions in nor store in variables. another scalar.

These assorted corrections can all be rolled up at system initialisation and represented by:

```Wgood = Cgyro * (Sw*Wm - Vw)
Agood = Cacc * (Sc*Am - Va)
```

Where Vw is a vector for offset correction and Sc is the rolled up scalar corrections

It may make sense to rearrange this equation to simplify the math when considering the accuracy of the assorted variables (16 bits or more).