Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The rospy.Rate convenience class makes a best effort to maintain the loop running at the specified frequency by considering the execution time of the loop since the last successful r.sleep(). This means, in my case: and assuming I had one r.sleep() call, as long as the code execution time within the loop does not exceed 1/5 seconds, rospy.Rate will make sure the loop runs at 5Hz. The script's continued execution has nothing to do with it. But for those who are curious, it was because when pressing Ctrl-C: KeyboardInterrupt will be handled differently than in normal Python scripts when using rospy. I had to manually shutdown the script. For details check this answer