Ask Your Question
2

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

Hello,

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):

my_timer.stop();

And then I start it again like this:

my_timer.start();

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)?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

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

Stats

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

Seen: 4,896 times

Last updated: Sep 26 '11