Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the GoalUUID to_string representation #1999

Merged
merged 3 commits into from
Mar 2, 2023

Conversation

nwn
Copy link
Contributor

@nwn nwn commented Aug 19, 2022

Changes the string representation of rclcpp_action::GoalUUIDs to match the canonical format described in RFC 4122. (The current representation doesn't contain hyphens and omits the leading zero in the hex of a byte.)

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is reasonable to me, but format should be consistent in language frontend libraries for debugging use case? (probably goal id is likely to be used with grep)

@clalancette
Copy link
Contributor

I'm not necessarily opposed to changing it, but I would like to know the motivation (other than just conforming to the RFC). There are possible backwards-compatibility things to consider here.

@nwn
Copy link
Contributor Author

nwn commented Aug 23, 2022

@fujitatomoya I agree, we should use a consistent format across client libraries. Unfortunately, rclpy currently doesn't format goal IDs well either. For example, the rclpy action server prints them as arrays of integers:

[DEBUG] [1661282923.515954250] [minimal_action_server]: New goal request with ID: [231  15 208   8 188 196  68  43 129  63  56 102  30 126  48 197]

So it would be good to start standardizing this output.

@clalancette The issues with the current string representation aren't just aesthetic or pedantic. Omitting the leading zero in a byte is actually ambiguous. For example, the two UUIDs 01100000-0000-0000-0000-000000000000 and 11000000-0000-0000-0000-000000000000 will both be converted to the string 11000000000000000 in the current representation. If users are comparing the string values of these UUIDs or storing them in a hash table, this would cause collisions.

@nwn
Copy link
Contributor Author

nwn commented Feb 8, 2023

@fujitatomoya @clalancette Are there any further concerns about this or action required to get this merged?

rclcpp_action/src/types.cpp Show resolved Hide resolved
@fujitatomoya
Copy link
Collaborator

Just FYI, I see https://github.com/ros2/geometry2 uses this method, but all issued for debug print.

nwn and others added 3 commits March 1, 2023 19:39
Signed-off-by: Nathan Wiebe Neufeldt <nwiebeneufeldt@clearpath.ai>
Signed-off-by: Nathan Wiebe Neufeldt <nwiebeneufeldt@clearpath.ai>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette
Copy link
Contributor

I've rebased this onto the latest, and I've also done a bit more cleanup in here. In particular, I made the whole thing a little more efficient by using .resize instead of .reserve on the string, and by adding in the dashes in the main loop (rather than adding them in separately).

I also did a quick look around the code base and came to the same conclusion that Tomoya did; the only uses seem to be in the tests here and in debug messages in tf2_ros. So I think this is good to go, I'm going to go ahead and approve this and run CI.

That said, I did some work on this, so I'd appreciate another look from @fujitatomoya before I go ahead and merge.

@clalancette
Copy link
Contributor

clalancette commented Mar 1, 2023

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

CI is green with this, so going ahead and merging. Thanks for the contribution!

@clalancette clalancette merged commit 399f4df into ros2:rolling Mar 2, 2023
@nwn nwn deleted the fix-uuid-to-string branch March 2, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants