From 306e52ef8dc0c9982c99a7fc7d05a7e927c70b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20G=C3=BCnther?= Date: Thu, 23 Mar 2017 14:12:28 +0100 Subject: [PATCH] [joint_state_publisher] Handle time moving backwards Without this patch, joint_state_publisher dies whenever the ROS time moves backwards (e.g., when running `rosbag play --clock --loop`). --- .../joint_state_publisher/joint_state_publisher | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/joint_state_publisher/joint_state_publisher/joint_state_publisher b/joint_state_publisher/joint_state_publisher/joint_state_publisher index 7badd65..4ac5008 100755 --- a/joint_state_publisher/joint_state_publisher/joint_state_publisher +++ b/joint_state_publisher/joint_state_publisher/joint_state_publisher @@ -238,7 +238,10 @@ class JointStatePublisher(): msg.effort[i] = joint['effort'] self.pub.publish(msg) - r.sleep() + try: + r.sleep() + except rospy.exceptions.ROSTimeMovedBackwardsException: + pass def update(self, delta): for name, joint in self.free_joints.iteritems():