ENU and NED frames in mavros

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?

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 regarding setpoint_raw and here https://github.com/mavlink/mavros/blob/686bd833e7d6ea5542977178872762dfbec5ed89/mavros/src/plugins/setpoint_position.cpp#L130 regarding setpoint_position.

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?

Hi Robin,

I’ll try first setting coordinate_frame to FRAME_LOCAL_NED (see the message characteristics).

For setpoint_position/local, mavros should take care of everything.

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

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