Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PX4/PX4-Autopilot/llms.txt

Use this file to discover all available pages before exploring further.

PX4 integrates with ROS 2 through the uXRCE-DDS middleware, which bridges PX4’s internal uORB message bus to the DDS global data space. This allows your ROS 2 nodes to publish and subscribe to PX4 topics directly, without any custom serialization layer. The result is a fast, bidirectional data channel between the flight controller and your companion computer.

Architecture

The integration relies on two components that run concurrently: a client embedded in the PX4 firmware, and an agent running on your companion computer.
  • The uXRCE-DDS client (uxrce_dds_client) is compiled into PX4 firmware at build time. It translates uORB messages to DDS and back, using the topic list defined in dds_topics.yaml.
  • The Micro XRCE-DDS agent (MicroXRCEAgent) runs on the companion computer and acts as a proxy, connecting the client to the broader DDS network where your ROS 2 nodes live.
When both are running and connected, uORB topics become ROS 2 topics. Your nodes can subscribe to telemetry and publish commands using the same ROS 2 APIs they use for any other topic.
PX4 v1.14 and later use uXRCE-DDS exclusively. If you are migrating from PX4 v1.13, which used Fast-RTPS, refer to the migration guidelines in the uXRCE-DDS documentation.

Supported platform

The recommended and officially supported environment for ROS 2 with PX4 is:
ComponentVersion
OSUbuntu 22.04
ROS 2Humble (LTS)
PX4v1.14 or later
If you are on Ubuntu 20.04, upgrade to Ubuntu 22.04 before starting. ROS 2 Foxy reached end-of-life in May 2023 and is not recommended for new projects.

The px4_msgs package

Your ROS 2 workspace must include the px4_msgs package, which contains the message definitions that match those compiled into the PX4 firmware you are running. Clone it into your workspace src/ directory and check out the branch that corresponds to your PX4 release:
git clone https://github.com/PX4/px4_msgs.git src/px4_msgs
# Check out the branch matching your PX4 release, e.g.:
git -C src/px4_msgs checkout release/1.14
PX4 CI automatically exports message definitions to the correct branch in px4_msgs for each release, so branch names align with PX4 version numbers.
Starting with PX4 v1.16, message versioning is supported. If you are on v1.16 or later, the ROS 2 Message Translation Node can handle mismatches between your local message definitions and those compiled into firmware automatically.

How uORB topics map to ROS 2 topics

The uXRCE-DDS client exposes a subset of uORB topics over DDS. The exact set is controlled by dds_topics.yaml in the PX4 source tree. Topics follow a consistent naming convention:
  • PX4 → ROS 2 (outgoing telemetry): /fmu/out/<MessageName>
  • ROS 2 → PX4 (incoming commands): /fmu/in/<MessageName>
For example, vehicle odometry published by PX4 appears at /fmu/out/VehicleOdometry, and offboard control mode commands are sent to /fmu/in/OffboardControlMode.

Use cases

uXRCE-DDS setup

Configure the client and agent, choose between UDP and serial transport, and verify the connection.

Offboard control

Send position and velocity setpoints to PX4 from a ROS 2 node using the offboard control pattern.

Custom flight modes

Use the PX4 ROS 2 Interface Library to define and register custom flight modes that appear natively in PX4.

Computer vision

Feed visual odometry or object detection results into PX4 using standard uORB topics over the DDS bridge.

Build docs developers (and LLMs) love