Aerostack2

DocsROS 2 Interfaces

Other components

The interfaces of the map server, geozones, the external object to TF tool, the mission executor and the alerts.

These components are optional. Each one runs as its own node under the drone's namespace, unless this page says otherwise.

Map server

The map server builds an occupancy grid from a laser scan, for the path planning behavior. The node is called as2_map_server, and plugin_name picks the plugin, scan2occ_grid by default.

TopicDirectionTypeQoS
sensor_measurements/lidar/scanSubscribessensor_msgs/LaserScanSensor data
mapPublishesnav_msgs/OccupancyGridReliable
map_filteredPublishesnav_msgs/OccupancyGridReliable

The scan topic is fixed in the code. Gazebo publishes it for a lidar named lidar, and any other source has to be remapped to it. The grid is in the earth frame, centred on its origin.

The depth2occ_grid and point_cloud2occ_grid launch files build the map from a depth camera or a point cloud. They turn it into a laser scan on sensor_measurements/lidar/scan first, and then run the same plugin.

The path planning behavior's A* plugin reads map, and its Voronoi plugin reads map_filtered.

Geozones

Geozones are areas the drone must stay in or out of. The node is called geozones. It loads its zones from config_file and checks the drone's position against them.

NameKindTypeWhat it does
self_localization/poseSubscribesgeometry_msgs/PoseStampedThe position to check
alert_eventPublishesas2_msgs/AlertEventThe zone's alert, while the drone breaks it
geozones/set_geozoneServiceas2_msgs/SetGeozoneAdds a zone
geozones/get_geozoneServiceas2_msgs/GetGeozoneLists the zones
geozones_rvizPublishesas2_msgs/PolygonListThe zones as polygons, with debug_rviz on
get_originClientas2_msgs/GetOriginReads the GPS origin, for zones given in GPS coordinates

A geocage raises its alert while the drone is outside it, and a geofence while the drone is inside it. The alert is published again on every check for as long as that lasts.

Pick an alert the platform acts on

Each zone sets its own alert value, and the example configuration uses 1, a force hover. Nothing in Aerostack2 acts on that yet. Use -2 for an emergency hover or -1 for a kill switch, or react to the alert in a behavior tree.

Zones in GPS coordinates need the GPS origin, which only the raw odometry estimator serves.

External object to TF

This tool adds objects outside the drone to the TF tree, like a landing pad, a gate or another robot. The node is called external_object_to_tf. Its launch file runs it at the root namespace by default, so its services are under /external_object_to_tf/.

NameKindTypeWhat it does
external_object_to_tf/add_static_transformServiceas2_msgs/AddStaticTransformAdds a static transform
external_object_to_tf/add_static_transform_gpsServiceas2_msgs/AddStaticTransformGpsAdds a static transform from a GPS position and an azimuth
/mocap/rigid_bodiesSubscribesmocap4r2_msgs/RigidBodiesRigid bodies from motion capture, set with mocap_topic
Set per objectSubscribesgeometry_msgs/PoseStamped, sensor_msgs/NavSatFix, std_msgs/Float32Each object's pose, or its GPS position and azimuth
get_originClientas2_msgs/GetOriginReads the GPS origin, for objects given in GPS coordinates
/tf, /tf_staticPublishestf2_msgs/TFMessageThe objects' transforms

The objects and their topics come from the file in config_file. All the subscriptions use sensor data QoS.

At the root namespace, get_origin resolves to /get_origin rather than a drone's /drone0/get_origin. Launch the tool in the drone's namespace when it needs the origin.

Mission executor

ros2 run as2_python_api mission_executor runs the mission interpreter as a node, so a ground station can send it missions while the drone flies.

TopicDirectionTypeWhat it carries
/mission_updateSubscribesas2_msgs/MissionUpdateA command, with the mission as JSON
/mission_statusPublishesstd_msgs/StringThe interpreter's status as JSON, every two seconds

Both topics are shared by every drone by default, and each executor ignores updates whose drone_id isn't its own. With --add_namespace they move under the drone's namespace. --n sets the drone, drone0 by default, and --timer_freq sets how often the status is published.

The executor handles the EXECUTE, LOAD, START, PAUSE, RESUME, STOP and NEXT_ITEM commands. The others in the message aren't implemented yet and are logged and ignored.

Alerts

alert_event sits under the drone's namespace like any other topic. It's reliable, with a depth of 10.

AlertValueActed on by
KILL_SWITCH-1The platform, which cuts the motors
EMERGENCY_HOVER-2The platform, which stops the drone
EMERGENCY_LAND-3Nothing yet
INFO_ALERT0Nothing
FORCE_HOVER1Nothing yet
FORCE_LAND2Nothing yet

The Python API, the RViz teleoperation panel and geozones publish alerts. A behavior tree can wait for any of them with the WaitForAlert decorator. Alerts has more on what each one means.

Last updated on November 3, 2026

On this page

Last updated on November 3, 2026