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

Different between private node handler and not private

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

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 -0500

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

Question Tools

1 follower


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

Seen: 696 times

Last updated: Jul 18 '19