Skip to content

Fix CLI namespace expansion for expand_gz_topic_names - #873

Open
AyushSuri8 wants to merge 1 commit into
gazebosim:humblefrom
AyushSuri8:humble
Open

Fix CLI namespace expansion for expand_gz_topic_names#873
AyushSuri8 wants to merge 1 commit into
gazebosim:humblefrom
AyushSuri8:humble

Conversation

@AyushSuri8

Copy link
Copy Markdown

Description:
Fixes #702.

The Issue:
When creating a bridge via CLI string parsing (e.g., topic@ros_type@gz_type), the expand_gz_topic_names parameter was being completely ignored, whereas it worked correctly when passed via a YAML config file.

The Fix:
Updated the argument parsing loop in parameter_bridge.cpp to:

  1. Fetch the expand_gz_topic_names parameter and the node's current namespace via get_namespace().
  2. Safely prepend the ROS namespace to config.gz_topic_name when the parameter is set to true, preventing double slashes.

Testing:
Reproduced the original issue using the osrf/ros:humble-simulation Docker container. Built this branch from source and verified that running:
ros2 run ros_gz_bridge parameter_bridge chatter@std_msgs/msg/String@ignition.msgs.StringMsg --ros-args -p expand_gz_topic_names:=true -r __ns:=/demo

Now correctly results in ign topic -l outputting: /demo/chatter

Signed-off-by: Ayush <vtdlduddn3267@gmail.com>

@ahcorde ahcorde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you mind to target rolling ? and add some tests?

@github-project-automation github-project-automation Bot moved this from Inbox to In review in Core development Mar 30, 2026
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.

3 participants