ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Different between private node handler and not private

asked 2019-07-18 10:29:48 -0600

Elric gravatar image

I'm using ROS melodic and Gazebo 9.9.0 on an Ubuntu 18.04.2 LTS.

I've been reading this:, but I don't understand what is (or are) the different between this two declarations:

ros::NodeHandle n;


ros::NodeHandle n("~");

What are the different between a private and a not private node handler?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-07-18 16:34:32 -0600

The first will look for your parameter in the global namespace (ei it will find /my_param) the second will look under the nested namespaces of the node itself (ei it will find /namespace/my_node_name/my_param).

You can still find the local namespace copy of that parameter with the global nodehandle, but you will need to type in alot more information.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-07-18 10:29:48 -0600

Seen: 445 times

Last updated: Jul 18 '19