forked from sugihara-16/aerial_robot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[misc] Implemented a way to shut down Gazebo quicker
- Loading branch information
1 parent
cd854bb
commit 988756e
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
# Code courtsy of Sihoj and cosmicog on Github | ||
# https://github.com/Sihoj | ||
# https://github.com/cosmicog | ||
|
||
|
||
import sys, signal, subprocess, time | ||
|
||
|
||
timeout_before_kill = 0.1 # [s] | ||
timeout_after_kill = 0.1 # [s] | ||
|
||
|
||
def signal_handler(sig, frame): | ||
time.sleep(timeout_before_kill) | ||
subprocess.call("killall -q gzclient & killall -q gzserver", shell=True) | ||
time.sleep(timeout_after_kill) | ||
subprocess.call("killall -9 -q gzclient & killall -9 -q gzserver", shell=True) | ||
sys.exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
signal.signal(signal.SIGINT, signal_handler) | ||
input("aaaaaaa") |
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