PX4 User Guide
  • Introduction
  • Getting Started
    • Basic Concepts
    • Vehicles/Frames
    • Flight Controllers
    • Sensors
    • Radio Systems
    • Flight Modes
    • Vehicle Status Notifications
      • LED Meanings
      • Tune/Sound Meanings
      • Preflight Checks
    • Payloads & Cameras
    • Flight Reporting
  • Basic Assembly
    • Mounting the Flight Controller
    • Mounting the GPS/Compass
    • Vibration Isolation
    • Cable Wiring
    • CUAV Pixhawk V6X Wiring QuickStart
    • CUAV V5+ Wiring Quickstart
    • CUAV V5 nano Wiring Quickstart
    • Holybro Pixhawk 6C Wiring Quickstart
    • Holybro Pixhawk 6X Wiring Quickstart
    • Holybro Pixhawk 5X Wiring Quickstart
    • Holybro Pixhawk 4 Wiring Quickstart - Discontinued
    • Holybro Pixhawk 4 Mini Wiring Quickstart - Discontinued
    • Holybro Durandal Wiring Quickstart
    • Holybro Pix32 v5 Wiring Quickstart
    • Cube Wiring Quickstart
    • Pixracer Wiring Quickstart
    • mRo (3DR) Pixhawk Wiring Quickstart
  • Standard Configuration
    • Firmware
    • Airframe
    • Sensor Orientation
    • Compass
    • Gyroscope
    • Accelerometer
    • Airspeed
    • Level Horizon Calibration
    • Radio Setup
    • Joystick Setup
    • Flight Modes
    • Battery
    • Safety
      • Failsafe Simulation
    • ESC Calibration
    • Actuators
    • Autotune
  • Vehicle Types & Setup
    • Multicopters
      • Multicopter Config/Tuning
        • MC Filter/Control Latency Tuning
        • MC PID Tuning (Manual/Basic)
        • MC PID Tuning Guide (Manual/Advanced)
        • MC Setpoint Tuning (Trajectory Generator)
          • MC Jerk-limited Type Trajectory
        • Multicopter Racer Setup
      • X500 v2 (Pixhawk 6C)
      • X500 v2 (Pixhawk 5X)
      • X500 (Pixhawk 4)
      • S500 V2 (Pixhawk 4)
      • DJI F450 (CUAV v5+)
      • DJI F450 (CUAV v5 nano)
      • QAV250 (Pixhawk4 Mini) - Discontinued
      • DJI F450 + RTK (Pixhawk 3 Pro)
      • QAV250 (Pixhawk Mini)
      • QAV-R 5" Racer (Pixracer)
      • Omnicopter
    • Planes
      • Fixed Wing Config/Tuning
        • Fixedwing PID Tuning Guide
        • Fixedwing Advanced Tuning Guide
        • Fixedwing Trimming Guide
      • Reptile Dragon 2 (ARK6X)
      • Turbo Timber Evolution (Pixhawk 4 Mini)
      • Wing Wing Z84 (Pixracer)
    • VTOL
      • VTOL Config/Tuning
        • QuadPlane Configuration
        • Back-transition Tuning
        • VTOL w/o Airspeed Sensor
        • VTOL Weather Vane
      • Standard VTOL
        • FunCub QuadPlane (Pixhawk)
        • Ranger QuadPlane (Pixhawk)
        • Falcon Vertigo QuadPlane (Dropix)
      • Tailsitter VTOL
        • Build: TBS Caipiroshka Tailsitter Build (Pixracer)
      • Tiltrotor VTOL
        • Build: Convergence Tiltrotor (Pixfalcon)
    • Airships (experimental)
    • Autogyros (experimental)
      • ThunderFly Auto-G2 (Holybro pix32)
    • Balloons (experimental)
    • Helicopter (experimental)
      • Helicopter Config/Tuning
    • Rovers (experimental)
      • Traxxas Stampede
    • Submarines (experimental)
      • BlueROV2
    • Airframes Reference
  • Flying
    • First Flight Guidelines
    • Flying 101
    • Missions
      • Package Delivery Mission
    • GeoFence
    • Safety Point Planning
    • Flight Modes
      • Position Mode (MC)
      • Altitude Mode (MC)
      • Manual/Stabilized Mode (MC)
      • Acro Mode (MC)
      • Orbit Mode (MC)
      • Position Mode (FW)
      • Altitude Mode (FW)
      • Stabilized Mode (FW)
      • Acro Mode (FW)
      • Manual Mode (FW)
      • Takeoff Mode
      • Land Mode
      • Return Mode
      • Hold Mode
      • Mission Mode
      • Follow Me Mode
      • Offboard Mode
    • Terrain Following/Holding
  • Flight Log Analysis
    • Log Analysis using Flight Review
    • Log Analysis using PlotJuggler
  • Advanced Configuration
    • Finding/Updating Parameters
    • Full Parameter Reference
    • ECL/EKF Overview & Tuning
    • Flight Termination Configuration
    • Bootloader Flashing onto Betaflight Systems
    • Land Detector Configuration
    • Prearm/Arm/Disarm Configuration
    • IMU Factory Calibration
    • Sensor Thermal Compensation
    • Compass Power Compensation
    • Advanced Controller Orientation
    • Static Pressure Buildup
    • Serial Port Configuration
    • MAVLink Telemetry (OSD/GCS)
    • PX4 Ethernet Setup
    • Bootloader Update
  • Hardware (Drones&Parts)
    • Complete Vehicles
      • ModalAI Starling
      • PX4 Vision Kit
      • MindRacer BNF & RTF
        • MindRacer 210
        • NanoMind 110
      • Holybro Kopis 2
      • Bitcraze Crazyflie 2.1
    • Flight Controllers (Autopilots)
      • Pixhawk Series
        • Silicon Errata
      • Pixhawk Standard Autopilots
        • CUAV Pixhawk V6X (FMUv6X)
        • Holybro Pixhawk 6X (FMUv6X)
        • Holybro Pixhawk 6C (FMUv6C)
        • Holybro Pixhawk 6C Mini(FMUv6C)
        • Holybro Pix32 v6 (FMUv6C)
        • Holybro Pixhawk 5X (FMUv5X)
        • Holybro Pixhawk 4 (FMUv5) - Discontinued
        • Holybro Pixhawk 4 Mini (FMUv5) - Discontinued
        • Drotek Pixhawk 3 Pro (FMUv4pro)
        • mRo Pixracer (FMUv4)
        • Hex Cube Black (FMUv3)
        • mRo Pixhawk (FMUv3)
        • Holybro Pixhawk Mini (FMUv3) - Discontinued
      • Manufacturer-Supported Autopilots
        • AirMind MindPX
        • AirMind MindRacer
        • ARK Electronics ARKV6X
        • CUAV X7
        • CUAV Nora
        • CUAV V5+ (FMUv5)
        • CUAV V5 nano (FMUv5)
        • CUAV Pixhack v3 (FMUv3)
        • CubePilot Cube Orange+ (CubePilot)
        • CubePilot Cube Orange (CubePilot)
        • CubePilot Cube Yellow (CubePilot)
        • Holybro Kakute H7v2
        • Holybro Kakute H7mini
        • Holybro Kakute H7
        • Holybro Durandal
        • Holybro Pix32 v5
        • ModalAI Flight Core v1
        • ModalAI VOXL Flight
        • ModalAI VOXL 2
        • mRobotics-X2.1 (FMUv2)
        • mRo Control Zero F7)
        • NXP RDDRONE-FMUK66 FMU
        • Sky-Drones AIRLink
        • SPRacing SPRacingH7EXTREME
        • ThePeach FCC-K1
        • ThePeach FCC-R1
      • Experimental Autopilots
        • BeagleBone Blue
        • Raspberry Pi 2/3 Navio2
        • Raspberry Pi 2/3/4 PilotPi
          • PilotPi with Raspberry Pi OS
          • PilotPi with Ubuntu Server
      • Discontinued Autopilots/Vehicles
        • Drotek Dropix (FMUv2)
        • Omnibus F4 SD
        • BetaFPV Beta75X 2S Brushless Whoop
        • Bitcraze Crazyflie 2.0
        • Aerotenna OcPoC-Zynq Mini
        • CUAV v5
        • Holybro Kakute F7 (Discontinued)
        • Holybro Pixfalcon
        • Holybro pix32 (FMUv2)
        • mRo AUAV-X2
        • 3DR Pixhawk 1
        • Snapdragon Flight
        • Intel® Aero RTF Drone (Discontinued)
      • Pixhawk Autopilot Bus (PAB) & Carriers
        • ARK Electronics Pixhawk Autopilot Bus Carrier
    • Flight Controller Peripherals
      • ADSB/FLARM (Traffic Avoidance)
      • Air Traffic Avoidance: ADSB/FLARM
      • Air Traffic Avoidance: UTM
      • Airspeed Sensors
        • TFSlot Airspeed Sensor
      • Barometers
      • Camera
      • Distance Sensors (Rangefinders)
        • Lightware SFxx Lidar
        • Ainstein US-D1 Standard Radar Altimeter
        • LeddarOne Lidar
        • Benewake TFmini Lidar
        • Lidar-Lite
        • TeraRanger
        • Lanbao PSK-CM8JL65-CC5
        • Avionics Anonymous Laser Altimeter UAVCAN Interface
      • ESCs & Motors
        • PWM ESCs and Servos
        • DShot ESCs
        • OneShot ESCs and Servos
        • DroneCAN ESCs
          • Zubax Telega
          • PX4 Sapog ESC Firmware
            • Holybro Kotleta
            • Zubax Orel
        • VESC
      • TBS Crossfire (CRSF) Telemetry
      • FrSky Telemetry
      • Gimbal (Mount) Configuration
      • GPS/Compass
        • ARK GPS
        • Holybro DroneCAN M8N GPS
        • LOCOSYS Hawk A1 GNSS
        • Hex Here2
        • Holybro M8N & M9N GPS
        • Sky-Drones SmartAP GPS
      • Grippers
        • Servo Gripper
      • Optical Flow
        • ARK Flow
        • PMW3901
        • PX4FLOW (Deprecated)
      • Precision Landing
      • Parachute
      • Power Modules/PDB
        • CUAV HV pm
        • CUAV CAN PMU
        • Holybro PM02
        • Holybro PM07
        • Holybro PM06 V2
        • Holybro PM02D (digital)
        • Holybro PM03D (digital)
        • Pomegranate Systems Power Module
        • Sky-Drones SmartAP PDB
      • Satellite Coms (Iridium/RockBlock)
      • Telemetry Radios
        • SiK Radio
          • RFD900 (SiK) Telemetry Radio
          • HolyBro (SIK) Telemetry Radio
        • Telemetry Wifi
          • ESP8266 WiFi Module
          • ESP32 WiFi Module
          • 3DR Telemetry Wifi (Discontinued)
        • Microhard Serial Telemetry Radio
          • ARK Electron Microhard Serial Telemetry Radio
          • Holybro Microhard P900 Telemetry Radio
        • CUAV P8 Telemetry Radio
        • HolyBro XBP9X - Discontinued
      • RTK GPS
        • ARK RTK GPS
        • RTK GPS Heading with Dual u-blox F9P
        • CUAV C-RTK
        • CUAV C-RTK2 PPK/RTK GNSS
        • CUAV C-RTK 9Ps
        • Femtones MINI2 Receiver
        • Freefly RTK GPS
        • Holybro H-RTK-F9P
        • Holybro H-RTK-M8P
        • Holybro H-RTK Unicore UM982 GPS
        • Locosys Hawk R1
        • Locosys Hawk R2
        • Septentrio AsteRx-RIB
        • Septentrio mosaic-go
        • Trimble MB-Two
        • CubePilot Here+ (Discontined)
      • Remote ID
      • Smart Batteries
        • Rotoye Batmon Battery Smartification Kit
      • Tachometers (Revolution Counters)
        • ThunderFly TFRPM01 Tachometer Sensor
      • I2C Peripherals
        • I2C bus accelerators
        • TFI2CADT01 I2C address translator
      • CAN Peripherals
      • DroneCAN Peripherals
        • PX4 DroneCAN Firmware
        • ARK CANnode
    • Companion Computers
      • Pixhawk + Companion Setup
        • RasPi Pixhawk Companion
      • Companion Computer Peripherals
      • Holybro Pixhawk RPI CM4 Baseboard
      • Auterion Skynode
      • Computer Vision
        • Obstacle Avoidance
        • Safe Landing
        • Collision Prevention
        • Path Planning Interface
        • Motion Capture (MoCap)
        • Visual Inertial Odometry (VIO)
          • Realsense T265 Tracking Camera (VIO)
      • Video Streaming
  • Development
    • Getting Started
      • Recommended Hardware/Setup
      • Toolchain Installation
        • MacOS Setup
        • Ubuntu Setup
        • Windows Setup
        • Visual Studio Code IDE
        • Other/Generic Tools
      • Building the Code
      • Writing your First Application
      • Application/Module Template
    • Concepts
      • PX4 Architecture
      • PX4 Flight Stack Architecture
        • Controller Diagrams
      • Events Interface
      • Flight Modes
      • Flight Tasks
      • Control Allocation
      • PWM limit state machine
      • System Startup
      • SD Card Layout
    • Simulation
      • jMAVSim Simulation
        • Multi-Vehicle Sim with JMAVSim
      • Gazebo Simulation
        • Vehicles
        • Multi-Vehicle Sim
      • Gazebo Classic Simulation
        • Vehicles
        • Worlds
        • Multi-Vehicle Sim
      • FlightGear Simulation
        • FlightGear Vehicles
        • Multi-Vehicle Sim with FlightGear
      • JSBSim Simulation
      • AirSim Simulation
      • Multi-Vehicle Simulation
      • Simulate Failsafes
      • HITL Simulation
      • Simulation-In-Hardware
    • Hardware
      • Flight Controller Reference Design
      • Manufacturer’s Board Support Guide
      • Flight Controller Porting Guide
        • PX4 Board Configuration (kconfig)
        • NuttX Board Porting Guide
      • Serial Port Mapping
      • Airframes
        • Adding a New Airframe
      • Device Drivers
      • Telemetry Radio
        • SiK Radio
      • Sensor and Actuator I/O
        • DroneCAN
        • I2C Bus
        • UART/Serial Ports
          • Port-Configurable Serial Drivers
      • RTK GPS (Integration)
    • Middleware
      • uORB Messaging
      • uORB Graph
      • uORB Message Reference
        • ActionRequest
        • ActuatorArmed
        • ActuatorControlsStatus
        • ActuatorMotors
        • ActuatorOutputs
        • ActuatorServos
        • ActuatorServosTrim
        • ActuatorTest
        • AdcReport
        • Airspeed
        • AirspeedValidated
        • AirspeedWind
        • AutotuneAttitudeControlStatus
        • BatteryStatus
        • ButtonEvent
        • CameraCapture
        • CameraStatus
        • CameraTrigger
        • CellularStatus
        • CollisionConstraints
        • CollisionReport
        • ControlAllocatorStatus
        • Cpuload
        • DebugArray
        • DebugKeyValue
        • DebugValue
        • DebugVect
        • DifferentialPressure
        • DistanceSensor
        • Ekf2Timestamps
        • EscReport
        • EscStatus
        • EstimatorAidSource1d
        • EstimatorAidSource2d
        • EstimatorAidSource3d
        • EstimatorBias
        • EstimatorBias3d
        • EstimatorEventFlags
        • EstimatorGpsStatus
        • EstimatorInnovations
        • EstimatorSelectorStatus
        • EstimatorSensorBias
        • EstimatorStates
        • EstimatorStatus
        • EstimatorStatusFlags
        • Event
        • FailsafeFlags
        • FailureDetectorStatus
        • FollowTarget
        • FollowTargetEstimator
        • FollowTargetStatus
        • GeneratorStatus
        • GeofenceResult
        • GimbalControls
        • GimbalDeviceAttitudeStatus
        • GimbalDeviceInformation
        • GimbalDeviceSetAttitude
        • GimbalManagerInformation
        • GimbalManagerSetAttitude
        • GimbalManagerSetManualControl
        • GimbalManagerStatus
        • GpioConfig
        • GpioIn
        • GpioOut
        • GpioRequest
        • GpsDump
        • GpsInjectData
        • Gripper
        • HealthReport
        • HeaterStatus
        • HomePosition
        • HoverThrustEstimate
        • InputRc
        • InternalCombustionEngineStatus
        • IridiumsbdStatus
        • IrlockReport
        • LandingGear
        • LandingGearWheel
        • LandingTargetInnovations
        • LandingTargetPose
        • LaunchDetectionStatus
        • LedControl
        • LogMessage
        • LoggerStatus
        • MagWorkerData
        • MagnetometerBiasEstimate
        • ManualControlSetpoint
        • ManualControlSwitches
        • MavlinkLog
        • MavlinkTunnel
        • Mission
        • MissionResult
        • ModeCompleted
        • MountOrientation
        • NavigatorMissionItem
        • NormalizedUnsignedSetpoint
        • NpfgStatus
        • ObstacleDistance
        • OffboardControlMode
        • OnboardComputerStatus
        • OrbTest
        • OrbTestLarge
        • OrbTestMedium
        • OrbitStatus
        • ParameterUpdate
        • Ping
        • PositionControllerLandingStatus
        • PositionControllerStatus
        • PositionSetpoint
        • PositionSetpointTriplet
        • PowerButtonState
        • PowerMonitor
        • PpsCapture
        • PwmInput
        • Px4ioStatus
        • QshellReq
        • QshellRetval
        • RadioStatus
        • RateCtrlStatus
        • RcChannels
        • RcParameterMap
        • Rpm
        • RtlTimeEstimate
        • SatelliteInfo
        • SensorAccel
        • SensorAccelFifo
        • SensorBaro
        • SensorCombined
        • SensorCorrection
        • SensorGnssRelative
        • SensorGps
        • SensorGyro
        • SensorGyroFft
        • SensorGyroFifo
        • SensorHygrometer
        • SensorMag
        • SensorOpticalFlow
        • SensorPreflightMag
        • SensorUwb
        • SensorSelection
        • SensorsStatus
        • SensorsStatusImu
        • SystemPower
        • TakeoffStatus
        • TaskStackInfo
        • TecsStatus
        • TelemetryStatus
        • TiltrotorExtraControls
        • TimesyncStatus
        • TrajectoryBezier
        • TrajectorySetpoint
        • TrajectoryWaypoint
        • TransponderReport
        • TuneControl
        • UavcanParameterRequest
        • UavcanParameterValue
        • UlogStream
        • UlogStreamAck
        • UwbDistance
        • UwbGrid
        • VehicleAcceleration
        • VehicleAirData
        • VehicleAngularAccelerationSetpoint
        • VehicleAngularVelocity
        • VehicleAttitude
        • VehicleAttitudeSetpoint
        • VehicleCommand
        • VehicleCommandAck
        • VehicleConstraints
        • VehicleControlMode
        • VehicleGlobalPosition
        • VehicleImu
        • VehicleImuStatus
        • VehicleLandDetected
        • VehicleLocalPosition
        • VehicleLocalPositionSetpoint
        • VehicleMagnetometer
        • VehicleOdometry
        • VehicleOpticalFlow
        • VehicleOpticalFlowVel
        • VehicleRatesSetpoint
        • VehicleRoi
        • VehicleStatus
        • VehicleThrustSetpoint
        • VehicleTorqueSetpoint
        • VehicleTrajectoryBezier
        • VehicleTrajectoryWaypoint
        • VtolVehicleStatus
        • Wind
        • YawEstimatorStatus
      • MAVLink Messaging
      • uXRCE-DDS (PX4-ROS 2/DDS Bridge)
    • Modules & Commands
      • Autotune
      • Commands
      • Communication
      • Controllers
      • Drivers
        • Airspeed Sensor
        • Baro
        • Distance Sensor
        • IMU
        • INS
        • Magnetometer
        • Optical Flow
        • Rpm Sensor
        • Transponder
      • Estimators
      • Simulations
      • System
      • Template
    • Debugging/Logging
      • FAQ
      • Consoles/Shells
        • MAVLink Shell
        • System Console
      • Debugging with GDB
        • SWD Debug Port
        • JLink Probe
        • Black Magic/DroneCode Probe
        • STLink Probe
        • Hardfault Debugging
      • Debugging with Eclipse
      • Failure Injection
      • Sensor/Topic Debugging
      • Simulation Debugging
      • Sending Debug Values
      • System-wide Replay
      • Profiling
      • Binary Size Profiling
      • Logging
      • Flight Log Analysis
      • ULog File Format
    • Tutorials
      • Long-distance Video Streaming
      • Connecting an RC Receiver on Linux
    • Advanced Topics
      • Parameters & Configs
      • Package Delivery Architecture
      • Computer Vision
        • Motion Capture (VICON, Optitrack, NOKOV)
      • Installing driver for Intel RealSense R200
      • Switching State Estimators
      • Out-of-Tree Modules
      • STM32 Bootloader
      • System Tunes
      • Advanced Linux Installation Cases
      • Windows Cygwin Toolchain Maintenance
      • Unsupported Developer Setup
        • CentOS Linux
        • Arch Linux
        • Windows VM Toolchain
        • Windows Cygwin Toolchain
        • Qt Creator IDE
    • Platform Testing and CI
      • Test Flights
        • Test MC_01 - Manual Modes
        • Test MC_02 - Full Autonomous
        • Test MC_03 - Auto Manual Mix
        • Test MC_04 - Failsafe Testing
        • Test MC_05 - Indoor Flight (Manual Modes)
      • Unit Tests
      • Continuous Integration
      • MAVSDK Integration Testing
      • ROS Integration Testing
      • Docker Containers
      • Maintenance
  • Drone Apps & APIs
    • Offboard Control from Linux
    • ROS
      • ROS 2
        • ROS 2 User Guide
        • ROS 2 Offboard Control Example
        • ROS 2 Multi Vehicle Simulation
      • ROS 1 with MAVROS
        • ROS/MAVROS Installation Guide
        • ROS/MAVROS Offboard Example (C++)
        • ROS/MAVROS Offboard Example (Python)
        • ROS/MAVROS Sending Custom Messages
        • ROS/MAVROS with Gazebo Classic Simulation
        • Gazebo Classic OctoMap Models with ROS 1
        • ROS/MAVROS Installation on RPi
        • External Position Estimation (Vision/Motion based)
    • DroneKit
  • Contribution (&Dev Call)
    • Dev Call
    • Support
    • Source Code Management
      • GIT Examples
    • Documentation
    • Translation
    • Terminology/Notation
    • Licenses
  • Releases
    • 1.14
    • 1.13
    • 1.12
