# Modelling Acceleration Dynamics

The accuracy of an orientation sensing system can generally be improved if the acceleration dynamics of the system can be estimated. Accelerometers are commonly used in orientation sensing systems because they can sense gravity (the *down* vector). They also measure acceleration due to changes in motion – of course. Modelling acceleration dynamics means using additional sensors (such as a GPS) to calculate acceleration, then subtract that from the accelerometers to find a cleaner *down* vector.

### Linear Acceleration

Let’s say we’ve got a drag racer. All it does is accelerate and decelerate in a straight line down a drag strip. It takes off at 5m/s/s.

1 2 3 4 5 6 |
Vector<3> a(5, 0, 9.8); //5m/s/s on the x axis, 9.8m/s/s vertical is due to gravity Vector<3> euler; euler.y() = atan2(-a.x(), sqrt(a.y()*a.y() + a.z()*a.z())); euler.toDegrees(); cout << "Pitch is: " << euler.y() << endl; |

Output: Pitch is -27.0309

Simply accelerating at 5m/s/s will make the orientation sensing system begin to tilt down by almost 30 degrees! Ideally, this acceleration won’t last very long and this effect would be masked to an extent by turning down the filter gain. But still, it’s easy to fix this.

1 2 3 4 5 6 7 8 9 10 11 12 13 |
float dt = 0.1; Vector<3> v1(10, 0, 0); Vector<3> v2(10.5, 0, 0); auto linear_accel = (v2-v1)/dt; Vector<3> a(5, 0, 9.8); //a is the accelerometer measurement a = a - linear_accel; //subtract linear acceleration from accelerometer measurement float pitch = atan2(-a.x(), sqrt(a.y()*a.y() + a.z()*a.z())); cout << "Pitch is: " << radians_to_degrees(pitch) << endl; |

Output – “Pitch is: 0”

### Centrifugal Force Compensation

Centrifugal force compensation is particularly good for fixed wing aircraft that often need to fly in a circular pattern for prolonged periods of time. Without centrifugal force compensation, an aircraft orientation sensing system could have 10 degrees or more of error.

Centrifugal force is often referred to as a fictitious force, because it doesn’t exist in the inertial frame of reference. Infact, by tracking the velocity of an aircraft using the world as the inertial frame, it’s quite easy to calculate total acceleration by differentiating velocity vectors.

1 |
world_acceleration = (world_velocity - last_world_velocity)/dt; |

The GPS is a sensor that measures velocity in the world frame of reference and that could be used to calculate total acceleration. The problem is, the accelerometers are in the aircraft ( body ) frame of reference. To subtract world-referenced total acceleration from body-referenced accelerometers, the total acceleration must be rotated using the orientation estimate. But to get an accurate orientation estimate, body-referenced total acceleration needs to calculated. It’s a circular dependency and it won’t work. Therefore total acceleration needs to be calculated in the body frame.

If the aircraft is well above stall speed, it’s probably fairly reasonable to assume that the magnitude of velocity is along the longitudinal axis of the aircraft. Ground speed from a GPS combined with vertical speed from a barometric altimeter can be used to find the magnitude of velocity.

1 2 3 |
Vector<3> body_velocity(ground_speed, vertical_speed, 0); body_velocity.x() = body_velocity.magnitude(); body_velocity.y() = 0; |

The cross product of angular velocity and body_velocity is centrifugal force.

1 |
auto cf = av.cross(body_velocity); |

Centrifugal force can be subtracted from the acceleration vector.

1 |
body_acceleration = body_acceleration - cf; |

Subtracting centrifugal force and linear acceleration from accelerometer readings is essential for accurately measuring the orientation of fixed wing aircraft.

Pingback: IMU Maths – How To Calculate Orientation pt3 - CamelSoftware