diff --git a/clients/rospy/src/rospy/timer.py b/clients/rospy/src/rospy/timer.py index e0197f61d6..1f856efc12 100644 --- a/clients/rospy/src/rospy/timer.py +++ b/clients/rospy/src/rospy/timer.py @@ -210,7 +210,11 @@ def run(self): current_expected = rospy.rostime.get_rostime() + self._period last_expected, last_real, last_duration = None, None, None while not rospy.core.is_shutdown() and not self._shutdown: - r.sleep() + try: + r.sleep() + except rospy.exceptions.ROSInterruptException as e: + if rospy.core.is_shutdown(): + break if self._shutdown: break current_real = rospy.rostime.get_rostime()