ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Ros::Timer, will stopping it with .stop() cause its counter to restart?

asked 2011-09-25 12:12:29 -0600

gavinmachine gravatar image

updated 2014-01-28 17:10:25 -0600

ngrennan gravatar image


If I declare a basic timer like this:

ros::Timer my_timer = nh.createTimer(ros::Duration(1), callback);

And then I stop it like this (say, 0.5 seconds later):


And then I start it again like this:


Will the timer start again at the beginning of its counter (0 sec), or will it start up from where it left off (0.5 sec)?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-26 00:36:21 -0600

The timer will start again at the beginning. The stop() method cancels all pending callbacks and lets the timer forget about the time that has already elapsed.

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


Asked: 2011-09-25 12:12:29 -0600

Seen: 5,634 times

Last updated: Sep 26 '11