forked from start-jsk/rtmros_choreonoid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_choreonoid.sh
More file actions
executable file
·84 lines (74 loc) · 2.64 KB
/
run_choreonoid.sh
File metadata and controls
executable file
·84 lines (74 loc) · 2.64 KB
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
84
#!/bin/bash
### choose choreonoid binary
choreonoid_exe='choreonoid'
# if [ "$(pgrep -x ${choreonoid_exe} | wc -l)" != 0 ]; then
# pkill -9 ${choreonoid_exe}
# echo "****************************************************" 1>&2
# echo "* *" 1>&2
# echo "* *" 1>&2
# echo "* Old choreonoid process was found. *" 1>&2
# echo "* Process has been killed, please start again. *" 1>&2
# echo "* *" 1>&2
# echo "* *" 1>&2
# echo "****************************************************" 1>&2
# exit 1
# fi
cnoid_proj=""
if [ "$(echo $1 | grep \.cnoid$ | wc -l)" == 1 ]; then
cnoid_proj=$1
fi
start_sim=""
enable_const=""
add_objects=""
rtm_args=()
latch=0
for arg in $@; do
## debug
## echo $arg 1>&2;
if [ $latch = 1 ]; then
rtm_args=("${rtm_args[@]}" $arg)
latch=0
fi
if [ $arg = "-o" ]; then
latch=1
fi
if [ $arg = "--start-simulation" ]; then
start_sim=$arg
fi
if [ $arg = "--enable-constraint" ]; then
enable_const="--python $(rospack find hrpsys_choreonoid)/launch/constraint_enable.py"
fi
if [ $arg = "--add-objects" ]; then
if [ "${EXTRA_CHOREONOID_OBJS}" != "" ]; then
add_objects="--python $(rospack find hrpsys_choreonoid)/launch/add_objects.py"
fi
fi
done
## debug
##echo "${rtm_args[@]}" 1>&2
rtc_conf="/tmp/rtc.conf.choreonoid"
if [ -e $rtc_conf ]; then
rm -rf $rtc_conf
fi
for arg in "${rtm_args[@]}";
do echo $arg >> $rtc_conf;
done
echo "choreonoid will run with rtc.conf file of $rtc_conf" 1>&2
echo "contents of $rtc_conf are listed below" 1>&2
echo "<BEGIN: rtc.conf>" 1>&2
cat $rtc_conf 1>&2
echo "<END: rtc.conf>" 1>&2
export RTCTREE_NAMESERVERS=localhost:15005
export ORBgiopMaxMsgSize=2147483648
export CNOID_CUSTOMIZER_PATH=$(rospack find hrpsys_choreonoid)
if [ -z "$cnoid_proj" ]; then
echo "choreonoid will be executed by the command below" 1>&2
echo "$ (cd /tmp; $choreonoid_exe --python $(rospack find hrpsys_choreonoid)/scripts/create_environment.py)" 1>&2
(cd /tmp; $choreonoid_exe --python $(rospack find hrpsys_choreonoid)/scripts/create_environment.py)
else
echo "choreonoid will be executed by the command below" 1>&2
echo "$ (cd /tmp; $choreonoid_exe $enable_const $add_objects $cnoid_proj $start_sim)" 1>&2
(cd /tmp; $choreonoid_exe $enable_const $add_objects $cnoid_proj $start_sim)
## for using gdb
#(cd /tmp; gdb -ex run --args $choreonoid_exe $enable_const $add_objects $cnoid_proj $start_sim)
fi