Can I have multiple commands at each waypoint or [Execute Script] at each waypoint by using [Set Waypoints] method?


#1

After each waypoint achieved, I need to make some custom commands like Pause, Altitude Change or other; But only after waypoint was achieved.
Question 1: Can I use [Set Waypoints] method and register at each waypoint a python script to be called? like [Execute Script].
By register I mean set custom commands in each waypoint and send them via [Set Waypoints] method, not handling myself in a while loop the execution of waypoints and each custom action.
I would prefer not to handle in a while loop each waypoint execution because I might be subject of connection fall, so I prefer to group all waypoints with custom action/settings and send them to drone.

I know than [Set Waypoints] has command field that permit 1 custom action at that waypoint, like
command int defines the function of the waypoint
16: Waypoints
17: Loiter
18: Loiter Turns
19: Loiter time
20: Return to Launch
21: Land
22: Take Off

Question 2: Can I set multiple commands to one waypoint and still user something like [Set Waypoints]?


#2

No, you cannot set more than one command to a waypoint.

To implement this, add another waypoint for the next action (you don’t need to mention lat,lng for this waypoint). Please refer to MAV_CMD section of mavlink docs for the list of actions available.
Note: Not all the actions are supported by APM/PX4.

If the action you would want to implement is NOT a part of the above shared action list, then you would have to implement it yourself via a python/cpp script.

If the script is running onboard the drone, there shouldn’t be any connectivity related issue.


Can I set multiple commands to one waypoint and still user something like [Set Waypoints]
Possible with more commands in mission (more than Set Waypoints)?
#3

@srv-admin Thanks for the confirmation that MAV_CMD work on SetWaypoints