Powered by GitBook
On this page
  • Architecture
  • Code Generation
  • Micro XRCE-DDS Agent Installation
  • Install Standalone from Source
  • Install from Snap Package
  • Build/Run within ROS 2 Workspace
  • Starting Agent and Client
  • Starting the Agent
  • Starting the Client
  • Supported uORB Messages
  • Customizing the Topic Namespace
  • PX4 ROS 2 QoS Settings
  • DDS Topics YAML
  • Fast-RTPS to uXRCE-DDS Migration Guidelines
  • Helpful Resources
  1. Development
  2. Middleware

uXRCE-DDS (PX4-ROS 2/DDS Bridge)

PreviousMAVLink MessagingNextModules & Commands

Last updated 1 year ago

:::note uXRCE-DDS replaces the used in PX4 v1.13. If you were using the Fast-RTPS Bridge, please follow the . :::

PX4 uses uXRCE-DDS middleware to allow to be published and subscribed on a companion computer as though they were topics. This provides a fast and reliable integration between PX4 and ROS 2, and makes it much easier for ROS 2 applications to get vehicle information and send commands.

PX4 uses an XRCE-DDS implementation that leverages .

The following guide describes the architecture and various options for setting up the client and agent. In particular it covers the options that are most important to PX4 users.

Architecture

