I have a 9-DOF MEMS-IMU and trying to estimate the orientation (roll, pitch and yaw) in scenarios (e.g. car crash) where sudden shocks (mainly linear) lead to high external accelerations and the orientation estimate might diverge due to the large out-of range acceleration peaks. There a lot of approaches in the literature to overcome such disturbances. Adaptive filters are used that change their gain and give more trust to the gyroscope in case of external acceleration (eg. Kalman Filter - adopts the covariance matrix, Complementary Filter adopts the gain, etc.).

From R. Valenti there exists a quaternion-based adaptive complementary filter which works quite well by adapting the gain in presence of external linear accelerations. There is also an official Matlab implementation.


Imagine the IMU is mounted in the head of a crash-test dummy. During the short-term impact it is assumed that acceloremeter is saturated. Now the algorithm gives more trust to the gyroscope.

But what happens if the gyroscope gets a rotational "knock" during the impact that just consists of a few degrees but also leads to saturation of the gyroscope during the shock? The orientation estimation will get erroneous.


Are there any theoretical or practical approaches which somehow deal with this kind of problem? Maybe if I know the pattern of the shock I can estimate the saturated/clipped/censored gyroscope data?


1 Answer 1


At the highest level an estimator like a Kalman filter is estimating an unknown system state based on a model and measurements.

Your sensor has shortcomings such as linear and angular clipping when the shock is too high which is limiting your ability to observe the system and consequently the basic model which assumes that the measurements are proportional are no longer accurate.

If you are unable to improve your measurements (Which you appear to be requiring in this question.) you will need to improve your model. The adaptive filters that you reference are a step in that direction. However in your case you will want to improve your model to be able to handle the saturation of the measurement. Since the acceleration and potentially rates from the gyros are now no longer always known they too will become part of the estimated state. Where the measured values have high confidence when they're being measured directly, but when saturated they will need to be discounted.

And you will then need to extend your model of the system to estimate the evolution of the newly added state model updates which will let your filter update the estimated values of the acceleration and velocities when the sensor is saturated and not reporting accurately.

To build up this model and how it updates, you can either derive/estimate it analytically based on your understanding of the geometric and dynamic constraints on the system. Or you could setup some controlled experiments to empirically develop a model. For your experiments you'll likely want to bring in an external sensor such as a motion capture system to validate and train your model generation. With the model extended to estimate the acceleration and rates while the sensor is saturated you can get an improved result.

Note that your results will vary greatly based on how well you can improve the model update. If you know the situation and can get good ground truth data in all the expected configurations you can possibly get very good data. However if there are a lot more parts of the system which are variable and there's a lot of time when the sensors are saturated this approach will not work as well.

You also are going directly to an online estimator which is required for a live system, however if you're doing crash test reconstruction you could consider using much more complicated model fitting estimation which will batch process afterwards and estimate the values across the period of saturation by taking into account the state of the system before and afterwards. Versus an online filter which only can take into account data collected in the past.

As a side note: This sounds like a moderately complicated issue to resolve as asked and I worry that this is a bit of an X-Y problem where you're presuming an approach to the solution that's sub optimal versus asking for help on the underlying issue. There may be alternative approaches to solving your problem that are easier.

  • $\begingroup$ Thanks for your reply! Maybe for clarification (X-Y-problem): I want to get the orientation and have accelerometer (max:+-8g), gyroscope(max:+-400°/s) and magnetometer. I need an online approach. Crash was just an example. The system is not under vibration, it just gets sometimes a large linear acceleration peak/transient (I know the direction) and I want to avoid disorientation. But how can I improve my model if both accelerometer and gyroscope is for short time in saturation? How can I formulate some dynamic constraints? The IMU doesn´t move much in this time. It just gets a hit. $\endgroup$
    – Acerox41
    Feb 12, 2022 at 20:33
  • $\begingroup$ You seen to know a lot of information about the disturbance direction and lack of rotation. As such your should be able to extend your filter update model to do different updates when you know the event is happening. I can't give much more details without an example model. Likely what you will want to do is have an extra sensor input that triggers the alternative update logic. That extra input will encode that an event is happening and the known direction, and your code will know that it should ignore the accelerometers and gyros until the event is over. $\endgroup$
    – Tully
    Feb 13, 2022 at 23:11
  • $\begingroup$ I've implemented this quaternion-based EKF. Assuming I can detect the time of the event and the direction, how should I adapt the process/measurement noise covariance if the event is happened? If I just ignore the accelerometers and gyros until the event is over I somehow have to interpolate right? $\endgroup$
    – Acerox41
    Feb 14, 2022 at 12:56
  • $\begingroup$ You need to both ignore the measurements known to be bad during the update step (the simplest way is to make the covariance very high) and you need to change your prediction step to better predict the next state different during the events. That's the integration part your refer to. You know the model of the system will evolve differently under the external disturbance so that needs to be part of your model. en.wikipedia.org/wiki/Kalman_filter $\endgroup$
    – Tully
    Feb 14, 2022 at 20:05
  • 1
    $\begingroup$ I guess that's my problem because I cannot use the gyroscope data to propagate the attitude state described by quaternions and I am not sure how to do it otherwise. I find it difficult to implement that model. $\endgroup$
    – Acerox41
    Feb 16, 2022 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.