Aerostack2

DocsROS 2 Interfaces

as2_msgs

The messages, services and actions Aerostack2 defines, and where each one is used.

as2_msgs holds the interface types Aerostack2 adds to the standard ROS 2 ones. Everything else uses std_msgs, geometry_msgs, sensor_msgs and the other common packages. The definitions are in the as2_msgs package.

#include <as2_msgs/msg/platform_info.hpp>
#include <as2_msgs/action/takeoff.hpp>
from as2_msgs.msg import PlatformInfo
from as2_msgs.action import Takeoff

Platform and control

TypeWhat it carriesUsed on
msg/PlatformInfoThe platform's connection, arming, offboard, state and control modeplatform/info
msg/PlatformStatusA state of the platform state machineInside PlatformInfo
msg/PlatformStateMachineEventAn event for the platform state machineInside SetPlatformStateMachineEvent
msg/ControlModeA control mode and a yaw modeInside PlatformInfo, ControllerInfo and SetControlMode
msg/ControllerInfoThe controller's input and output control modescontroller/info
msg/ThrustA collective thrustmotion_reference/thrust, actuator_command/thrust
msg/AlertEventAn alert, such as a kill switchalert_event
srv/SetControlModeAsks for a control modecontroller/set_control_mode, set_platform_control_mode
srv/ListControlModesReturns the control modes a platform supportsplatform/list_control_modes
srv/SetPlatformStateMachineEventSends an event and returns the new stateplatform/state_machine_event
msg/AcroBody rates and a thrust vectorThe Gazebo platform's bridge only

PlatformInfo

msg/PlatformInfo.msg
std_msgs/Header header
bool connected
bool armed
bool offboard
as2_msgs/PlatformStatus status
as2_msgs/ControlMode current_control_mode

PlatformStatus and PlatformStateMachineEvent

The two share some names but not their values. LANDED is 1 as a state and 5 as an event.

StateValueEventValue
EMERGENCY-1EMERGENCY-1
DISARMED0ARM0
LANDED1DISARM1
TAKING_OFF2TAKE_OFF2
FLYING3TOOK_OFF3
LANDING4LAND4
LANDED5

Aerial platform shows which event leads to which state.

ControlMode

msg/ControlMode.msg
std_msgs/Header header

int8 NONE      = 0
int8 YAW_ANGLE = 1  # rad
int8 YAW_SPEED = 2  # rad/s
int8 yaw_mode

int8 UNSET            = 0
int8 HOVER            = 1
int8 POSITION         = 2  # x, y, z
int8 SPEED            = 3  # vx, vy, vz
int8 SPEED_IN_A_PLANE = 4  # vx, vy, z
int8 ATTITUDE         = 5  # roll, pitch, yaw
int8 BODY_RATES       = 6  # collective thrust and p, q, r
int8 TRAJECTORY       = 7  # x, y, z, vx, vy, vz, ax, ay, az
int8 control_mode

ListControlModes doesn't return ControlMode messages. It packs each mode into one byte, with other numbers than the message, and the control modes files of the platforms and controller plugins use the same bytes.

BitsHoldsValues
7 to 4The control modeUnset 0, hover 1, body rates 2, attitude 3, speed 4, speed in a plane 5, position 6, trajectory 7
3 to 2The yaw modeAngle 0, speed 1, none 2
1 to 0NothingIgnored

So 0b01000100 is speed with a yaw speed. as2_core/utils/control_mode_utils.hpp converts between the two forms.

AlertEvent

msg/AlertEvent.msg
int8 KILL_SWITCH     = -1
int8 EMERGENCY_HOVER = -2
int8 EMERGENCY_LAND  = -3
int8 INFO_ALERT      = 0
int8 FORCE_HOVER     = 1
int8 FORCE_LAND      = 2
int8 alert
string description

Negative alerts are meant for the platform and positive ones for the rest of the stack. Only the kill switch and the emergency hover are acted on today, as Alerts explains.

References and trajectories

TypeWhat it carriesUsed on
msg/TrajectoryPointOne point of a trajectory, with its position, velocity, acceleration and yawInside TrajectorySetpoints
msg/TrajectorySetpointsThe points of a trajectory, all in the header's framemotion_reference/trajectory, actuator_command/trajectory
msg/YawModeHow a behavior handles the yawThe goals of the motion and path planning behaviors
msg/PoseWithIDA pose with a nameThe follow path and swarm goals
msg/PoseStampedWithIDA stamped pose with a nameThe trajectory generation goal
msg/PoseStampedWithIDArrayA list of named posesmotion_reference/modify_waypoint
msg/PoseWithIDArrayA list of named posesThe swarm's dynamic_swarm_formation
msg/TrajectoryPoint.msg
string id
geometry_msgs/Vector3 position
geometry_msgs/Vector3 twist         # A linear velocity, despite its name
geometry_msgs/Vector3 acceleration
float32 yaw_angle                   # rad

