Perfect ๐Ÿ‘ letโ€™s do it step by step so you can run a circle mission with only ros2 service call, no Python script.


๐Ÿ”น 1. Clear any old mission

Make sure PX4 has no leftover waypoints:

ros2 service call /mavros/mission/clear mavros_msgs/srv/WaypointClear "{}"


๐Ÿ”น 2. Create waypoints for a circle

A PX4 mission waypoint is a mavros_msgs/Waypoint object.

The fields you need are:

frame: 3            # MAV_FRAME_GLOBAL_REL_ALT (lat/lon + altitude rel to home)
command: 16         # MAV_CMD_NAV_WAYPOINT (go to waypoint)
is_current: false   # only true for the first waypoint
autocontinue: true  # automatically move to next waypoint
x_lat: 47.397750    # latitude
y_long: 8.545594    # longitude
z_alt: 10.0         # altitude (meters above home)

To approximate a circle, define several waypoints around a circle. For example, 8 waypoints 45ยฐ apart.


๐Ÿ”น 3. Push mission from terminal

Now call the push service with all waypoints included inline. Example with 3 waypoints (home + two points around):

ros2 service call /mavros/mission/push mavros_msgs/srv/WaypointPush "{
  start_index: 0,
  waypoints: [
    { frame: 3, command: 22, is_current: true,  autocontinue: true, x_lat: 47.397750, y_long: 8.545594, z_alt: 10.0 },   # takeoff
    { frame: 3, command: 16, is_current: false, autocontinue: true, x_lat: 47.397950, y_long: 8.545594, z_alt: 10.0 },  # move east
    { frame: 3, command: 16, is_current: false, autocontinue: true, x_lat: 47.397750, y_long: 8.545794, z_alt: 10.0 }   # move north
  ]
}"

๐Ÿ‘‰ Replace the x_lat and y_long with actual circle points around your takeoff location. With ~8โ€“12 waypoints youโ€™ll get a rough polygonal circle.


๐Ÿ”น 4. Arm the vehicle

ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"