Robotics StackExchange | Archived questions

getNamespace returns incorrect namespace

whenever I call, ros::this_node::getNamespace() it always returns with double slash everywhere.

I have ros::NodeHandle as a member of a class. Then I am creating object of that class inside one static function. Now main() is calling this static function. I ros::Init() inside my main. When I try to query nodehandle.getNameSpace() inside constructor of that class. it returns namespace with extra slash. If I launch node using ns="temp"it returns "//temp". If I pass nodehandle from main() to constructor of that class and use that node handle, then it returns "/temp" which is expected. This is puzzling to me. I am not using private handle here.

Asked by debonair on 2018-10-18 16:55:58 UTC

Comments

Answers

This question is labeled as kinetic, so my post cannot be an answer though,

the mentioned issue is reported in the development repo and fixed by ros_comm!1100. From ros_comm!1205 I assume the fix has been available in ros_comm 1.13.4 onward. For ROS Kinetic, where the last release of ros_comm seems younger than according to its changelog, the fix is unlikely available. You could try manually applying the PR ros_comm!1100.

Asked by 130s on 2021-06-11 09:29:20 UTC

Comments