Created
September 11, 2020 20:54
-
-
Save salihmarangoz/e5b2b36261207236e5198667f7dc7b40 to your computer and use it in GitHub Desktop.
Kills the Gazebo Simulator which rejects dying in the hands of programmer, eliminating waiting time while shutting down gzclient and gzserver
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
#!/usr/bin/env python | |
# Kills the Gazebo Simulator which rejects dying in the hands of programmer, eliminating waiting time while shutting down gzclient and gzserver | |
# 1. Copy this file into scripts folder in your simulator package (which includes your models and worlds) | |
# 2. Make it executable (chmod +x gazebo_killer_node.py) | |
# 3. Insert the line below into your launch file which starts gazebo and loads your world | |
# <node name="gazebo_killer_node" pkg="YOUR_PACKAGE_NAME" type="gazebo_killer_node.py"/> | |
import rospy | |
import os | |
rospy.init_node("gazebo_killer") | |
# wait for shutdown signal | |
rospy.logwarn("Gazebo killer is ready!") | |
rospy.spin() | |
# shutdown gzserver and gzclient | |
rospy.logwarn("Killing gzserver and gzclient") | |
for i in range(5): | |
os.system("killall -9 gzserver") | |
os.system("killall -9 gzclient") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment