getPrivateNodeHandle() vs getNodeHandle ?

asked 2019-08-07 08:36:49 -0600

Confused Lizard gravatar image

updated 2019-08-13 08:04:16 -0600

ROS Melodic on Ubuntu 18.04

I would like to know the difference between these two methods

getPrivateNodeHandle() and getNodeHandle() in the context of nodelets

On my onInit() method I initialize my node handlers as:

void onInit()
    private_nh = getPrivateNodeHandle(); // private node handler for pub/sub inside the class
    nh_out = ros::NodeHandle(getNodeHandle(),"out"); // public node handler to publish/subscribe to external topics and renaming it to "out"

Did I use these methods correctly ? What's the good practice in this case ?

edit retag flag offensive close merge delete


yes, correct :) However, you dont need to use the NodeHandle constructor here. "What's the good practice in this case ?" -> what case?

stfn gravatar image stfn  ( 2019-08-13 13:53:21 -0600 )edit