Skip to content

expand_topic_or_service_name should use get_effective_namespace() #985

@fmrico

Description

@fmrico

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions