expand_topic_or_service_name should use get_effective_namespace()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
Feature description
sub_node concept is not being correctly used in some packages that use the function expand_topic_or_service_name(). They use it with get_namespace() to create publishers, instead of get_effective_namespace(). Probably many people do not know the existence of this method or the concept of subnode. For example, Here. If this node is a sub_node (created with create_sub_node(), then the effect of the subnode does not take effect. For:
color_subnode_ = create_sub_node("rgb");
image_transport::ImageTransport color_it(color_subnode_);
pub_color_ = color_it.advertiseCamera("image", 1);
The effect is:
$ ros2 topic list
/camera_info
/image
/image/compressed
/image/compressedDepth
/image/theora
Instead of adding "/rgb" in front of each topic name.
Maybe expand_topic_or_service_name() should receive the rclcpp::Node, and internally, it could call get_effective_namespace().
I can work on it, but I would like to know if you think it's the right solution.
Implementation considerations
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading expand_topic_or_service_name() and get_effective_namespace(), then compare their use in image_transport/src/camera_publisher.cpp. Determine the appropriate API change so a publisher created from a create_sub_node("rgb") context prefixes topic names with /rgb, and verify the affected callers preserve that namespace behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100