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

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: http://wiki.ros.org/roscpp/Overview/N..., but I don't understand what is (or are) the different between this two declarations:

ros::NodeHandle n;

And

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
4

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

Stats

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

Seen: 664 times

Last updated: Jul 18 '19