The uXRCE-DDS middleware consists of a client running on PX4 and an agent running on the companion computer, with bi-directional data exchange between them over a serial or UDP link. The agent acts as a proxy for the client, enabling it to publish and subscribe to topics in the global DDS data space.

In order for PX4 uORB topics to be shared on the DDS network you will need uXRCE-DDS client running on PX4, connected to the micro XRCE-DDS agent running on the companion.

The agent itself has no dependency on client-side code and can be built and/or installed independent of PX4 or ROS.

Code that wants to subscribe/publish to PX4 does have a dependency on client-side code; it requires uORB message definitions that match those used to create the PX4 uXRCE-DDS client so that it can interpret the messages.

Code Generation

Micro XRCE-DDS Agent Installation

The Micro XRCE-DDS Agent can be installed on the companion computer using a binary package, built and installed from source, or built and run from within a ROS 2 workspace. All of these methods fetch all the dependencies needed to communicate with the client (such as FastCDR)

Install Standalone from Source

On Ubuntu you can build from source and install the Agent standalone using the following commands:

git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
cd Micro-XRCE-DDS-Agent
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/

To start the agent with settings for connecting to the uXRCE-DDS client running on the simulator:

MicroXRCEAgent udp4 -p 8888

Install from Snap Package

Install from a snap package on Ubuntu using the following command:

