Created
February 26, 2024 14:19
-
-
Save wowkin2/42c6dd80ca3ac144d5fca4cd6ce1e0e5 to your computer and use it in GitHub Desktop.
Reset Gazebo world to restore initial position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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