uORB (micro Object Request Broker) is PX4's internal publish-subscribe messaging system. Every module communicates through uORB — sensor drivers publish data, estimators subscribe to sensors and publish state, controllers subscribe to state and publish actuator commands.
uORB uses shared memory with zero-copy semantics. Publishing writes to a ring buffer; subscribing reads from it. There is no serialization overhead — subscribers read the same memory the publisher wrote. This makes uORB extremely fast, suitable for the 1 kHz IMU data path.
Key properties
Asynchronous: publishers and subscribers are decoupled in time. Multi-subscriber: many modules can subscribe to the same topic. Single-publisher: each topic instance has one publisher (but a topic can have multiple instances, e.g. sensor_accel 0, 1, 2). Zero-copy: shared memory, no marshalling.
cpp
// Publishing a uORB message
#include <uORB/topics/vehicle_attitude.h>
#include <uORB/Publication.hpp>
uORB::Publication<vehicle_attitude_s> _attitude_pub{ORB_ID(vehicle_attitude)};
vehicle_attitude_s att{};
att.timestamp = hrt_absolute_time();
att.q[0] = 1.0f; // quaternion w
_attitude_pub.publish(att);cpp
// Subscribing to a uORB message
#include <uORB/topics/sensor_accel.h>
#include <uORB/Subscription.hpp>
uORB::Subscription _accel_sub{ORB_ID(sensor_accel)};
sensor_accel_s accel;
if (_accel_sub.updated()) {
_accel_sub.copy(&accel);
// accel.x, accel.y, accel.z in m/s²
}Topics are defined as .msg files in msg/. The build system generates C/C++ headers from these definitions. Each .msg file specifies field names, types, and optional comments. The uorb top command shows live topic publication rates.
bash
# Inspect live uORB traffic in the PX4 shell uorb top # show all topics with publication rates uorb top -1 # single snapshot listener sensor_accel # print values from a specific topic listener vehicle_attitude 5 # print 5 samples
uORB bridging to ROS 2
The uXRCE-DDS bridge (px4_micro_xrce_dds_client) transparently publishes selected uORB topics as ROS 2 topics via the XRCE-DDS middleware. This is the recommended way to get PX4 data into ROS 2 nodes on a companion computer.