ros2: fix size of publisher/subscription GIDs #94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is related to (and is needed after) ros2/ros2_tracing#138.
ROS 2 publishers and subscriptions have unique IDs called GIDs (global IDs), which is part of the ROS 2 middleware interface (
rmw
). Their values are based on the corresponding objects in the underlying middleware, usually the GUID (globally unique ID) of the DDS data writer and data reader.Historically, the ROS 2 (
rmw
) GID was a 24-byte array, while the DDS GUIDs are usually 16-byte arrays, at least for the "main" DDS implementations (Fast DDS, Cyclone DDS, Connext DDS). Thermw
GID was then just the DDS GUID plus some 8-byte (zero) padding.Since ros2/rmw#345, the
rmw
GID size has been reduced to 16 bytes, therefore matching the usual size of DDS GUIDs. However, ROS 2 traces were still incorrectly collecting 24-bytermw
GIDs: 16 valid bytes + 8 garbage bytes. In practice, these 8 extra bytes didn't change much, since nothing is currently relying on the GID values, at least not relying on getting the same GID for the same object from two different systems, where the first 16 bytes would be the same, but the last 8 bytes would most likely be different.Since ros2/ros2_tracing#138 fixed the ROS 2 tracing instrumentation to collect 16-byte
rmw
GIDs, the trace processing code here needs to be adapted. Instead of removing the last 8 bytes to go from a 24-bytermw
GID to a 16-byte DDS GUIDs, just keep the first 16 bytes from thermw
GID. This will work for traces that still contain 24-bytermw
GIDs (since the last 8 bytes are garbage anyway) and will work for traces that contain 16-bytermw
GIDs.