I am using a 3-axis accelerometer and a 3-axis gyroscope to estimate the tilte angle between the X axis of the IMU sensor and the ground (horizontal plane). My robot is stationary at power up, so I can determine the initial tilt angle just by using the data acquired from the accelerometer. However, when he starts moving I can not do that anymore. That is why I need a sensor fusion algorithm.

Can I use the Madgwick filter which does not include a magnetometer? Note that my robot can rotate around any of the three Cartesian coordinate system axis while he operates in free space. I still need time to understand the filter myself, so I do not know the answer yet.

Thank you for your time.


1 Answer 1


Unless your robot is experiencing sustained accelerations on the order of 1g, ignoring linear accelerations to compute the tilt angle should work well. Besides, typically the weight on the accelerometer measurement is much lower than that on the gyroscope measurement in a standard complementary filter so any linear accelerations should only add a small bias. How is your robot moving at startup? What sort of accelerations are you seeing?

If on startup, the robot is at an arbitrary orientation AND experiencing excessive linear accelerations (not velocities), then it may be tricky as the initial orientation computed may be quite wrong. In that case, if there is any way to know the linear motion in advance, e.g. if the motion is a result of control inputs, then that known acceleration can be subtracted before the accelerometer readings are used in the filter.

A particularly tricky case may be when the robot starts in free fall. If it doesn't hit terminal velocity to experience a drag force, and without any other forces acting on it, I don't see a way to measure the tilt relative to the ground with an accelerometer and gyroscope. The accelerometer will measure all zeros and give no tilt information. However, the drag force in most situations may be enough to give some bearing, but you are not guaranteed that the force is parallel to the force of gravity.

If one wishes to estimate the tilt of a robot in a parabolic free fall with air resistance. Then I can imagine some algorithm that attempts to estimate the tilt using the direction of the drag force and some estimated progress along a parabolic arc. It sounds complicated though.

I'm not familiar with the Madgwick filter specifically, but to me it sounds like some variant of a complementary filter.

  • $\begingroup$ Hello Alex, At startup my robot is not moving. He is completely stationary, so I am able to calculate the tilt angle just by reading the X and Y acceleration values from the accelerometer. That lets me generate an inital vector that I can use in the Madgwick filter algorytm. As far as I understand the algorythm of the filter, I should be able to do what I inteded. However I do not completely undestand everything about the algorythm, so I cannot say for sure yet. The Madgwick filter differs from Kalman and complementary filter. After startup my robot can do linear and rotational motion. $\endgroup$ Sep 13, 2021 at 9:20

Your Answer

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

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