Visual position estimate and offboard control
-
I am new to VOXL development and am working on an application that will provide a VISION_POSITION_ESTIMATE mavlink message to the autopilot and control the aircraft via OFFBOARD commands. The application will run on the VOXL. I am currently reading frames from the MPA, synchronizing with metadata from MPA, and computing a vision based position estimate. However, I am struggling with how to get that position estimate to the autopilot and how to configure the autopilot to receive them.
- Do I use the mavlink_onboard pipe to send the mavlink offboard control commands (ex. SET_ATTITUDE_TARGET) and VISION_POSITION_ESTIMATE messages?
- Are there instances where I should communicate over UDP with the autopilot or are all comms done through MPA?
- Is there example code to follow with instructions on any internal routing or other setup?
Thanks
-
@bschulzhf Take a look at the voxl-vision-hub code. Specifically the vio manager: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-vision-hub/-/blob/dev/src/vio_manager.c?ref_type=heads
-
I was able to get the visual odometry message updating the PX4 EKF2 and that seems like the better path. Just to make sure I've got this set up correctly, I put the application processor time (CLOCK_MONOTONIC) into the timestamp field and the mavlink server updates the message with the appropriate PX4 kernel time before forwarding it to PX4?
-
@bschulzhf Sort of. The timestamp from voxl-vision-hub and voxl-mavlink-server is just the Linux processor monotonic time. But because voxl-mavlink-server has been responding to the time sync protocol messages from PX4 it allows PX4 itself to update the timestamp to PX4 time when it comes in.
-
To make sure I understand this, I still publish messages from the application processor with the application processor time and PX4 will correct it? Then do the PX4 messages coming out (like with attitude data) then have the timestamp correct relative to the application processor, or do I need to convert those timestamps?
-
@bschulzhf PX4 will only correct incoming messages. Something external will have to also run TIMESYNC with PX4 to estimate the offset and correct and incoming PX4 message timestamps that it wants to align. voxl-mavlink-server does this for a few messages.