-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_sim.sh
85 lines (63 loc) · 1.75 KB
/
run_sim.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
argos_conf=$( readlink -f $1)
net_scene=$( readlink -f $2)
ns3_conf=/home/eduardo/devel/ns3_pplql/ns-allinone-3.12.1/ns-3.12.1/scratch/swarmanoidIntegration/default.conf
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
echo $DIR
NS3_DIR=/home/eduardo/devel/ns3_pplql/ns-allinone-3.12.1/ns-3.12.1/
function cleanup()
{
if [ "$(pidof swarmanoidIntegration)" ]
then
echo "ns3 still running ? we kill it!"
kill -9 $(pidof swarmanoidIntegration)
fi
if [ "$(pidof argos)" ]
then
echo "argos still running ? don't worry, I kill it!"
kill -9 $(pidof argos)
fi
}
trap cleanup INT
if [ "$(pidof swarmanoidIntegration)" ]
then
echo "Another instance of ns3 is running PID with $(pidof swarmanoidIntegration) "
read -p "shall we kill it? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
killall swarmanoidIntegration
else
exit 0
fi
fi
if [ "$(pidof argos)" ]
then
echo "Another instance of argos is running with PID $(pidof argos)"
read -p "shall we kill it? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
killall argos
else
exit 0
fi
fi
######### run ns-3 ############
cd ${NS3_DIR}
./waf --run "scratch/swarmanoidIntegration/swarmanoidIntegration \
${ns3_conf} RoboNetSim_NS3.dat" &> ~/tmp/ns3_click.out &
######### rnp solve ##########
### must run first because it opens the connection
#cd ~/devel/robot_letter/
#PYTHONPATH=$PYTHONPATH:/home/eduardo/devel/online_rnp/solve/python/ \
# ./send_letter.py ${net_scene} letters.dat &
sleep 1
######### run argos ##########
cd ~/projects/argos_sim/argos-RoboNetSim/
launch_argos -c ${argos_conf}
while [ "$(pidof argos)" ]
do
sleep 1
done
echo "argos done?"
cleanup