-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
57 lines (48 loc) · 1.3 KB
/
setup.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
toplevel_dir=$(realpath $(dirname "$BASH_SOURCE"))
echo "Root is - ${toplevel_dir}"
if [ ! -f "${toplevel_dir}/setup.sh" ]; then
echo "Not in main workspace"
return 0
fi
export PROJECT_ROOT=${toplevel_dir}
# Setup utils
export PROJECT_UTILS_ROOT=${PROJECT_ROOT}/_utils
if [ -z "$CONTROL_ROOT" ]; then
# Not in systemd
source ${PROJECT_UTILS_ROOT}/base.sh
information "Sourced base script"
else
# In systemd - do not have term and tput
function cecho() {
echo "${3}"
}
function information() {
cecho "${1}"
}
function success() {
cecho "${1}"
}
fi
env_file="${PROJECT_ROOT}/.env"
if [ -f "${env_file}" ]; then
export $(cat ${env_file} | xargs)
information "Sourced .env"
fi
# Dirs variabless
export PATH=${PROJECT_UTILS_ROOT}:$PATH
export ROS_DIR=${PROJECT_ROOT}/src
export SIM_DIR=${ROS_DIR}/simulation
export MODELS_DIR=${SIM_DIR}/models
# ROS2
ros_setup_file="${PROJECT_ROOT}/install/setup.sh"
if [ -f "${ros_setup_file}" ]; then
information "Source ROS setup"
source ${ros_setup_file}
fi
# Python config
export PYTHONPATH=${PROJECT_UTILS_ROOT}:$PYTHONPATH
# Setup Gazebo
export GZ_SIM_SYSTEM_PLUGIN_PATH=${GZ_SIM_SYSTEM_PLUGIN_PATH}:${SIM_DIR}/simulation
export SDF_PATH=${SDF_PATH}:${MODELS_DIR}
success "Setup complete"
return 0