ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

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

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

gavinmachine gravatar image

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

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 -0500

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

Question Tools

Stats

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

Seen: 6,518 times

Last updated: Sep 26 '11