ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
6

Determine a Node's Name/Namespace from within the Node (C++)

asked 2012-03-30 13:49:21 -0600

gavinmachine gravatar image

updated 2014-01-28 17:11:49 -0600

ngrennan gravatar image

Hello,

Is there a way to determine the name of a node and/or its namespace from within the node's C++?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
19

answered 2012-03-30 15:25:03 -0600

joq gravatar image

updated 2012-03-30 15:25:56 -0600

edit flag offensive delete link more

Comments

To get just the node name without the namespace:

ros::this_node::getName().substr(ros::this_node::getNamespace().size() + 1);
lucasw gravatar image lucasw  ( 2022-08-28 12:13:05 -0600 )edit

Question Tools

Stats

Asked: 2012-03-30 13:49:21 -0600

Seen: 7,951 times

Last updated: Mar 30 '12