ROS 2, MAVLink and the drone software stack have different jobs: ROS 2 supports robotics applications, MAVLink carries messages between vehicle components, and the autopilot remains responsible for flight-critical control. The integration decision is not simply which protocol to use. It is which data and commands cross the boundary, and which system has authority to act on them.
ROS 2 handles robotics logic; the autopilot owns flight-critical control
ROS 2 is a software framework for building robotics applications from nodes, messages and tools. On a drone, it commonly runs on a companion computer and supports tasks such as perception, mapping, planning and mission-level decision-making. It can exchange telemetry and commands with an autopilot, but it does not replace the autopilot’s flight-control functions.
The flight controller runs the autopilot firmware. It processes vehicle sensors and control inputs, stabilises the aircraft, manages actuators and applies configured failsafe behaviour. The companion computer runs higher-level software that may need more general-purpose computing resources. It can request a mode or send a supported setpoint, while the autopilot remains responsible for how the vehicle responds within its control architecture.
That distinction is about control authority, not just where software runs. A perception node may estimate an obstacle or a planner may generate a path, but neither output should become an actuator command unless the interface, operating mode and safety behaviour are deliberately defined. If the companion computer stops sending data, the autopilot must still have an understood response; if it continues sending data, the autopilot must know when those commands are valid.
PX4’s Offboard mode, for example, accepts certain external setpoints and requires a continuing signal from the external controller. Its documented failsafe behaviour depends on configuration, so engineers need to review the relevant requirements for their PX4 release and vehicle configuration before enabling external control. PX4’s Offboard Mode guide describes the supported control path and connection-loss handling.
A useful design rule is to keep stabilisation and immediate vehicle safety functions on the autopilot, and make autonomy software a client of a clearly defined interface. This leaves a boundary engineers can test: what the companion computer observes, what it is permitted to request and what the flight controller does if that request is missing, late or invalid.
Choose the interface supported by the autopilot release and build
ROS 2 integration is not a single interchangeable connection. PX4 currently documents direct uORB-to-ROS 2 paths through uXRCE-DDS and Zenoh, alongside the separately maintained MAVROS path over MAVLink. ArduPilot has its own native ROS 2 setup and MAVLink-based integrations. Select the path from the installed firmware release, build, required messages and application needs, rather than from a generic protocol ranking.
- PX4 direct ROS 2: verify the middleware included and enabled in the firmware, the client/agent or router requirements, and the exposed message set. The current PX4 ROS 2 overview describes uXRCE-DDS and Zenoh; availability is release and build dependent.
- MAVLink through MAVROS: verify the transport, ROS 2 package and plugin versions, supported messages, and the target autopilot’s command behaviour. A bridge does not make every MAVLink command supported in every mode.
- ArduPilot native ROS 2: follow the ArduPilot ROS 2 documentation and confirm its build and interface requirements. Do not transfer PX4 topic names or Offboard-mode rules to ArduPilot.
With uXRCE-DDS, PX4’s client runs on the flight controller and an agent runs on the companion side. The firmware configuration selects exposed uORB topics. Match the application’s message definitions to the firmware, or use a documented, compatible message-translation setup where supported. The PX4 ROS 2 user guide explains message versioning and setup. Finding a topic name is not enough: confirm the actual message schema and field meaning.
MAVROS bridges ROS 2 applications to MAVLink-based autopilots, including PX4 and ArduPilot. Its core nodes and plugins expose ROS interfaces while MAVLink remains the vehicle communication protocol. See the MAVROS project documentation for current ROS 2 packages, plugins and connection guidance.
ArduPilot documents native ROS 2 support through AP_DDS as well as MAVLink integration. Setup depends on the release and build. Start with ArduPilot’s ROS 2 installation documentation and its interface guides.
Keep computing roles and control authority explicit
The companion computer is generally where ROS 2 applications run; the flight controller runs the autopilot. This division allows robotics software to process data and make higher-level decisions without making a general-purpose operating system the sole home of stabilisation and immediate flight-control functions. The systems still need a deliberate communication link, and their responsibilities should remain explicit.
The manufacturer-listed Helios FMU combines a flight controller and Raspberry Pi Compute Module 5 companion computer. This illustrates two architectural roles in one unit; it does not establish which ROS 2 distribution, middleware or application is installed or compatible. Verify those separately for the intended build.
For a typical perception and planning application, sensor inputs may be read by the companion computer, processed by ROS 2 nodes, and translated into a documented vehicle-level request. The autopilot then handles the corresponding control behaviour. Assign each component ownership of its inputs and outputs: for example, avoid having internal autopilot logic and an external ROS node write competing setpoints at the same time.
Hardware evaluation still needs interface bandwidth, computation, power, cooling, physical connections and development access requirements. A product’s companion-computer specification does not establish an application’s real-time behaviour or its authority to control a vehicle.
Define message, timing and safety contracts before exchanging commands
Define each stream’s meaning, timing and failure behaviour before connecting ROS 2 publishers to an autopilot. Use this checklist:
- Choose the interface and messages. List required telemetry, estimates, mode requests and setpoints, then confirm availability in the selected release and build. PX4’s DDS topic configuration controls which uORB messages are exposed.
- Specify frames and units. For every pose, velocity and setpoint, record axes, units, origin and reference frame from its message definition. PX4 commonly uses NED world and FRD body conventions; ROS commonly uses ENU world and FLU body conventions. Exceptions are message-specific. Establish which bridge or application performs each conversion and test known basis vectors and rotations in simulation; do not assume all interfaces convert automatically.
- Define time and update behaviour. Identify the clock for each timestamp, check alignment, and set acceptable data age and update rates from the interface and application requirements. Log observed rates and delays.
- Match middleware and transport. Verify the ROS 2 distribution, firmware, agent or bridge, and message versions together. PX4 subscribers need a QoS profile compatible with its publishers; the official guide uses the sensor-data profile for telemetry subscriptions. A QoS mismatch can leave a discovered topic without received samples. For MAVLink, verify endpoint system/component identities, transport and stream availability against the actual configuration.
- Set command authority and loss behaviour. Define permitted modes, the publisher for each setpoint, and the response to stale or missing commands. Verify configured failsafes. Receiving telemetry does not confirm that commands are accepted.
In the current PX4 Offboard specification, a continuous 2 Hz proof-of-life signal must be present before switching into Offboard control. ROS 2 supplies that signal through OffboardControlMode, separately from the actual setpoint topic; MAVLink uses supported setpoint messages. Review the exact release’s rate, timeout, estimator and permitted-field requirements. A keep-alive that continues while the planner is stuck is not proof that its setpoint is fresh. Test the application’s stale-data policy as well as PX4’s configured loss response.
Bring up the stack in simulation before enabling vehicle control
Validate each layer before commands can affect a vehicle, and keep mode, arming and failsafe behaviour under review.
- Confirm versions. Record firmware release and build, ROS 2 distribution, message package revision, middleware, agent or bridge, and companion operating system. Use the supported combination documented for that release; a moving main-branch tutorial is not a compatibility guarantee for an older deployed system.
- Check communication without control commands. In simulation first, start the documented bridge or agent and inspect discovery, samples and endpoint identity. On hardware, establish the documented transport with propulsion disabled and without sending arming or movement requests. Confirm port and electrical settings from that exact board’s instructions.
- Inspect telemetry. Check message meaning, frames, timestamps, rates, source and vehicle identity. Topic visibility alone does not validate calculations or frame conversions.
- Test commands in simulation. Exercise the intended mode and command path, including rejection and interrupted-communication cases. Compare behaviour with the release documentation before enabling control on an aircraft.
- Validate failsafes before vehicle tests. Simulate lost offboard messages, link interruption and companion-computer failure. Define operational checks and who can stop or take over a controlled test.
Keep an integration trace for each test: input message and timestamp, transformed value, outbound request, command acknowledgement where defined, reported mode, and observed state. Exercise a rejected command, a stopped publisher, stale setpoints and restart recovery in simulation. Acknowledgement, mode transition and measured response are separate observations; one must not stand in for all three.
Frequently asked questions
Use the documentation for the installed PX4 release, not a blanket distribution recommendation. Record the operating system, ROS distribution, middleware and message-package revisions as one tested baseline. ArduPilot and MAVROS have their own supported combinations.
Yes. MAVROS documents itself as a MAVLink-to-ROS 2 bridge for ArduPilot and other MAVLink autopilots. Configure the vehicle link and confirm the relevant plugin and command support for your autopilot version.
Log the autopilot firmware and mode, command and setpoint messages, timestamps and rates, frame and field values, connection state, relevant ROS 2 topic or bridge diagnostics, and the autopilot’s rejection or failsafe messages. Compare the record with the exact interface requirements for that release.
The workflow above describes integration checks, not measured results from a particular aircraft. Manufacturer references supply hardware context; only project-specific evidence can establish that an application and vehicle meet their requirements.
For the hardware boundary behind the software interfaces, read about integrated and external companion-computer architectures.