Ask Your Question
0

In ROS2, is a wall timer connected to a node in a way meaningfull for a user

asked 2018-10-30 08:51:46 -0500

uthinu gravatar image

updated 2018-10-30 09:50:22 -0500

Hi, I need an object (a node) to create a timer in ROS2. I can create any node just in order to call the respective method create_wall_timer , but I would like to have a timer which calls any generic callback not connected to a ROS node. I guess it works like that but you need a node for some technical reasons mentioned here https://groups.google.com/forum/#!top... ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-30 13:14:13 -0500

William gravatar image

I think my answer on the mailing list you linked is the right one:

https://groups.google.com/d/msg/ros-s...

You need to have something to wait on the timer (they do not create their own threads or anything) and so you need to add it to an executor. For that reason we create it through the node. It would be possible to have a timer which can be used with an executor and without a node, but that's not currently possible.

If you want a timer that automatically calls the callback without blocking (fire and forget), then you should consider using C++'s async and std::this_thread::sleep_for:

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

3 followers

Stats

Asked: 2018-10-30 08:51:46 -0500

Seen: 239 times

Last updated: Oct 30 '18