Ask Your Question
2

ROS Timer: difference between types of NodeHandles?

asked 2016-04-29 01:12:25 -0500

mgruhler gravatar image

updated 2016-04-29 01:12:59 -0500

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?" (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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-05-05 23:50:15 -0500

ahendrix gravatar image

A ROS timer does not have an associated ROS graph name, so the namespace of the nodehandle doesn't affect how the timer functions.

I believe (though I'm not entirely certain), that if your NodeHandles have different callback queues, then the timer callback will get called on queue of the associated NodeHandle. This is a fairly advanced use case and it requires explicit setup, so it's probably not something that most students will encounter.

edit flag offensive delete link more

Comments

@ahendrix thanks. This sounds reasonable. And this is actually something nobody could answer here. :-)

mgruhler gravatar image mgruhler  ( 2016-05-09 01:12:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-04-29 01:12:25 -0500

Seen: 128 times

Last updated: May 05 '16