# How to calculate Altitude from IMU?

How to calculate attitude from IMU ?

For example, mathematical equations

• I assume you meant to ask how to calculate attitude, not altitude.
– Ian
Sep 1, 2014 at 2:21

Altitude is usually determined from pressure and temperature sensors of an IMU. You can see a formula here.

However, you must realize that raw data from a sensor is NEVER RELIABLE. Sensors do not always give a correct reading. Instead, they give you a value somewhat close to the true value, but with some random "noise" added to it. So, instead of just using the data that you obtain from the sensor, you should always filter out the noise using some form of kalman filter.

• Can i have your Email for personal contact @paul Sep 1, 2014 at 22:48
• @xsari3x: I am, by no means, an expert at these kinds of things. It's better to keep on posting your questions here on the robotics SE site. If i can't answer your question, it is likely that someone else can.
– Paul
Sep 2, 2014 at 2:05
• Are there IMUs available that include pressure and temperature sensors?
– Ian
Sep 2, 2014 at 13:34
• @Ian: Some do, but not normally. I would say that it's more common that the altimeter sensors are separate from the IMU.
– Paul
Sep 2, 2014 at 14:09

An aircraft's attitude can be calculated from an IMU, but a full-fledged Attitude and Heading Reference System (AHRS) needs a bit more data -- magnetometers and GPS sensors can help. Your question is a little vague as to what you're hoping to accomplish.

Here is an article describing some of the code you need in order to do this with quaternions, but in general there's not much I can suggest besides searching for "IMU attitude estimation".

• Based on the OP's recent questions, it's highly likely that he meant to say 'attitude' (with a T), but as it is written, he's asking for 'altitude' (with an L).
– Paul
Sep 1, 2014 at 21:00
• I meant altitude , but thanks your answer still a great reference Sep 1, 2014 at 22:49
• Hmm... then the short answer is "you don't calculate altitude from an IMU". You just measure it directly with a pressure sensor or altimeter.
– Ian
Sep 2, 2014 at 13:35