Skip to content

Instantly share code, notes, and snippets.

@wowkin2
Created February 26, 2024 14:19
Show Gist options
  • Save wowkin2/42c6dd80ca3ac144d5fca4cd6ce1e0e5 to your computer and use it in GitHub Desktop.
Save wowkin2/42c6dd80ca3ac144d5fca4cd6ce1e0e5 to your computer and use it in GitHub Desktop.
Reset Gazebo world to restore initial position
import rospy
from std_srvs.srv import Empty
def reset_world():
"""
Reset Gazebo world to restore initial position
"""
rospy.wait_for_service('/gazebo/reset_world')
try:
cmd = rospy.ServiceProxy('/gazebo/reset_world', Empty)
cmd()
except rospy.ServiceException as e:
print("Service call failed: %s" % e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment