Send external position data to pixhawk

My project involves PX4 flight controller and nexonar as mocap system. I use Processing sketch to send mavlink packets to pixhawk over telemetry radio. I have tested the connection with arm/disarm commands, it works.

after some research on internet I found that ATT_POS_MOCAP command can be used send mocap data to pixhawk. I have following question regarding it >

  1. Do I need to convert the coordinates to NED before sending it to pixhawk.
  2. https://dev.px4.io/external-position.html here this article mentions to set ATT_EXT_HDG_M parameter in QGroundcontrol, but I don’t find this in QGC.
  3. what should be the value of time_usec in ATT_POS_MOCAP packet.
  4. I am not sure whether I am using the correct framework. all the places I find mavros plugin, vicon_position_estimate or vision_position_estimate.I am using mavlink java library, my function to send mocap data is http://pastebin.com/sLCddKgQ
  5. I am checking local_position_ned packet to check x,y,z, after sending ATT_POS_MOCAP packet, which always gives zeros for x,y,z. how can I know that my att_pos_mocap packet is received or rejected :confused:.

@mhkabir I saw your name everywhere. Please help me on this. I have stuck on it .

Coordinates must be NED, and make sure you use LPE with latest master.

It’s the px4fmu-v2_lpe target.

@mhkabir The default estimator was ekf2. I changed it to LPE and sent the packets without changing it to NED. I downloaded the logs from pixhawk. it has multiple entries of following message.
Line 13535: MOCP, 1, 0, 0, 0, 119.32, 1045.159, 180.815
does this mean my external coordinate packet was received and applied ?

@mhkabir
I downloaded the Firmware code from master branch and build for px4fmu-v2_lpe target. After installing the firmware using Qgroundcontrol I am getting following warning message on Qgoundcontrol

I sent the coordinates . Please could you check the logs

I am not able to set the flight mode to manual. It gives the error message “Flight Safe Mode is on”. main led on pixhawk always blinks purple and flight mode shows “Land”.

When you build it from master it uses git hash as version and QGC will not recognize it. You can ignore the warning as long as you know what FW version you are using, i.e. master latest.
I started working on my vision setup as well and notice similar problem with failsafe settings. I can disable all the failsafe options but it will keep beeping at me anyway. The only way to stop it is to connect the RC for a moment, then you can switch off the RC. I think there is some bug in commander state machine, but I did not have time to look closely at it.
When I move from release to master I usually reset the parameters to default and set it back manually, calibrate sensors etc. Strange things may happen when you have old settings.
I notice there are related @mhkabir changes in mavros that went into 0.18.7 version of mavros_extras, but it is for Vision and not MOCAP. I assume related changes already exists in MOCAP interface. Mavros will do the conversion to NED, you may want to check the vision plugin in mavros_extras to replicate it in Java. @mhkabir if you can check if I am not talking nuts?
As for logs please upload them to http://logs.px4.io/ or http://logs.uaventure.com/ depend which logger you using. It will make easier for ppl to look at those.

@Maciej_Matuszak I downloaded logs using Mission Planner. It saves the log in .bin and .log. I tried to upload to http://logs.px4.io/ but these formats are not supported. Please tell me which application should I use to download logs from pixhawk

You can download it with QGC or just copy from SD card.

@Maciej_Matuszak I am not using mavros plugins. I read and write on COM port( telemetry radio connected) using a sketch in Processing3. I am using Nexonar mocap system based on Infrared tracking technology. I have installed a infrared sensor on drone. I get position(x,y,z) of the drone relative to infrared camera(0,0,0). could you tell me how can I convert these values to NED format to use in ATT_POS_MOCAP. The mocap system has an option to set the (0,0,0) at desired position. so I can get position of drone relative to any point.

Have a look at issue https://github.com/mavlink/mavros/issues/216.
Here is mavros code that does the conversion: https://github.com/mavlink/mavros/blob/master/mavros_extras/src/plugins/mocap_pose_estimate.cpp#L112

@Maciej_Matuszak long time, I was busy with my semester exams. I uploaded the logs

I checked the solution pointed by you, but I didn’t understand how can i use them in my current framework with processing.

Hi! @b-rohit I ans doing a similar proyect

tu sabes, como usar el plugin de mavros_extras: mocap_pose_estimate.?

Como ejecutar un plugin?

Regrds!!

@Mario1577, follow this tutorial https://dev.px4.io/en/simulation/ros_interface.html.