Skip to content

Instantly share code, notes, and snippets.

@varhub
Created March 23, 2016 20:23
Show Gist options
  • Save varhub/603ce31ab364d6a8cb43 to your computer and use it in GitHub Desktop.
Save varhub/603ce31ab364d6a8cb43 to your computer and use it in GitHub Desktop.
The runner for single command execution of dronecampeones trainning test.
#!/bin/sh
#
# Copyright (c) 2016
# Author: Victor Arribas <[email protected]>
# License: GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
if pgrep gzserver || pgrep gzclient
then
killall gzserver
killall gzclient
sleep 2
fi
echo "Launching Gazebo"
gzserver --verbose --minimal_comms dronecampeones.world &
pid_gz=$!
sleep 3
if [ "$1" = "GUI" ]
then
echo "Launching GUI"
gzclient &
pid_gzc=$!
sleep 5
fi
echo
echo "RUN CLASSIFICATION"
echo
python cat_py/main.py --Ice.Config=cat_py/cat.cfg &
pid_cat=$!
python /usr/local/share/jderobot/python/refereeViewer/refereeViewer.py --Ice.Config=refereeViewer.cfg &
pid_score=$!
./trainning_mouse_x64/trainning_mouse --Ice.Config=trainning_mouse_x64/trainning.cfg &
pid_mouse=$!
wait $pid_cat
echo
echo "SHUTDOWN"
echo
sigterm(){
local signals='-2 -15 -9'
for signal in $signals
do
ps | grep -q $1 && kill $signal $1
done
}
sigterm $pid_mouse
sigterm $pid_score
[ "$1" = "GUI" ] && sigterm $pid_gzc
sigterm $pid_gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment