Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reset to Timer in ConnectionBasedTransport #1597

Merged
merged 2 commits into from
Sep 4, 2018

Conversation

wkentaro
Copy link
Member

@wkentaro wkentaro commented Sep 1, 2018

Why?

On Kinetic we have below error, and this PR fixes it by resetting the timer.

[ERROR] [1535796247.786932, 1535792085.063646]: [/get_heightmap] [sleep] ROS time moved backwards: 1.407559397s
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 226, in run
    r.sleep()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 103, in sleep
    sleep(self._remaining(curr_time))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 164, in sleep
    raise rospy.exceptions.ROSTimeMovedBackwardsException(time_jump)
ROSTimeMovedBackwardsException: ROS time moved backwards

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 226, in run
    r.sleep()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 103, in sleep
    sleep(self._remaining(curr_time))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 164, in sleep
    raise rospy.exceptions.ROSTimeMovedBackwardsException(time_jump)
ROSTimeMovedBackwardsException: ROS time moved backwards

^C[image_view-9] killing on exit
[tile_image-8] killing on exit
[get_heightmap/output/depth_view-7] killing on exit
[get_heightmap-6] killing on exit
[heightmap_frame_publisher-5] killing on exit
[bbox_to_tf-4] killing on exit
[bbox_array_to_bbox-3] killing on exit
[rosbag_play-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

To fix below:

```
[ERROR] [1535796247.786932, 1535792085.063646]: [/get_heightmap] [sleep] ROS time moved backwards: 1.407559397s
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 226, in run
    r.sleep()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 103, in sleep
    sleep(self._remaining(curr_time))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 164, in sleep
    raise rospy.exceptions.ROSTimeMovedBackwardsException(time_jump)
ROSTimeMovedBackwardsException: ROS time moved backwards

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 226, in run
    r.sleep()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 103, in sleep
    sleep(self._remaining(curr_time))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py", line 164, in sleep
    raise rospy.exceptions.ROSTimeMovedBackwardsException(time_jump)
ROSTimeMovedBackwardsException: ROS time moved backwards

^C[image_view-9] killing on exit
[tile_image-8] killing on exit
[get_heightmap/output/depth_view-7] killing on exit
[get_heightmap-6] killing on exit
[heightmap_frame_publisher-5] killing on exit
[bbox_to_tf-4] killing on exit
[bbox_array_to_bbox-3] killing on exit
[rosbag_play-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
```
@wkentaro wkentaro requested review from k-okada and iory and removed request for k-okada September 2, 2018 09:34
@k-okada
Copy link
Member

k-okada commented Sep 3, 2018

do you think it is possible to just show warning message when the time moved backwards?
catch except rospy.exceptions.ROSTimeMovedBackwardsException within our code and execute self.last_time = rospy.rostime.get_rostime()

@wkentaro
Copy link
Member Author

wkentaro commented Sep 3, 2018

Actually, I have no idea to achieve it, except for deriving the rospy.Timer and change its behavior.
Do you mean reset=True is too complicated? Or should I show the warning of the time backward?

@k-okada
Copy link
Member

k-okada commented Sep 4, 2018

Or should I show the warning of the time backward?

yes, may be you can send PR to upstream

@k-okada k-okada merged commit 9f1e605 into jsk-ros-pkg:master Sep 4, 2018
@wkentaro wkentaro deleted the reset_timer branch September 4, 2018 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants