# Clarify NED frame or body frame for accel and gyro sensor data inputs

**URL:** <https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459>\
**Category:** Uncategorized\
**Created:** [November 13, 2018, 2:17am UTC](https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459 "2018-11-13T02:17:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcpx4](https://discuss.px4.io/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@rcpx4](https://discuss.px4.io/u/rcpx4)\
**Post date:** [November 13, 2018, 2:17am UTC](https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459/1 "2018-11-13T02:17:02Z")

</div>

Looking at sensor\_accel.msg and sensor\_gyro.msg:

sensor\_accel.msg:

```auto
float32 x # acceleration in the NED X board axis in m/s^2
float32 y # acceleration in the NED Y board axis in m/s^2
float32 z # acceleration in the NED Z board axis in m/s^2

```

sensor\_gyro.msg:

```auto
float32 x # angular velocity in the NED X board axis in rad/s
float32 y # angular velocity in the NED Y board axis in rad/s
float32 z # angular velocity in the NED Z board axis in rad/s

```

It’s ambiguous to me whether this means that the sensor data needs to be  
provided from the driver in NED frame coordinates or body frame coordinates.  
I’m attempting to integrate a new IMU with PX4.

Can you please clarify?

Thanks much!

---

<div class="post-metadata">

**Author:** ![DanielePettenuzzo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@DanielePettenuzzo](https://discuss.px4.io/u/DanielePettenuzzo)\
**Post date:** [November 13, 2018, 8:20pm UTC](https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459/2 "2018-11-13T20:20:38Z")

</div>

In PX4 the body frame is a NED frame with the origin on the center of mass of the vehicle.

---

<div class="post-metadata">

**Author:** ![rcpx4](https://discuss.px4.io/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@rcpx4](https://discuss.px4.io/u/rcpx4)\
**Post date:** [November 14, 2018, 9:46pm UTC](https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459/3 "2018-11-14T21:46:05Z")

</div>

Thanks for the response.  
However, I’m still confused about this.

Normally, IMU sensor data is in body frame coordinates as the IMU has no knowledge of compass direction.  
If the acceleration and angular velocity data have to be provided with respect to the NED frame with origin at center of mass of the vehicle, then that data has to be fused with magnetometer data somehow in advance.

Just want to confirm, is this really the requirement? Is this how, say the Pixhawk, works?  
Thanks.

---

<div class="post-metadata">

**Author:** ![DanielePettenuzzo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@DanielePettenuzzo](https://discuss.px4.io/u/DanielePettenuzzo)\
**Post date:** [November 15, 2018, 8:31pm UTC](https://discuss.px4.io/t/clarify-ned-frame-or-body-frame-for-accel-and-gyro-sensor-data-inputs/8459/4 "2018-11-15T20:31:53Z")

</div>

[https://dev.px4.io/en/ros/external\_position\_estimation.html#asserting-on-reference-frames](https://dev.px4.io/en/ros/external_position_estimation.html#asserting-on-reference-frames)  
In the `Asserting on Reference Frames` section you can see a nice diagram. Basically the PX4 body frame has the x axis pointing towards the front and the z axis pointing down. This is the frame that you have to use when publishing your sensor\_gyro and sensor\_accel messages from your IMU driver.
