-
Notifications
You must be signed in to change notification settings - Fork 12
/
robotology-setup.bash
227 lines (184 loc) · 9.23 KB
/
robotology-setup.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash
ROBOTOLOGY_ROOT=$(dirname $(readlink --canonicalize --no-newline $BASH_SOURCE))
export ROBOTOLOGY_ROOT
if [ -f $ROBOTOLOGY_ROOT/build/active_profile ]; then
source $ROBOTOLOGY_ROOT/build/active_profile
else
export ROBOTOLOGY_PROFILE=SIMULATION
fi
pathadd() {
if [ -z ${!1} ]; then
export $1=$2
elif [ -d "$2" ] && [[ ! ${!1} =~ (^|:)$2(:|$) ]]; then
export $1+=:$2
fi
}
if [ -f /opt/ros/hydro/setup.bash ]; then
source /opt/ros/hydro/setup.bash
fi
if [ -f /opt/ros/indigo/setup.bash ]; then
source /opt/ros/indigo/setup.bash
fi
if [ -f /opt/ros/kinetic/setup.bash ]; then
source /opt/ros/kinetic/setup.bash
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/moveit/install/setup.bash ]; then
source ${ROBOTOLOGY_ROOT}/external/moveit/install/setup.bash
fi
#orocos
if [ -f ${ROBOTOLOGY_ROOT}/orocos_ws/install_isolated/setup.bash ]; then
source ${ROBOTOLOGY_ROOT}/orocos_ws/install_isolated/setup.bash
if [ -f ${ROBOTOLOGY_ROOT}/orocos_ws/src/env.sh ]; then
source ${ROBOTOLOGY_ROOT}/orocos_ws/src/env.sh
fi
export LD_LIBRARY_PATH=$ROBOTOLOGY_ROOT/orocos_ws/install_isolated/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$ROBOTOLOGY_ROOT/orocos_ws/install_isolated/lib:$LIBRARY_PATH
pathadd RTT_COMPONENT_PATH /opt/ros/indigo/lib/orocos/gnulinux/plugins
pathadd RTT_COMPONENT_PATH /opt/ros/indigo/lib/orocos/gnulinux/types
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/orocos_ws/install_isolated/lib/orocos
if [ -f ${ROBOTOLOGY_ROOT}/external/rtt-gazebo-lwr4plus-sim/CMakeLists.txt ]; then
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/external/rtt-gazebo-lwr4plus-sim/orocos
fi
if [ -f ${ROBOTOLOGY_ROOT}/robots/cogimon-gazebo-models/database.config ]; then
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/cogimon-gazebo-models
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/rtt-gazebo-clock-plugin/CMakeLists.txt ]; then
pathadd GAZEBO_PLUGIN_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/gnulinux/rtt_gazebo_system
fi
if [ -f ${ROBOTOLOGY_ROOT}/robots/rtt_coman/CMakeLists.txt ]; then
if [ ${OROCOS_TARGET}='xenomai' ]; then
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/xenomai/orocos_ros_joint_state_publisher
else
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/gnulinux/orocos_ros_joint_state_publisher
fi
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/orocos_ros_joint_state_publisher/CMakeLists.txt ]; then
if [ ${OROCOS_TARGET}='xenomai' ]; then
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/xenomai/rtt_coman
else
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/gnulinux/rtt_coman
fi
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/ros_orocos_joints_gui/CMakeLists.txt ]; then
if [ ${OROCOS_TARGET}='xenomai' ]; then
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/xenomai/ros_orocos_joints_gui
else
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/gnulinux/ros_orocos_joints_gui
fi
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/ros_orocos_joint_trajectory_server/CMakeLists.txt ]; then
if [ ${OROCOS_TARGET}='xenomai' ]; then
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/xenomai/ros_orocos_joint_trajectory_server
else
pathadd RTT_COMPONENT_PATH $ROBOTOLOGY_ROOT/build/install/lib/orocos/gnulinux/ros_orocos_joint_trajectory_server
fi
fi
fi
#gazebo setup
if [ -f /usr/share/gazebo/setup.sh ]; then
source /usr/share/gazebo/setup.sh
fi
if [ -f ${ROBOTOLOGY_ROOT}/external/ros2_ws/install/local_setup.sh ]; then
source ${ROBOTOLOGY_ROOT}/external/ros2_ws/install/local_setup.*
fi
export PATH=$ROBOTOLOGY_ROOT/build/install/bin:$PATH
export LD_LIBRARY_PATH=$ROBOTOLOGY_ROOT/build/install/lib:$LD_LIBRARY_PATH
export LTDL_LIBRARY_PATH=$ROBOTOLOGY_ROOT/build/install/lib/roboptim-core:$LTDL_LIBRARY_PATH
pathadd CMAKE_PREFIX_PATH $ROBOTOLOGY_ROOT/build/install
export ROS_PACKAGE_PATH=$ROBOTOLOGY_ROOT/build/install/share:$ROS_PACKAGE_PATH
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/build/install/stacks
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/IITComanRosPkg
pathadd CPATH $ROBOTOLOGY_ROOT/build/install/include
pathadd CPATH /opt/ros/${ROS_DISTRO}/include
pathadd PYTHONPATH $ROBOTOLOGY_ROOT/build/install/lib/python2.7/site-packages
pathadd PYTHONPATH $ROBOTOLOGY_ROOT/build/install/lib/python2.7/dist-packages
pathadd PYTHONPATH $ROBOTOLOGY_ROOT/external/OpenSoT/python/interfaces/yarp
pathadd PKG_CONFIG_PATH $ROBOTOLOGY_ROOT/build/install/lib/pkgconfig
pathadd GAZEBO_PLUGIN_PATH /opt/ros/indigo/lib
pathadd GAZEBO_PLUGIN_PATH $ROBOTOLOGY_ROOT/build/install/lib
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/IITComanRosPkg/coman_gazebo/database
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/icub_gazebo
if [ -d $ROBOTOLOGY_ROOT/robots/walkman_final_demo_field ]; then
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/walkman_final_demo_field
fi
if [ -d $ROBOTOLOGY_ROOT/robots/iit-bigman-ros-pkg ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/iit-bigman-ros-pkg
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/iit-bigman-ros-pkg/bigman_gazebo/database
fi
if [ -d $ROBOTOLOGY_ROOT/robots/openth/ynl-hydra-ros-pkg ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/openth/ynl-hydra-ros-pkg
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/openth/ynl-hydra-ros-pkg/hydra_gazebo/database
fi
if [ -d $ROBOTOLOGY_ROOT/robots/iit-cogimon-ros-pkg ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/iit-cogimon-ros-pkg
pathadd GAZEBO_MODEL_PATH $ROBOTOLOGY_ROOT/robots/iit-cogimon-ros-pkg/cogimon_gazebo/database
fi
if [ -d $ROBOTOLOGY_ROOT/external/yarp_ros_joint_state_publisher ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/yarp_ros_joint_state_publisher
fi
if [ -d $ROBOTOLOGY_ROOT/external/robot_state_publisher_ext ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/robot_state_publisher_ext
fi
if [ -d ${ROBOTOLOGY_ROOT}/external/ros_orocos_joints_gui ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/ros_orocos_joints_gui
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/ros_orocos_joints_gui/python
fi
if [ -d ${ROBOTOLOGY_ROOT}/robots/centauro-simulator ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/centauro-simulator
fi
if [ -d ${ROBOTOLOGY_ROOT}/robots/gazebo_ros_demos ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/robots/gazebo_ros_demos
fi
if [ -d ${ROBOTOLOGY_ROOT}/external/trajectory_utils ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/trajectory_utils
fi
# vigir stuffs
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_basics ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_basics
fi
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_core ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_core
fi
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_msgs ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_footstep_planning_msgs
fi
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_generic_params ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_generic_params
fi
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_pluginlib ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_pluginlib
fi
if [ -d $ROBOTOLOGY_ROOT/vigir/vigir_terrain_classifier ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/vigir/vigir_terrain_classifier
fi
if [ -d $ROBOTOLOGY_ROOT/external/gazebo-pkgs ]; then
pathadd ROS_PACKAGE_PATH $ROBOTOLOGY_ROOT/external/gazebo-pkgs/gazebo_grasp_plugin
fi
export COMAN_ROOT=${ROBOTOLOGY_ROOT}/build/install
# TODO add a switch here to select correct robot
export YARP_ROBOT_NAME=bigman
export YARP_COLORED_OUTPUT=1
export YARP_DATA_DIRS=${ROBOTOLOGY_ROOT}/build/install/share/yarp/
unset YARP_CLOCK
unalias gazebo > /dev/null 2>&1
unalias gzserver > /dev/null 2>&1
if [ "${ROBOTOLOGY_PROFILE:=DEFAULT}" == "SIMULATION" ]; then
export YARP_CLOCK=/clock
alias gazeboyarp='gazebo --verbose -s libgazebo_yarp_clock.so'
alias gazeboros='export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROBOTOLOGY_ROOT/build/install/lib/drcsim_gazebo_ros_plugins/plugins; gazebo --verbose -s libgazebo_ros_api_plugin.so'
alias gazeborosyarp='export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROBOTOLOGY_ROOT/build/install/lib/drcsim_gazebo_ros_plugins/plugins; gazebo --verbose -s libgazebo_ros_api_plugin.so -s libgazebo_yarp_clock.so'
fi
export YARP_WORKSPACE=${ROBOTOLOGY_ROOT}/robots
if [ -f ${ROBOTOLOGY_ROOT}/external/YARP/scripts/yarp_completion ]; then
source ${ROBOTOLOGY_ROOT}/external/YARP/scripts/yarp_completion
fi
# Some aliases for superbuild/scripts
alias superbuild=". ${ROBOTOLOGY_ROOT}/scripts/superbuild.sh"
source ${ROBOTOLOGY_ROOT}/scripts/superbuild.profile
# add robotology folder for robot models
if [ -d $ROBOTOLOGY_ROOT/build/install/share/robots ]; then
export ROBOTOLOGY_ROBOTS=$ROBOTOLOGY_ROOT/build/install/share/robots
else
unset ROBOTOLOGY_ROBOTS
fi