sudo snap install micro-xrce-dds-agent --edge

To start the agent with settings for connecting to the uXRCE-DDS client running on the simulator (note that the command name is different than if you build the agent locally):

micro-xrce-dds-agent udp4 -p 8888

:::note At time of writing the stable of version installed from snap connects to PX4 but reports errors creating topics. The development version, fetched using --edge above, does work. :::

Build/Run within ROS 2 Workspace

To build the agent within ROS:

  1. Create a workspace directory for the agent:

    mkdir -p ~/px4_ros_uxrce_dds_ws/src
  2. cd ~/px4_ros_uxrce_dds_ws/src
    git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
  3. Source the ROS 2 development environment, and compile the workspace using colcon:

    :::: tabs

    ::: tab humble

    source /opt/ros/humble/setup.bash
    colcon build

    :::

    ::: tab foxy

    source /opt/ros/foxy/setup.bash
    colcon build

    :::

    ::::

    This builds all the folders under /src using the sourced toolchain.

To run the micro XRCE-DDS agent in the workspace:

  1. Source the local_setup.bash to make the executables available in the terminal (also setup.bash if using a new terminal).

    :::: tabs

    ::: tab humble

    source /opt/ros/humble/setup.bash
    source install/local_setup.bash

    :::

    ::: tab foxy

    source /opt/ros/foxy/setup.bash
    source install/local_setup.bash

    :::

    ::::

  2. Start the agent with settings for connecting to the uXRCE-DDS client running on the simulator:

    MicroXRCEAgent udp4 -p 8888

