uCDR and IDL: remove field ordering, causing improper serialization/deserializarion #12025
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.
Solves PX4/px4_ros_com#12.
Test data / coverage
Example output from
listener vehicle_gps_position
:Example output from a ROS 2 listener for the same message being propagated in a uRTPS UDP link: (still has problems in some enum fields, but at least the message is usable)
Describe problem solved by the proposed pull request
While running an instance of a Fast-CDR deserialisation in a micro-RTPS bridge, the following error was triggered:
Further debug using gdb allowed to verify which msgs where triggering this error, and which specific fields. It turns out that the message fields where not being properly initialised because they were sorted before being serialized but then the deserialization was not considering the sorting of the fields, which resulted in wrong deserialization of the fields.
Describe your preferred solution
There's not obvious advantage on sorting the fields before serialization and when building the IDL file, so that sorting was removed and the problem was solved.
Describe possible alternatives
We can consider sorting in both sides of serialization and deserialization (ROS2 agent side), but no obvious advantage on that.