# PX4 Messages in ROS 2

{% hint style="warning" %}
This is a preview feature which might change with AuterionOS 3.0
{% endhint %}

[uORB messages](https://docs.px4.io/main/en/middleware/uorb.html) published by the FMU can be made available to AuterionOS apps by enabling the [Micro XRCE-DDS](https://docs.px4.io/main/en/middleware/uxrce_dds.html) (uXRCE-DDS) bridge for use in [ROS 2 applications](https://docs.ros.org/en/rolling/index.html). The bridge supports communication in both directions, meaning ROS 2 applications can receive certain uORB topics from APX4, as well as send messages to the flight controller.

{% hint style="info" %}
Micro XRCE-DDS is supported in APX4 3.0 and later.
{% endhint %}

## Configuration

Drone Manufacturers need to follow the instructions linked below to *enable* Micro XRCE-DDS in AuterionOS:

{% content-ref url="../../hardware-integration/flight-controller-customization/micro-xrce-dds" %}
[micro-xrce-dds](https://docs.auterion.com/hardware-integration/flight-controller-customization/micro-xrce-dds)
{% endcontent-ref %}

{% hint style="success" %}
Please contact the vehicle manufacturer or <success@auterion.com> if you are developing an application for an Auterion-powered vehicle and require help with the setup of Micro XRCE-DDS.
{% endhint %}

## ROS 2 topic naming

When Micro XRCE-DDS is enabled, a pre-determined set of uORB topics coming from APX4 will be published in ROS 2. The ROS 2 topics are prefixed with `/fmu/out/`. For example, a ROS 2 node can receive `vehicle_odometry` uORB messages by subscribing to `/fmu/out/vehicle_odometry`.

Similarly, Micro XRCE-DDS subscribes to a set of ROS 2 topics to be published as uORB topics in the FMU. These ROS 2 topics are prefixed with `/fmu/in`. For example, a ROS 2 node can publish to the `vehicle_visual_odometry` uORB topic by publishing to `/fmu/in/vehicle_visual_odometry`.

## ROS 2 message definitions

The ROS 2 message headers are built from the (uORB) message definitions and are available by the **px4\_msgs** ROS 2 package: <https://github.com/PX4/px4_msgs>.

To ensure compatibility, the `./msg` directory of **px4\_msgs** that is being used to compile the AuterionOS application should have the same contents as the `./msg` directory of the APX4 firmware that is being used.
