In relation with our previous post we made some further investigations on the physic underlying the accelerometer measurements.

Theoretically, it’s really easy to extract a tilt angle from an accelerometer. We just have to take the **arcsin** of the right axis measurement, depending on the frame used, divide by **g** and we get the tilt angle.

for us : **theta = arcsin(Ax/g)** where :

**theta** = tilt angle, **Ax** = measurement on the x axis,** g** = gravitationnal constant

This solution works well while the accelerometer doesn’t translate.

If the accelerometer is translating with a non zero acceleration component, extracting a correct angle measurement becomes really tricky. As we don’t only measure the gravitationnal acceleration, but also the translating acceleration, we can’t apply directly the previous equation.

however, even without encoders, it’s mathematically possible to extract the tilt angle. As we have a 3-axis accelerometer, we can extract from the measurements of 2 well chosen axis of the accelerometers a set of 2 equations with 2 unknown variables that are the tilt angle **theta** and the translating acceleration **x** and thus it’s possible to resolve this set of equation.

In the frame of the accelerometer we have :

**g*sin(theta) + x*cos(theta) = Ax (1)
**

**-g*cos(theta) + x*sin(theta) = Az (2)**

where,** g** is the gravitational constant, **theta** is the tilt angle,** Ai **is the acceleration measurement of the accelerometer along the** i** axis. We gave this set of 2 equations to matlab using the solve function.

And it returned 2 solutions:

**theta = -2*atan((Ax – (Ax^2 + Az^2 – g^2)^(1/2))/(Az – g))**

** theta = -2*atan((Ax + (Ax^2 + Az^2 – g^2)^(1/2))/(Az – g))**

We tried each of theses solutions, but none of them worked. We investigate some more about it and the main problem is that, experimentally, the measurement aren’t perfect and are skewed by noise. Thus, even if there is no tilt angle, **Az **isn’t perfectly equal to **g. **Furthermore, even if theoretically **Ax² + Az²** is supposed to be equal to **g²**, experimentally it’s not the case, and that leads to calculate the square root of a negative number, that isn’t a great thing in the real world.

So, our conclusion is that even if this set of 2 solutions is mathematically right, it’s not relevant in the real world and we decided not to use it.

In addition, we lied, equation** (1)** and **(2)** aren’t perfectly right, we also have to add the acceleration terms from the rotational movement of the chassis around the wheels axis. That leads to :

**g*sin(theta) + l*theta_dot_dot + x*cos(theta) = Ax (1)
**

**-g*cos(theta) – l*(theta_dot)² + x*sin(theta) = Az (2)**

That’s why we finally decided to put the sensorboard as close as possible from the wheels axis so that** l **is small as possible. That hopefully able us to neglect this two terms.

Anyway, we think that a proper set of coefficients for the measurement noise and the process noise in the Kalman filter will be sufficient to correct those problems.

To be continued.

## Commentaires récents