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

Revision history [back]

If you look at the ros::NodeHandle documentation, you can find a copy constructor that matches that signature:

ros::NodeHandle::NodeHandle(const NodeHandle &rhs)

Essentially, this creates a new NodeHandle instance that inherits a copy of all the parameters from the original NodeHandle. In the JointTrajectoryExecuter class you reference, this creates a local NodeHandle variable within the class that is a a copy of the NodeHandle created when the node is first initialized. The class can then use this local copy for handling actions, messages, etc.

In general, this isn't necessary, as all NodeHandle objects in a given node point to the same underlying object. But this version does allow the new NodeHandle to inherit the namespace of the original NodeHandle, if one was specified.