Skip to content

Commit

Permalink
[misc] Implemented a way to shut down Gazebo quicker
Browse files Browse the repository at this point in the history
  • Loading branch information
itahara-shotaro committed Oct 22, 2023
1 parent cd854bb commit 988756e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions aerial_robot_base/scripts/gazebo_shutdown.py
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")
2 changes: 2 additions & 0 deletions robots/mini_quadrotor/launch/bringup.launch
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@
<arg name="spawn_yaw" value="$(arg spawn_yaw)" />
</include>

<node name="gzterminate" pkg="aerial_robot_base" type="gazebo_shutdown.py" />

</launch>

0 comments on commit 988756e

Please sign in to comment.