# ROS 2

ROS 2 (opens new window) is the newest version of ROS (opens new window) (Robot Operating System), a general purpose robotics library that can be used with the PX4 Autopilot to create powerful drone applications. It captures most of the learnings and features of ROS 1, improving a number of flaws of the earlier version.

注意

Tip The PX4 development team highly recommend that you use/migrate to this version of ROS!

Communication between ROS 2 and PX4 uses middleware that implements the XRCE-DDS protocol. This middleware exposes PX4 uORB messages as ROS 2 messages and types, effectively allowing direct access to PX4 from ROS 2 workflows and nodes. The middleware uses UORB message definitions to generate code to serialise and deserialise the messages heading in and out of PX4. These same message definitions are used in ROS 2 applications to allow the messages to be interpretted.

The main topics in this section are:

注解

ROS 2 is officially supported only on Linux platforms. Ubuntu 20.04 LTS is the official supported distribution.

注解

To use the ROS 2 effectively you must (at time of writing) have a reasonable understanding of the PX4 internal architecture and conventions.

This contrasts with ROS 1, which communicates with PX4 via MAVROS/MAVLink, hiding PX4's internal architecture and many of its conventions (e.g. frame and unit conversions).

ROS 2 (and the bridge) will become easier to use as the development team provide ROS 2 APIs to abstract PX4 conventions, along with examples demonstrating their use. These are planned in the near-term PX4 roadmap.

# Further Reading/Information