Ask Your Question

# Revision history [back]

### ROS Timer: difference between types of NodeHandles?

Dear all,

a student approached me a day back with a question that I just couldn't answer: "Should a ROS timer be on a a private NodeHandle, or on a global one?"

We usually do something like the following:

ros::NodeHandle nh_         = ros::NodeHandle(""); // for subscribers/publishers/...
ros::NodeHandle private_nh_ = ros::NodeHandle("~"); // for parameters


For parameters, subscribers etc. there is a clear difference which NodeHandle is used to access/initialize them.

Is there any for Timers?

Thank you for your insights!

### ROS Timer: difference between types of NodeHandles?

Dear all,

a student approached me a day back with a question that I just couldn't answer: "Should a ROS timer be on a a private NodeHandle, or on a global one?"one?" (or any other, obviously...)

We usually do something like the following:

ros::NodeHandle nh_         = ros::NodeHandle(""); // for subscribers/publishers/...
ros::NodeHandle private_nh_ = ros::NodeHandle("~"); // for parameters


For parameters, subscribers etc. there is a clear difference which NodeHandle is used to access/initialize them.

Is there any for Timers?

Thank you for your insights!