-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstop.bash
executable file
·41 lines (30 loc) · 1.16 KB
/
stop.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Get the directory of the current script
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Get drone namespaces from command-line argument
drones_namespace_comma=$1
IFS=',' read -r -a drone_namespaces <<< "$drones_namespace_comma"
# Make a tmux list of sessions to be killed
tmux_session_list=()
# Add drones from user input
for namespace in ${drone_namespaces[@]}; do
tmux_session_list+=("$namespace")
done
# Add drones from config/world.yaml file
drone_namespaces=$(python3 ${script_dir}/utils/get_drones.py -p ${script_dir}/config/world.yaml --sep ' ')
for namespace in ${drone_namespaces[@]}; do
tmux_session_list+=("$namespace")
done
# Add drones from config/world_swarm.yaml file
drone_namespaces=$(python3 ${script_dir}/utils/get_drones.py -p ${script_dir}/config/world_swarm.yaml --sep ' ')
for namespace in ${drone_namespaces[@]}; do
tmux_session_list+=("$namespace")
done
tmux_session_list+=("ground_station")
${script_dir}/utils/stop_tmux_sessions.bash "${tmux_session_list[@]}"
# Kill gazebo
pkill -9 -f 'gz' < /dev/null
pkill -9 -f "gazebo" < /dev/null
pkill -9 -f "ruby" < /dev/null
# Kill gazebo bridges
pkill -9 -f "ros_gz_bridge"