Integrating External Device with PX4 Autopilot for Mission Control

I’m currently working with stock PX4 v1.14 and mapping out a mission using QGroundControl. My setup involves an external device that communicates with the Telem2 port on the autopilot via MAVLink messages.

My objective is to have the PX4 autopilot indicate to the external device when it reaches a predetermined waypoint. I’ve achieved this using the “Set Actuator” mission command. Once the external device receives this signal, it sends MAVLink commands to “pause” the PX4 autopilot at its current position. After completing its task, the external device sends another MAVLink message instructing PX4 to “continue” the mission.

Currently, I’ve implemented a solution by setting a “Hold” time during a waypoint of 300 seconds, followed by sending MAV_CMD_NAV_RETURN_TO_LAUNCH. While this approach works, it leads to the drone returning to launch instead of proceeding to further waypoints.

In my exploration, I’ve examined the available MAVLink messages that can be sent while in mission mode here.

I experimented with different MAVLink messages to communicate with the PX4 autopilot during mission mode, but it seems unresponsive to these commands:

MAV_CMD_NAV_DELAY (Sending a delay of 300 seconds to pause, then a delay of 0 to continue)

MAV_CMD_DO_CHANGE_SPEED (Changing speed to 0 to pause, then reverting to default speed to continue)

I’m curious if there are any other factors preventing PX4 from recognizing these messages while in mission mode. Any insights or suggestions would be greatly appreciated.

Ok, this sounds very complicated.

I would use MAVSDK on the “external device” and subscribe to the mission_raw progress. Then, when you get the progress update where you want to pause, you call pause_mission. Once done with your tasks, you can do start_mission again.

See, for C++:
https://mavsdk.mavlink.io/v2.0/en/cpp/api_reference/classmavsdk_1_1_mission_raw.html

For Python:
http://mavsdk-python-docs.s3-website.eu-central-1.amazonaws.com/plugins/mission_raw.html