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

Stopping ROS timer python

asked 2019-07-30 15:15:04 -0600

wcgmb gravatar image

I want a timer to run for a short time to calculate something but then i want to be able to stop it. I see where it says to use shutdown() but it doesn't like that. Help would be appreciated. if shutdown() is correct could you please put an example of it working.

edit retag flag offensive close merge delete



What does "doesn't like it" mean? Is there an error? Post your code so we can help.

billy gravatar image billy  ( 2019-07-31 21:04:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-31 22:58:46 -0600

abhishek47 gravatar image

updated 2021-05-31 23:01:38 -0600

(late to this question but I came here looking for an example of shutdown() so adding an answer for future visitors)

The Timer class has a shutdown method which needs to be called, like you'd call the method of any class of which you've an object.

could you please put an example of it working.

timer_object = rospy.Timer(rospy.Duration(2), some_callback_function)
# do whatever you want to do before calling shutdown
edit flag offensive delete link more

Question Tools


Asked: 2019-07-30 15:15:04 -0600

Seen: 649 times

Last updated: May 31 '21