Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Created March 20, 2016 20:21
Show Gist options
  • Select an option

  • Save awesomebytes/d31c0c8c34020fcdc56e to your computer and use it in GitHub Desktop.

Select an option

Save awesomebytes/d31c0c8c34020fcdc56e to your computer and use it in GitHub Desktop.
Check if Gazebo simulation is running
#!/usr/bin/env python
from time import sleep
import rospy
if __name__ == '__main__':
rospy.init_node('check_time')
# Until rospy initalizes the time returned will be 0
# so we need to give a bit of time to see if it initializes
sleep(2)
if rospy.Time.now() == rospy.Time():
print "Simulation stalled/paused"
else:
print "Simulation running correctly"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment