Cannot catch ROSTimeMovedBackwardsException: ROS time moved backwards when calling /gazebo/reset_simulation service
Hello everyone : )
What i am trying to do is run Reinforcement Learning algorithms using ROS, Gazebo, and OpenAI. I am basing my project on this repo: https://github.com/erlerobot/gym-gazebo/
The code that i am running right now basically does the following (snippets below): For each episode: 1. Perform random action 2. sleep 1 second 3. reset
The problem is that when i try to reset the environment after an iteration/episode where the robot (Kinova Movo with 7DOF Jaco arms) interacts with the environment, the following happens:
The robot peforms the action through the step function, then the robot resets its arm positon (up until here it's fine), then the reset service is called.
if i call the /gazebo/reset_simulation
serivce, upon calling the service, an exception is thrown that i am i unable to catch, i do not know why (the exception catch block is in the movo_env.py below, although it's commented out) and this is what i see in the terminal :
(all the warnings starting with *.py are just for debugging, i know that's not correct, but i can see it much better for now)
[ERROR] [1569234178.111249]: movo_env.py: Now paused
[ERROR] [1569234178.177995]: movo_env.py: Simulation allegedly reset
[ WARN] [1569234178.185905857, 0.001000000]: Negative update time difference detected.
[ERROR] [1569234178.190759, 0.001000]: ROS time moved backwards: 585.604s
Exception in thread Thread-5:
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
[ERROR] [1569234178.203853, 0.001000]: ROS time moved backwards: 585.604s
Exception in thread Thread-12:
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
And after that, nothing works anymore and everything gets chaotic. This is a video of what happens, and the error log is pasted below as well.
I am using Kinetic with gazebo version 7.15.0
Complete Log:
mohamed@mylaptop:~$ python ist-robot-gym/ist_robot_gym/envs/gym-movo/gym_movo/envs/agent_movo_prototype.py
No handlers could be found for logger "rosout"
ROS_MASTER_URI=http://localhost:11311
GAZEBO_MASTER_URI=http://localhost:11345
Gazebo launched!
Unable to register with master node [http://localhost:11311]: master may not be running yet. Will keep trying.
... logging to /home/mohamed/.ros ...