Starting Agent and Client

Starting the Agent

:::note You should create a single instance of the agent for each channel over which you need to connect. :::

For example, the PX4 simulator runs the uXRCE-DDS client over UDP on port 8888, so to connect to the simulator you would start the agent with the command:

MicroXRCEAgent udp4 -p 8888
sudo MicroXRCEAgent serial --dev /dev/AMA0 -b 921600

Starting the Client

:::note The simulator automatically starts the client on localhost UDP port 8888 using the default uxrce-dds namespace. :::

  • If using an Ethernet connection:

      • To obtain the int32 version of an IP in decimal dot notation the command is:

        python3 ./PX4-Autopilot/Tools/convert_ip.py <the IP address in decimal dot notation>
      • To get the IP address in decimal dot notation from the int32 version:

        python3 ./PX4-Autopilot/Tools/convert_ip.py -r <the IP address in int32 notation>
  • If using a serial connection:

  • Some setups might also need these parameters to be set:

:::note Many ports are already have a default configuration. To use these ports you must first disable the existing configuration:

Once set, you may need to reboot PX4 for the parameters to take effect. They will then persist through subsequent reboots.

uxrce_dds_client start -t udp -p 8888 -h 192.168.0.100 -n drone

Options -p or -h are used to bypass UXRCE_DDS_PRT and UXRCE_DDS_AG_IP.

Starting the Client in Simulation

For example, the following command can be used to start a Gazebo simulation with che client operating on the DDS domain 3, port 9999 and topic namespace drone.

ROS_DOMAIN_ID=3 PX4_UXRCE_DDS_PORT=9999 PX4_UXRCE_DDS_NS=drone make px4_sitl gz_x500

Supported uORB Messages

  • rm ~/px4_ros_com/src/px4_msgs/msg/*.msg
    cp ~/PX4-Autopilot/mgs/*.msg ~/px4_ros_com/src/px4_msgs/msg/

Customizing the Topic Namespace

  • A custom namespace can be provided for simulations (only) by setting the environment variable PX4_UXRCE_DDS_NS before starting the simulation.

uxrce_dds_client start -n uav_1

or

PX4_UXRCE_DDS_NS=uav_1 make px4_sitl gz_x500

will generate topics under the namespaces:

/uav_1/fmu/in/  # for subscribers
/uav_1/fmu/out/ # for publishers

:::

PX4 ROS 2 QoS Settings

PX4 uses the following QoS settings for publishers:

uxrQoS_t qos = {
  .durability = UXR_DURABILITY_TRANSIENT_LOCAL,
  .reliability = UXR_RELIABILITY_BEST_EFFORT,
  .history = UXR_HISTORY_KEEP_LAST,
  .depth = 0,
};

PX4 uses the following QoS settings for subscribers:

uxrQoS_t qos = {
  .durability = UXR_DURABILITY_VOLATILE,
  .reliability = UXR_RELIABILITY_BEST_EFFORT,
  .history = UXR_HISTORY_KEEP_LAST,
  .depth = queue_depth,
};

ROS 2 uses the following QoS settings (by default) for publishers and subscriptions: "keep last" for history with a queue size of 10, "reliable" for reliability, "volatile" for durability, and "system default" for liveliness. Deadline, lifespan, and lease durations are also all set to "default".

DDS Topics YAML

The file is structured as follows:

publications:

  - topic: /fmu/out/collision_constraints
    type: px4_msgs::msg::CollisionConstraints

  ...

  - topic: /fmu/out/vehicle_odometry
    type: px4_msgs::msg::VehicleOdometry

  - topic: /fmu/out/vehicle_status
    type: px4_msgs::msg::VehicleStatus

  - topic: /fmu/out/vehicle_trajectory_waypoint_desired
    type: px4_msgs::msg::VehicleTrajectoryWaypoint

subscriptions:

  - topic: /fmu/in/offboard_control_mode
    type: px4_msgs::msg::OffboardControlMode

  ...

  - topic: /fmu/in/vehicle_trajectory_waypoint
    type: px4_msgs::msg::VehicleTrajectoryWaypoint

Each (topic,type) pairs defines:

  1. A new subscription or publication depending on the list to which it is added.

  2. The topic base name, which must coincide with the desired uORB topic name that you want to publish/subscribe. It is identified by the last token in topic: that starts with / and does not contains any / in it. vehicle_odometry, vehicle_status and offboard_control_mode are examples of base names.

    • /fmu/out/ for topics that are published by PX4.

    • /fmu/in/ for topics that are subscribed by PX4.

  3. The message type (VehicleOdometry, VehicleStatus, OffboardControlMode, etc.) and the ROS 2 package (px4_msgs) that is expected to provide the message definition.

You can arbitrarily change the configuration. For example, you could use different default namespaces or use a custom package to store the message definitions.

Fast-RTPS to uXRCE-DDS Migration Guidelines

:::note This section contains migration-specific information. You should also read the rest of this page to properly understand uXRCE-DDS. :::

Dependencies do not need to be removed

If you do choose to remove the dependencies, take care not to remove anything that is used by applications (for example, Java).

_rtps targets have been removed

Anywhere you previously used a build target with extension _rtps, such as px4_fmu-v5_rtps or px4_sitl_rtps, you can now use the equivalent default target (for these cases px4_fmu-v5_default and px4_sitl_default).

The make targets with extension _rtps were used to build firmware that included client side RTPS code. The uXRCE-DDS middleware is included by default in builds for most boards, so you no longer need a special firmware to work with ROS 2.

New client module and new start parameters

New file for setting which topics are published

Topics no longer need to be synced between client and agent.

The list of bridged topics between agent and client no longer needs to be synced for ROS 2, so the update_px4_ros2_bridge.sh script is no longer needed.

Default topic naming convention has changed

The topic naming format changed:

  • Published topics: /fmu/topic-name/out (Fast-RTPS) to /fmu/out/topic-name (XRCE-DDS).

  • Subscribed topics: /fmu/topic-name/in(Fast-RTPS) to /fmu/in/topic-name (XRCE-DDS).

You should update your application to the new convention.

XRCE-DDS-Agent

Application-Specific Changes

In your ROS 2 nodes, you will need to:

  • Remove everything related to time synchronization, as XRCE-DDS automatically takes care of agent/client time synchronization.

    In C++ applications you can set the timestamp field of your messages like this:

    msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;

    In Python applications you can set the timestamp field of your messages like this:

    msg.timestamp = int(self.get_clock().now().nanoseconds / 1000)

Helpful Resources

The PX4 publishes to/from a defined set of uORB topics to the global DDS data space.

The runs on the companion computer and acts as a proxy for the client in the DDS/ROS 2 network.

The PX4 is generated at build time and included in PX4 firmare by default. The agent has no dependency on client code. It can be built standalone or in a ROS 2 workspace, or installed as a snap package on Ubuntu.

When PX4 is built, a code generator uses the uORB message definitions in the source tree () to compile support for the subset of uORB topics in into .

PX4 main or release builds automatically export the set of uORB messages definitions in the build to an associated branch in .

ROS 2 applications need to be built in a workspace that includes the same message definitions that were used to create the uXRCE-DDS client module in the PX4 Firmware. These can be included into a workspace by cloning the interface package into your ROS 2 workspace and switching to the appropriate branch. Note that all code generation associated with the messages is handled by ROS 2.

:::note The official (and more complete) installation guide is the Eprosima: . This section summarises the options that have been tested with PX4 during creation of these docs. :::

:::note There are various build configuration options linked from the corresponding topic in the , but these have not been tested. :::

The agent can be built and launched within a ROS 2 workspace (or build standalone and launched from a workspace. You must already have installed ROS 2 following the instructions in: .

Clone the source code for the eProsima to the /src directory (the main branch is cloned by default):

The agent is used to connect to the client over a particular channel, such as UDP or a serial connection. The channel settings are specified when the agent is started, using command line options. These are documented in the eProsima user guide: . Note that the agent supports many channel options, but PX4 only supports UDP and serial connections.

When working with real hardware, the setup depends on the hardware, OS, and channel. For example, if you're using the RasPi UART0 serial port, you might connect using this command (based on the information in ):

:::note For more information about setting up communications channels see , and sub-documents. :::

The uXRCE-DDS client module () is included by default in all firmware and the simulator. This must be started with appropriate settings for the communication channel that you wish to use to communicate with the agent.

The configuration can be done using the :

: Set the port to connect on, such as TELEM2, Ethernet, or Wifi.

: Use this to specify the agent UDP listening port. The default value is 8888.

: Use this to specify the IP address of the agent. The IP address must be provided in int32 format as PX4 does not support string parameters. The default value is 2130706433 which corresponds to the localhost 127.0.0.1.

You can use to convert between the formats:

, (and so on): Use the _BAUD parameter associated with the serial port to set the baud rate. For example, you'd set a value for SER_TEL2_BAUD if you are connecting to the companion using TELEM2. For more information see .

: The uXRCE-DDS key. If you're working in a multi-client, single agent configuration, each client should have a unique non-zero key. This is primarily important for multi-vehicle simulations, where all clients are connected in UDP to the same agent. (See the , uxr_init_session.)

: The DDS domain ID. This provides a logical separation between DDS networks, and can be used to separate clients on different networks. By default, ROS 2 operates on ID 0.

TELEM1 and TELEM2 are set up by default to connect via MAVLink to a GCS and a companion computer (respectively). Disable by setting or to zero. See for more information.

Other ports can similarly be configured. See . :::

You can also start the using a command line. This can be called as part of or through the (or a system console). This method is useful when you need to set a custom client namespace, as no parameter is provided for this purpose. For example, the following command can be used to connect via Ethernet to a remote host at 192.168.0.100:8888 and to set the client namespace to /drone/.

The simulator () uses the client startup commands for single and , enabling the setting of appropriate instance ids and DDS namespaces. By default the client is started on localhost UDP port 8888 with no additional namespace.

Environment variables are provided that override some . These allow users to create custom startup files for their simulations:

PX4_UXRCE_DDS_NS: Use this to specify the topic .

ROS_DOMAIN_ID: Use this to replace .

PX4_UXRCE_DDS_PORT: Use this to replace .

The set of that are exposed through the client are set in .

The topics are release specific (support is compiled into at build time). While most releases should support a very similar set of messages, to be certain you would need to check the yaml file for your particular release.

Note that ROS 2/DDS needs to have the same message definitions that were used to create the uXRCE-DDS client module in the PX4 Firmware in order to interpret the messages. The message definitions are stored in the ROS 2 interface package , and they are automatically synchronized by CI on the main and release branches. Note that all the messages from PX4 source code are present in the repository, but only those listed in dds_topics.yaml will be available as ROS 2 topics. Therefore,

If you're using a main or release version of PX4 you can get the message definitions by cloning the interface package into your workspace.

If you're creating or modifying uORB messages you must manually update the messages in your workspace from your PX4 source tree. Generally this means that you would update , clone the interface package, and then manually synchronize it by copying the new/modified message definitions from to its msg folders. Assuming that PX4-Autopilot is in your home directory ~, while px4_msgs is in ~/px4_ros_com/src/, then the command might be:

:::note Technically, completely defines the relationship between PX4 uORB topics and ROS 2 messages. For more information see below. :::

Custom topic namespaces can be applied at build time (changing ) or at runtime (which is useful for multi vehicle operations):

One possibility is to use the -n option when starting the from command line. This technique can be used both in simulation and real vehicles.

:::note Changing the namespace at runtime will append the desired namespace as a prefix to all topic fields in . Therefore, commands like:

PX4 QoS settings for publishers are incompatible with the default QoS settings for ROS 2 subscribers. So if ROS 2 code needs to subscribe to a uORB topic, it will need to use compatible QoS settings. One example of which is shown in .

The PX4 yaml file defines the set of PX4 uORB topics that are built into firmware and published. More precisely, it completely defines the relationship/pairing between PX4 uORB and ROS 2 messages.

The topic . By default it is set to:

These guidelines explain how to migrate from using PX4 v1.13 middleware to PX4 v1.14 uXRCE-DDS middleware. These are useful if you have , or you have used Fast-RTPS to interface your applications to PX4 .

uXRCE-DDS does not need the dependencies that were required for Fast-RTPS, such as those installed by following the topic . You can keep them if you want, without affecting your uXRCE-DDS applications.

To check if your board has the middleware, look for CONFIG_MODULES_UXRCE_DDS_CLIENT=y in the .px4board file of your board. Those files are nested in .

If it is not present, or if it is set to n, then you have to clone the PX4 repo, modify the board configuration and manually the firmware.

As the client is implemented by a new PX4 module, you now have new parameters to start it. Take a look at the to learn how this is done.

The list of topics that are published and subscribed for a particular firmware is now managed by the configuration file, which replaces

See and sections for more information.

:::note You might also edit to revert to the old convention. This is not recommended because it means that you would have to always use custom firmware. :::

The XRCE-DDS agent is "generic" and independent of PX4: . There are many ways to install it on your PC / companion computer - for more information see the .

If you where not using ROS 2 alongside the agent (), then you need to migrate to .

ROS 2 applications still need to compile alongside the PX4 messages, which you do by adding the package to your workspace. You can remove the package as it is no longer needed, other than for example code.

Update the of your publishers and subscribers as PX4 does not use the ROS 2 default settings.

Change the names of your topics, unless you edited .

- Pablo Garrido & Nuno Marques (youtube)

(Github gist - JulianOes)

(Jaeyoung-Lim).

eProsima micro XRCE-DDS agent
PX4/px4_msgs
PX4/px4_msgs
micro XRCE-DDS Installation Guide
official guide
Micro-XRCE-DDS-Agent
Micro XRCE-DDS Agent > Agent CLI
Raspberry Pi Documentation > Configuring UARTS
Tools/convert_ip.py
startup logic
init.d-posix/rcS
multi vehicle simulations
PX4 uORB topics
dds_topics.yaml
PX4/px4_msgs
PX4/px4_msgs
dds_topics.yaml
PX4-Autopilot/msg
dds_topics.yaml
dds_topics.yaml
dds_topics.yaml
namespace
Fast-RTPS
ROS 2 applications written for PX4 v1.13
directly
Fast DDS Installation
PX4-Autopilot/boards
compile
dds_topic.yaml
urtps_bridge_topics.yaml
dds_topic.yaml
Fast DDS Interface ROS-Independent
eProsima Fast DDS
px4_msgs
px4_ros_com
dds_topic.yaml
ROS 2 in PX4: Technical Details of a Seamless Transition to XRCE-DDS
PX4 ROS 2 offboard tutorial
ROS 2 PX4 Offboard Tutorial
namespace
dds_topics.yaml
DDS Topics YAML
client startup section
Supported uORB Messages
DDS Topics YAML
micro-xrce-dds-agent
dedicated section
QoS
Fast-RTPS Bridge
uORB messages
ROS 2
eProsima Micro XRCE-DDS
migration guidelines
PX4-Autopilot/msg
PX4-Autopilot/src/modules/uxrce_dds_client/dds_topics.yaml
official eprosima documentation
MAVLink Peripherals
System Startup
MAVLink Shell
Serial port configuration
Serial port configuration
Pixhawk + Companion Setup > Serial Port setup
Architecture uXRCE-DDS with ROS 2
uxrce_dds_client
uxrce_dds_client
uxrce_dds_client
uxrce_dds_client
uxrce_dds_client
uxrce_dds_client
uxrce_dds_client
ROS 2 User Guide > Install ROS 2
ROS 2 User Guide > ROS 2 Subscriber QoS Settings
UXRCE-DDS parameters
UXRCE_DDS_CFG
UXRCE_DDS_PRT
UXRCE_DDS_AG_IP
SER_TEL2_BAUD
SER_URT6_BAUD
UXRCE_DDS_KEY
UXRCE_DDS_DOM_ID
MAV_0_CONFIG=0
MAV_1_CONFIG=0
UXRCE-DDS parameters
UXRCE_DDS_DOM_ID
UXRCE_DDS_PRT