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

Use both ROS package and message name for unique mappings #656

Open
wants to merge 2 commits into
base: ros2
Choose a base branch
from

Conversation

oysstu
Copy link

@oysstu oysstu commented Nov 26, 2024

Summary

This prepends the ROS package name before the message name to avoid problems with collision when two distinct packages declare the same message name. Any custom message package declaring Imu.msg will not compile as the generated publishers, subscribers, and tests will have the same names in the following files.

  • ros_gz_bridge/generated/test/ros_publisher.cpp
  • ros_gz_bridge/generated/test/gz_subscriber.cpp
  • ros_gz_bridge/generated/test/gz_publisher.cpp

Example: custom_msgs/msg/Imu.msg will collide with sensor_msgs/msg/Imu.msg in the declarations of

  • ros_publisher.cpp
    • auto imu_imu_pub
    • custom_msgs::msg::Imu imu_imu_msg
  • gz_subscriber.cpp
    • TEST(GzSubscriberTest, imu_imu)
  • gz_publisher.cpp
    • auto imu_imu_pub
    • gz::msgs::IMU imu_imu_msg

This commit adds the package name to the unique name generation, such that
auto imu_imu_pub becomes auto imu_sensor_msgs_imu_pub

Checklist

  • [X ] Signed all commits for DCO
  • [N/A] Added tests
  • [N/A] Updated documentation (as needed)
  • [N/A] Updated migration guide (as needed)
  • [N/A] Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@oysstu oysstu requested a review from ahcorde as a code owner November 26, 2024 12:17
Signed-off-by: Øystein Sture <[email protected]>
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

@mjcarroll do you mind to take a quick look ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants