Skip to content

Commit

Permalink
Introduce message versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeLaine authored and hamishwillee committed Dec 19, 2024
1 parent 1140acc commit 826b434
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions en/middleware/uorb.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,29 @@ Make sure not to mix `orb_advertise_multi` and `orb_advertise` for the same topi

The full API is documented in [platforms/common/uORB/uORBManager.hpp](https://github.com/PX4/PX4-Autopilot/blob/main/platforms/common/uORB/uORBManager.hpp).

## Message Versioning

<Badge type="tip" text="main (PX4 v1.16+)" />

Message versioning was introduced to address the challenges of maintaining compatibility across systems where different versions of message definitions may be in use, such as between PX4 and external systems like ROS 2 applications.

This versioning mechanism supports the [ROS 2 Message Translation Node](../ros2/px4_ros2_msg_translation_node.md), which enables seamless communication between PX4 and ROS 2 applications; when different versions of message definitions are in use, the ROS 2 translation node ensures that messages can be converted and exchanged correctly.

Versioned messages are stored in the `msg/versioned/` directory, distinct from their non-versioned counterparts, which reside directly in the `msg/` directory.
Each versioned message definition includes an additional field: `uint32 MESSAGE_VERSION = X`, where `X` corresponds to the current version of the message.
When a versioned message definition is modified, the version number should be incremented to reflect changes in its structure or semantics.
Additionally, [message translations](../ros2/px4_ros2_msg_translation_node.md#updating-a-message) must also be updated for versioned messages.

Versioned messages are designed to remain more stable over time compared to their non-versioned counterparts, as they are intended to be used across multiple releases of PX4 and external systems, ensuring greater compatibility over longer periods.

For the full list of versioned and non-versioned messages, refer to the full [uORB Message Reference](../msg_docs/index.md).

For more on PX4 and ROS 2 communication, refer to the page about the [PX4-ROS 2 Bridge](../ros/ros2_comm.md).

## Message/Field Deprecation {#deprecation}

(TODO: Is this section still relevant? Not seeing any `# DEPRECATED: ...` fields or msgs in latest PX4)

As there are external tools using uORB messages from log files, such as [Flight Review](https://github.com/PX4/flight_review), certain aspects need to be considered when updating existing messages:

- Changing existing fields or messages that external tools rely on is generally acceptable if there are good reasons for the update.
Expand Down
3 changes: 2 additions & 1 deletion en/releases/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
Mission commands that may take some time to complete, such as those for controlling gimbals, winches, and grippers, will progress to the next item when either feedback is received or the timeout expires.
This is often used to provide a minimum delay for hardware that does not provide completion feedback, so that it can reach the commanded state before the mission progresses.
([PX4-Autopilot#23960](https://github.com/PX4/PX4-Autopilot/pull/23960)).
- **[uORB]** Introduce a version field for a subset of uORB messages ([PX4-Autopilot#23850](https://github.com/PX4/PX4-Autopilot/pull/23850))

### Control

Expand Down Expand Up @@ -75,7 +76,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide).

### uXRCE-DDS / ROS2

- TBD
- **[Feature]** ROS 2 Translation Node to translate PX4 messages from one defintion version to another dynamically ([PX4-Autopilot#24113](https://github.com/PX4/PX4-Autopilot/pull/24113))

### MAVLink

Expand Down
3 changes: 3 additions & 0 deletions en/ros2/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ The generator uses the uORB message definitions in the source tree: [PX4-Autopil
ROS 2 applications need to be built in a workspace that has the _same_ message definitions that were used to create the uXRCE-DDS client module in the PX4 Firmware.
You can include these by cloning the interface package [PX4/px4_msgs](https://github.com/PX4/px4_msgs) into your ROS 2 workspace (branches in the repo correspond to the messages for different PX4 releases).

Starting from PX4 x.x.x in which [message versioning](../middleware/uorb.md#message-versioning) was introduced (TODO: specify PX4 version), ROS2 applications may use a different version of message definitions than those used to build PX4.
This requires the [ROS 2 Message Translation Node](../ros2/px4_ros2_msg_translation_node.md) to be running to ensure that messages can be converted and exchanged correctly.

Note that the micro XRCE-DDS _agent_ itself has no dependency on client-side code.
It can be built from [source](https://github.com/eProsima/Micro-XRCE-DDS-Agent) either standalone or as part of a ROS build, or installed as a snap.

Expand Down

0 comments on commit 826b434

Please sign in to comment.