uORB (Micro Object Request Broker) is PX4’s internal publish-subscribe message bus. Every piece of data that flows between modules — sensor readings, state estimates, setpoints, actuator commands — travels as a typed uORB message over this bus. The design is asynchronous: publishers write new data whenever it is ready, and subscribers are notified immediately without polling. This keeps the system reactive and ensures modules stay decoupled from one another.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.
How uORB works
uORB operates through shared memory. All PX4 modules run in a single address space (on NuttX), so publishing a message is a fast, lock-minimized write to a shared buffer. Subscribers register interest in a topic by its ID and can either poll for updates or be woken up by a callback when new data arrives. The bus is started automatically early in the PX4 boot sequence withuorb start. You can inspect live topic activity at any time:
Message definitions
Every uORB topic is defined by a.msg file in the msg/ directory. The build system automatically generates the C/C++ headers from these definitions, so you never write serialization code by hand.
A message definition file uses CamelCase naming (e.g., VehicleLocalPosition.msg) and maps to a snake_case topic ID (vehicle_local_position). The format is straightforward:
Supported field types
| Type | Description |
|---|---|
bool | Boolean (true/false) |
uint8, int8 | 8-bit integers |
uint16, int16 | 16-bit integers |
uint32, int32 | 32-bit integers |
uint64, int64 | 64-bit integers |
float32 | 32-bit IEEE float |
float64 | 64-bit IEEE float |
char | Single character |
TypeName[N] | Fixed-size array of N elements |
Multi-topic messages
One message definition can produce several topic IDs. This is useful when the same data structure is shared by multiple subsystems — for example,ActuatorOutputs.msg defines three topics at once:
Nested messages
Message definitions can reference other message types to build complex structures:Subscribing in C++
The recommended subscription API uses theuORB::Subscription template class. Call update() in your module’s update loop — it returns true only when new data has arrived since the last call.
uORB::SubscriptionCallbackWorkItem:
Publishing in C++
To publish a topic, declare auORB::Publication and call publish() with your populated struct:
Key topics reference
vehicle_local_position
vehicle_local_position
Published by
ekf2. Contains the vehicle’s estimated position and velocity in the local NED (North-East-Down) frame.Key fields: x, y, z (position in meters), vx, vy, vz (velocity in m/s), xy_valid, z_valid, v_xy_valid, v_z_valid.Consumed by: mc_pos_control, fw_pos_control, navigator, mavlink (telemetry stream).vehicle_attitude
vehicle_attitude
Published by
ekf2 (and attitude_estimator_q as a fallback). Contains the vehicle’s estimated orientation as a quaternion.Key fields: q[4] (unit quaternion, w-x-y-z order), timestamp, timestamp_sample.Consumed by: mc_att_control, fw_att_control, mavlink.sensor_combined
sensor_combined
Published by the sensor module. Contains pre-processed, calibrated IMU data (accelerometer and gyroscope) from the primary sensor.Key fields:
gyro_rad[3] (rad/s), accelerometer_m_s2[3] (m/s²), timestamp, gyro_integral_dt, accelerometer_integral_dt.Consumed by: ekf2, attitude_estimator_q, logging.actuator_outputs
actuator_outputs
Published by the output driver after mixing. Contains the final normalized output values (typically 0–1 for motors, -1–1 for servos) sent to hardware.Defined by multi-topic message: also creates
actuator_outputs_sim and actuator_outputs_debug.Consumed by: output drivers (PWM, DroneCAN), simulation bridges, logging.actuator_motors / actuator_servos
actuator_motors / actuator_servos
Published by the actuator allocation module. Contains the desired motor throttle and servo positions before output driver remapping. These are the post-mixing, pre-output-driver commands.Consumed by: PWM output driver, DroneCAN output driver.
Multi-instance topics
Some topics support multiple instances — for example, when a vehicle has more than one GPS receiver. UseuORB::SubscriptionMultiArray to subscribe to all instances simultaneously:
uORB::PublicationMulti:
Adding a new topic
Create the .msg file
Create a new file in
msg/ using CamelCase naming, e.g., MyNewTopic.msg. Include uint64 timestamp as the first field, then define your data fields with inline comments.Register in CMakeLists.txt
Add your new
.msg filename to msg/CMakeLists.txt in the alphabetically sorted list of message files.Include the generated header
After building, include the auto-generated header in your module source. The header name is the snake_case version of the message name.