getPrivateNodeHandle() vs getNodeHandle ?
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 ?
yes, correct :) However, you dont need to use the NodeHandle constructor here. "What's the good practice in this case ?" -> what case?