Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.
This repository was archived by the owner on May 31, 2025. It is now read-only.

ros::this_node::getNamespace() ought to return sanitized namespace #1094

@lucasw

Description

@lucasw
  ros::init(argc, argv, "ns_test");
  std::cout << ros::this_node::getNamespace() << std::endl;
  ros::NodeHandle nh("~");
  std::cout << nh.getNamespace() << std::endl;

This is fine

$ rosrun ns_test ns_test __ns:=foo
/foo
/foo/ns_test

This ought to print the same

rosrun ns_test ns_test __ns:=/foo
//foo
/foo/ns_test

An additional / was prefixed to the provided namespace.

and this (which is somewhat ridiculous, but why not fix it also)

rosrun ns_test ns_test __ns:=//foo//
///foo//
/foo/ns_test

The namespace gets cleaned up getting into the NodeHandle, but the this_node returns exactly what was on the command line plus the additional forward slash.

Using the released kinetic version currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions