Ask Your Question
0

Stopping ROS timer python

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

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

Comments

1

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

1 Answer

Sort by ยป oldest newest most voted
0

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

abhishek47 gravatar image

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

(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
#
timer_object.shutdown()
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: 2019-07-30 15:15:04 -0500

Seen: 170 times

Last updated: May 31