[Feature] Support custom action waypoints #18506
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe problem solved by this pull request
A user might want to run an action in a waypoint that is not controlled by the navigator, but rather by the mission computer in a specified waypoint.
A custom action on a waypoint is an action that is determined by a system processing a navigation behavior which metadata is stored and processed in that system in specific. An example of it can be a planner in the companion computer that processes a simple action as triggering a servo, or a set of commands, split to be executed in a specific time frame, which then result in a more complex action.
The action is not standardized or handled by MAVLink and its microservices. The action is triggered by the autopilot with a command that gets sent to the onboard/mission computer, and the mission computer then handles the execution of that same action. The process of this action is user implementation specific, but we already provide a way of handling it with a lot of flexibility through the custom_action MAVSDK plugin: mavlink/MAVSDK#1581.
Describe your solution
MAV_CMD_WAYPOINT_USER_1
is processed as a mission item command that triggers a custom action in the system that is capable of processing it. Although not ideal, this is an intermediate step to proof a functional implementation, already in production in the Auterion Skynode, which can allow us to enable mavlink/mavlink#1516 again, and then standardize its usage.While the action is being processed, the
navigator
is blocked while receiving command IN_PROGRESS ACKs with the process of the action at a steady rate. If by any means those acks do not get received, the navigator broadcasts a COMMAND_CANCEL to theMAV_CMD_WAYPOINT_USER_1
command and continues the mission. The action is complete when an ACCEPTED ACK is received by the FMU to the command, meaning that the action is complete, and so thenavigator
can move to the next waypoint.The following sequence diagram exposes the functionality:
Describe possible alternatives
There can improvements to the approach so I am looking for feedback on improvements.
Test data / coverage
This can be tested locally with PX4 SITL together with the MAVSDK integration tests available in this PR:
This implementation is also already being used in production on the Auterion SW stack.
Additional context
Here's a video showing the capability with with Auterion Software stack and PX4 SITL: https://www.youtube.com/watch?v=dbiO7FTCk10