Questions about indoor flying with optitrack

I am using pixhawk with six cameras optitrack, my target is use the external position and send position data to pixhawk.

My pixhawk setup: offboard mode, I enable LPE estimator and enable the option mocap in the ATT_EXT_HDG_M parameter. I am using telemetry (TELEM1) with 57600 baudrate to communicate my pc (mavros) with pixhawk.

I have done the following:

Motive to ROS: I am using vrpn node.
I am remapping the vrpn topic to mavros/mocap/pose topic.

My Quiestions are the followings:

Does the topic mocap/pose perform the transformation of ENU to NED coordinates?
Is my drone ready to take off without problems?
Do I need to modify other parameters?


Did you manage to find the answers to your questions ? I’m having the same problems

Wich issues do you have? @Hari_Haran

hey Mario
I think we do the same thing about mavros and optitrack…
i read some code about mavros. u need publish the topic /mavros/mocap/pose in ENU.
and the plugin in mavros_extras would transform it to NED and then send to the FCU.
And the set point in MAVROS also is in ENU.
This is my email
Maybe we can exchange our informations more.

hey @potato77

Maybe we are doing a similar project and I agree with your idea of exchanging information.

My email:

Hey @Mario1577,

So my problem is that I’m trying to use ATT_POS_MOSCAP to have x,y and z axis distance using a camera. After finding them how does it get converted to latitude, longitude and altitude in waypoints management using fake GPS ?

Also I have this same question of yours : mocap/pose perform the transformation of ENU to NED coordinates?

Yes, when your send the mocap data to mocap/pose topic, mavros is converting the mocap data to Ned.
I am not using GPS fake but in dev-guide px4 is a tutorial where where they explain how to do fake gps @Hari_Haran

Have you successfully flown your drone indoor?
I am also doing the similar project but communicating with FCU via mavlink-router service instead of a ROS application.
Here is the list of what I have done:

  1. Extracting mocap data from Optirack cameras and send it to the computation board on the drone.
  2. On the computation board, create a Mavlink message of ATT_POS_MOCAP and send it to the FCU via mavlink-router service --> the local position of the drone can be obtained via drone kit python API (vehical.location.local_frame).
  3. Put the drone into MISSION mode, arm the motors, and sleep for 3 sec
  4. Put the drone into OFFBOARD mode and continuously send SET_POSITION_TARGET_LOCAL_NED
    to make it take off (type_mask = 0b0000111111111000 | 0x1000, coordinate_frame = MAV_FRAME_LOCAL_NED, x = 0, y = 0 and z = 0.5 m) until its local altitude is 0.5 and the send a NULL NED (type_mask = 0b0000111111111000, coordinate_frame = MAV_FRAME_LOCAL_NED, and x, y and z are all set to 0.0)

However, it has not worked as I expected. It does take off but continuously climb up after reaching the target altitude and receiving NULL NED message. Could you please point out what I have done wrong?

Hello @Duy_Vu

I think your procedure is correct, I do not see any problem, it should work fine, you tried to do the test without sending the null ned?

Are you using mavros?

Hi @Mario1577,

Thank you for your reply.
If I do not send the null NED, the drone will go out of OFFBOARD mode immediately and behave crazily.
I am not using mavros but mavlink-router to send ATT_POS_MOCAP and NED via dronekit-python to the FCU.