YawMode

ModeValueThe drone faces
KEEP_YAW0Where it faces now
PATH_FACING1Along the path
FIXED_YAW2The direction in angle, in radians
YAW_FROM_TOPIC3The yaw given on a topic
YAW_FROM_ORIENTATION4The orientation of the pose. No behavior supports it yet
YAW_TO_FRAME5The frame the goal is given in
FACE_REFERENCE6The next reference

Not every behavior takes every mode. The go to behavior takes the first four, for example, and only the trajectory generator takes FACE_REFERENCE.

Behaviors

msg/BehaviorStatus is the state every behavior publishes on <behavior>/_behavior/behavior_status, which is IDLE, RUNNING or PAUSED. Behaviors lists the rest of their interfaces.

Actions

ActionGoalResultFeedback
Takeofftakeoff_height in m, takeoff_speed in m/stakeoff_successactual_takeoff_height, actual_takeoff_speed
Landland_speed in m/sland_successactual_land_height, actual_land_speed
GoToWaypointtarget_pose as a PointStamped, max_speed, yawgo_to_successactual_speed, actual_distance_to_goal
FollowPathheader with the path's frame, path as PoseWithID[], max_speed, yawfollow_path_successactual_speed, actual_distance_to_next_waypoint, remaining_waypoints, next_waypoint_id
FollowReferencetarget_pose as a PointStamped, max_speed_x, max_speed_y, max_speed_z, yawfollow_reference_successactual_speed, actual_distance_to_goal
GeneratePolynomialTrajectorystamp, path as PoseStampedWithID[], max_speed, yaw, start_on_paused, follow_reference_modetrajectory_generator_successnext_waypoint_id, remaining_waypoints
NavigateToPointpoint as a PointStamped, navigation_speed, yawsuccesscurrent_pose, current_speed, navigation_time, estimated_time_remaining, distance_remaining
SetArmingStaterequestsuccessNone
SetOffboardModerequestsuccessNone
DetectObjectsthreshold, target_classesperceptionsperceptions
PointGimbalcontrol as a GimbalControl, follow_mode, modesuccessgimbal_attitude, gimbal_speed
GripperHandlerrequest_gripper, true to closegripper_successstate_gripper
MassEstimationrequestsuccessNone
ForceEstimationrequestsuccessNone
SwarmFlockingvirtual_centroid, swarm_formation as PoseWithID[], drones_namespaceswarm_successswarm_pose

start_on_paused generates the trajectory and leaves the behavior paused until it's resumed. follow_reference_mode takes a single waypoint and keeps tracking it after the trajectory ends.

The point gimbal behavior only takes GimbalControl in position mode, without follow_mode.

Perception

TypeWhat it carriesUsed on
msg/ObjectPerceptionOne detection, with its class, image box, keypoints and an optional 3D poseInside ObjectPerceptionArray
msg/ObjectPerceptionArrayThe detections of one imagedetections_data, and the DetectObjects result and feedback
msg/GimbalControlA gimbal command, as angles or ratesplatform/<gimbal>/gimbal_command
msg/UInt16MultiArrayStampedA list of numbers with a timestampThe simple EKF's internal debug topics

In ObjectPerception, pose_valid says whether the hypothesis carries a 3D pose or only an image position.

Missions

TypeWhat it carriesUsed on
msg/MissionUpdateA command for the mission executor, with the mission as JSON/mission_update

Mission executor lists the commands it handles.

GPS, geozones and TF

TypeWhat it doesUsed on
srv/SetOriginSets the GPS originset_origin
srv/GetOriginReturns the GPS originget_origin
msg/GeozoneA geofence or geocage, its height limits and the alert it raisesInside SetGeozone and GetGeozone
srv/SetGeozoneAdds a geozonegeozones/set_geozone
srv/GetGeozoneLists the geozonesgeozones/get_geozone
msg/PolygonListThe geozones as polygons, for RVizgeozones_rviz
srv/AddStaticTransformAdds a static transformexternal_object_to_tf/add_static_transform
srv/AddStaticTransformGpsAdds a static transform from a GPS positionexternal_object_to_tf/add_static_transform_gps

Not used yet

These types are defined but nothing in Aerostack2 serves or publishes them, so don't build on them.

KindTypes
MessagesFollowTargetInfo, MissionEvent, NodeStatus, Speed, TrajGenInfo
ServicesDynamicFollower, DynamicLand, GeopathToPath, ModifySwarm, PackagePickUp, PackageUnPick, PathToGeopath, SetSpeed
ActionsDetectArucoMarkers. The object perception behavior detects ArUco markers through DetectObjects

The GPS behavior tree nodes call a geopath_to_path service, but no node serves it, so they wait for it forever.

Last updated on November 3, 2026

On this page

Last updated on November 3, 2026