# ENU and NED frames in mavros

**URL:** <https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377>\
**Category:** ROS 1 / ROS 2\
**Created:** [July 20, 2022, 9:09am UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377 "2022-07-20T09:09:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin-ecn](https://discuss.px4.io/user_avatar/discuss.px4.io/robin-ecn/32/3444_2.png) [@robin-ecn](https://discuss.px4.io/u/robin-ecn)\
**Post date:** [July 20, 2022, 9:09am UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377/1 "2022-07-20T09:09:01Z")

</div>

Hi, guys.

PX4 drone take its frame to be NED, while we prefer ENU frame in robotics.

But I am still confused in push mocap infor to vision\_pose and send position setpoints to mavros/setpoint\_raw/local and mavros/setpoint\_position/local.

If I do

1. pub mocap infor in ENU to `/mavros/vision_pose/pose` ,
2. pusb reference position in **NED, takeoff 1m means (0,0,-1)**, to `mavros/setpoint_raw/local`,

then, what I get is “INFO [commander] Disarmed by auto preflight disarming” in simulation. (edited)

Interestingly, if I do

1. pub mocap infor in ENU to `/mavros/vision_pose/pose` ,
2. pusb reference position in **ENU, takeoff 1m means (0,0,1)**, to `mavros/setpoint_raw/local` or `mavros/setpoint_position/local.`.

It does take off and hover in simulation.

Does mavros automatically accepts/publish infro in ENU, and transfer them into NED to NED? Does it mean, we do not need to brother?

---

<div class="post-metadata">

**Author:** ![Benja](https://discuss.px4.io/user_avatar/discuss.px4.io/benja/32/11872_2.png) [@Benja](https://discuss.px4.io/u/Benja)\
**Post date:** [July 20, 2022, 9:49am UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377/2 "2022-07-20T09:49:54Z")

</div>

Hi!

Yes, mavros takes care of frame conversions.  
You can see it here: [https://github.com/mavlink/mavros/blob/686bd833e7d6ea5542977178872762dfbec5ed89/mavros/src/plugins/setpoint\_raw.cpp#L212](https://github.com/mavlink/mavros/blob/686bd833e7d6ea5542977178872762dfbec5ed89/mavros/src/plugins/setpoint_raw.cpp#L212) regarding _setpoint\_raw_ and here [https://github.com/mavlink/mavros/blob/686bd833e7d6ea5542977178872762dfbec5ed89/mavros/src/plugins/setpoint\_position.cpp#L130](https://github.com/mavlink/mavros/blob/686bd833e7d6ea5542977178872762dfbec5ed89/mavros/src/plugins/setpoint_position.cpp#L130) regarding _setpoint\_position_.

---

<div class="post-metadata">

**Author:** ![robin-ecn](https://discuss.px4.io/user_avatar/discuss.px4.io/robin-ecn/32/3444_2.png) [@robin-ecn](https://discuss.px4.io/u/robin-ecn)\
**Post date:** [July 20, 2022, 10:39am UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377/3 "2022-07-20T10:39:34Z")

</div>

Hi, Benja. Thanks so much for your reply. I read the links that sent by you.

Just to be sure:  
In terms of setpoint\_raw/local, should I leave coordinate\_frame () empty when I pub commands in ENU, such that it will run position = ftf::transform\_frame\_enu\_ned(position) in line 223?

But for setpoint\_position/local , the message (geometry\_msgs/PoseStamped) does not have a coordinate\_frame for us to specify like mavros\_msgs/PositionTarget for setpoint\_raw/local. What should I do for `using mavlink::common::MAV_FRAME` in order to use ENU? Or It is set to be the ENU frame by default?

---

<div class="post-metadata">

**Author:** ![Benja](https://discuss.px4.io/user_avatar/discuss.px4.io/benja/32/11872_2.png) [@Benja](https://discuss.px4.io/u/Benja)\
**Post date:** [July 21, 2022, 9:10am UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377/4 "2022-07-21T09:10:10Z")

</div>

Hi Robin,

> [@robin-ecn](#):
>
> In terms of setpoint\_raw/local, should I leave coordinate\_frame () empty when I pub commands in ENU, such that it will run position = ftf::transform\_frame\_enu\_ned(position) in line 223

I’ll try first setting _coordinate\_frame_ to **FRAME\_LOCAL\_NED** (see the message [characteristics](https://github.com/mavlink/mavros/blob/ros2/mavros_msgs/msg/PositionTarget.msg)).

For _setpoint\_position/local_, mavros should take care of everything.

Maybe you could try everything in simulation with gazebo, to be super sure 😉

---

<div class="post-metadata">

**Author:** ![robin-ecn](https://discuss.px4.io/user_avatar/discuss.px4.io/robin-ecn/32/3444_2.png) [@robin-ecn](https://discuss.px4.io/u/robin-ecn)\
**Post date:** [July 21, 2022, 6:28pm UTC](https://discuss.px4.io/t/enu-and-ned-frames-in-mavros/28377/5 "2022-07-21T18:28:27Z")

</div>

Thanks for your message.  
I just tested both in gazebo simulation.  
From the simulation results, we can send commands in ENU to them 😀.  
I will test them in real experiments soon.
