Aerostack2

DocsROS 2 Interfaces

Behaviors

The action, services and status topic every behavior offers, and the names of the shipped behaviors.

Every behavior is a node built on as2_behavior::BehaviorServer, so they all offer the same set of interfaces. A behavior is started through its action, and controlled through a few services while it runs. Behaviors explains how they work.

The common interfaces

For a behavior whose node and action are called GoToBehavior, these are the interfaces.

NameKindTypeWhat it does
GoToBehaviorActionThe behavior's actionStarts the behavior with a goal. Cancelling stops it
GoToBehavior/_behavior/pauseServicestd_srvs/TriggerPauses the behavior. Fails unless it's running
GoToBehavior/_behavior/resumeServicestd_srvs/TriggerResumes the behavior. Fails unless it's paused
GoToBehavior/_behavior/stopServicestd_srvs/TriggerStops the behavior, the same as cancelling
GoToBehavior/_behavior/modifyServiceThe action's _SendGoal serviceSends the running behavior a new goal
GoToBehavior/_behavior/behavior_statusTopicas2_msgs/BehaviorStatusThe behavior's state, published at 10 Hz

The modify service takes the same request as the action's own goal service, so for the go to behavior it's as2_msgs/action/GoToWaypoint_SendGoal. Only the goal field is read, and accepted in the response says whether the behavior took it.

behavior_status is published all the time, even when nothing runs. It's reliable, with a depth of 10.

StatusValueMeaning
IDLE0No goal is running
RUNNING1A goal is running
PAUSED2A goal is paused, and resume picks it up again

While a goal runs, the behavior works on it at run_frequency, 10 Hz by default, and sends feedback on every cycle. A paused behavior doesn't run at all.

The services follow the node name

The action takes its name from the behavior's code, but the services and the status topic are under the node's name. The two are the same unless you launch the behavior with another node name. Then the action keeps its name while the services move, and the Python API can no longer pause, stop or modify it.

Shipped behaviors

BehaviorPackageActionType
Take offas2_behaviors_motionTakeoffBehavioras2_msgs/Takeoff
Landas2_behaviors_motionLandBehavioras2_msgs/Land
Go toas2_behaviors_motionGoToBehavioras2_msgs/GoToWaypoint
Follow pathas2_behaviors_motionFollowPathBehavioras2_msgs/FollowPath
Follow referenceas2_behaviors_motionFollowReferenceBehavioras2_msgs/FollowReference
Trajectory generationas2_behaviors_trajectory_generationTrajectoryGeneratorBehavioras2_msgs/GeneratePolynomialTrajectory
Armas2_behaviors_platformset_arming_stateas2_msgs/SetArmingState
Offboardas2_behaviors_platformset_offboard_modeas2_msgs/SetOffboardMode
Path planningas2_behaviors_path_planningpath_planneras2_msgs/NavigateToPoint
Object perceptionas2_behaviors_object_perceptionObjectPerceptionBehavioras2_msgs/DetectObjects
Point gimbalas2_behaviors_payloadPointGimbalBehavioras2_msgs/PointGimbal
Gripperas2_behaviors_payloadGripperHandlerBehavioras2_msgs/GripperHandler
Mass estimationas2_behaviors_param_estimationMassEstimationBehavioras2_msgs/MassEstimation
Force estimationas2_behaviors_param_estimationForceEstimationBehavioras2_msgs/ForceEstimation
Swarm flockingas2_behaviors_swarm_flockingSwarmFlockingBehavioras2_msgs/SwarmFlocking

All the action types are in as2_msgs/action, and as2_msgs lists their goals, results and feedback. Only the first six names are in as2_core/names/actions.hpp.

The arm and offboard behaviors wrap the platform services of the same name, so you can run them like any other behavior. They can't be paused, modified, stopped or cancelled.

The swarm flocking behavior isn't tied to one drone. Its launch file puts it in the Swarm namespace, so its action is /Swarm/SwarmFlockingBehavior.

What else each behavior uses

Motion behaviors

The five motion behaviors and the trajectory generator send their references through the motion reference handlers. Those publish on motion_reference/* and call controller/set_control_mode when the control mode changes, as described in Motion controller. They read the drone's state from self_localization/twist and TF.

BehaviorAlso uses
Take offThe platform/state_machine_event service, to send TAKE_OFF and then TOOK_OFF. The platform plugin calls platform_takeoff
LandThe platform/state_machine_event service, to send LAND and then LANDED, and set_arming_state to disarm once landed. The platform plugin calls platform_land
Go to, follow path, follow referenceplatform/info, to reject goals while the drone isn't flying
Trajectory generationmotion_reference/modify_waypoint (as2_msgs/PoseStampedWithIDArray), to move waypoints of the running trajectory

The motion behaviors' trajectory plugins don't send references themselves. They run the trajectory generation behavior through its action, so it has to be running too. The follow reference trajectory plugin moves its target by publishing on motion_reference/modify_waypoint.

The trajectory generator can also publish what it generated, under debug/behaviors/trajectory_generation/. Each of its debug.* parameters sets one topic, and an empty value turns it off.

Path planning

NameKindType
map or map_filteredSubscribesnav_msgs/OccupancyGrid
self_localization/poseSubscribesgeometry_msgs/PoseStamped
FollowPathBehaviorAction clientas2_msgs/FollowPath
FollowPathBehavior/_behavior/pause, resumeService clientsstd_srvs/Trigger
plugin_viz/*PublishesThe planned path and the planner's grids, for RViz

The A* plugin plans on map and the Voronoi plugin on map_filtered, both from the map server. The planned path is flown with the follow path behavior, so that one has to run too.

Object perception

The behavior runs a pipeline of detection stages on camera images.

NameKindTypeParameter
sensor_measurements/camera/image_rawSubscribessensor_msgs/Image, or CompressedImage for a name ending in /compressedcamera_image_topic
sensor_measurements/camera/camera_infoSubscribessensor_msgs/CameraInfocamera_info_topic
detections_dataPublishesas2_msgs/ObjectPerceptionArraypipeline.<stage>.output_topic
debug/detection_posesPublishesgeometry_msgs/PoseArraypipeline.<stage>.debug_poses_topic

All of them use sensor data QoS. The default image topic fits a Gazebo camera called camera. Platforms built on the sensor helpers publish sensor_measurements/<camera>/image instead, so set camera_image_topic for those.

Payload and estimation

BehaviorUses
Point gimbalPublishes platform/<gimbal_name>/gimbal_command (as2_msgs/GimbalControl). gimbal_name defaults to gimbal
GripperPublishes the gripper commands, which depend on the plugin
Mass and force estimationSubscribe to actuator_command/thrust and sensor_measurements/imu. With controller_node set, they write the estimate into the controller's parameters through its get_parameters and set_parameters services

Last updated on November 3, 2026

On this page

Last updated on November 3, 2026