-
Notifications
You must be signed in to change notification settings - Fork 1
/
eval.sh
executable file
·61 lines (54 loc) · 1.26 KB
/
eval.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
#!/bin/bash
function usage () {
echo "ERROR: args invalid"
echo "USAGE: eval.bash PLATFORM APP [LEN_STR]"
echo " PLATFORM : \"uros-serial\" \"uros-udp\" \"uros-rtps\" \"mros2-asp3\" \"mros2-mbed\""
echo " APP : \"string\", \"uint16\", \"twist\""
}
### setup operation ###
if [ $# -ne 2 -a $# -ne 3 ];
then
usage
exit 1
else
PLATFORM=$1
APP=$2
APPNAME=mros2_eval_${APP}
if [ ${APP} = "string" ];
then
if [ $# -eq 3 ];
then
LEN_STR=$3
else
usage
exit 1
fi
fi
fi
### create directory in `results/` ###
mkdir -p results/${PLATFORM}
### run evaluation ###
echo "INFO: make sure \"${APP}\" with \"${PLATFORM}\" is ready to pub/sub on the board"
read -n1 -rsp $' : press any key to continue or Ctrl+C to exit...\n'
echo "INFO: evaluation start"
cd host_ws
source install/local_setup.bash
if [ ${APP} = "string" ];
then
ros2 run ${APPNAME} sub_node ${PLATFORM} ${LEN_STR} &
pid_sub=$!
sleep 1
ros2 run ${APPNAME} pub_node ${PLATFORM} ${LEN_STR}
pid_pub=$!
wait $pid_sub $pid_pub
else
ros2 run ${APPNAME} sub_node ${PLATFORM} &
pid_sub=$!
sleep 1
ros2 run ${APPNAME} pub_node ${PLATFORM}
pid_pub=$!
wait $pid_sub $pid_pub
fi
cd ..
echo "INFO: evaluation of \"${APP}\" with \"${PLATFORM}\" finished"
exit 0