-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsetup.sh
More file actions
64 lines (59 loc) · 2.58 KB
/
setup.sh
File metadata and controls
64 lines (59 loc) · 2.58 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
# ********************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
# ********************************************************************************
SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ROS2_WORKSPACE_DIRECTORY="$(realpath "${SCRIPT_DIRECTORY}/ros2_workspace")"
if [ ! -f /.dockerenv ]; then
echo "ERROR: This script must be sourced inside the ADORe CLI context." >&2
return 1
fi
if [ -z "${DISPLAY:-}" ]; then
[ -f /tmp/.adore_display ] && source /tmp/.adore_display 2>/dev/null || export DISPLAY=:99
fi
if [[ "$SHELL" == *"bash"* ]]; then
LOCAL_SETUP_SCRIPT="${ROS2_WORKSPACE_DIRECTORY}/install/local_setup.bash"
ROS_SETUP_SCRIPT="/opt/ros/${ROS_DISTRO}/setup.bash"
elif [[ "$SHELL" == *"zsh"* ]]; then
LOCAL_SETUP_SCRIPT="${ROS2_WORKSPACE_DIRECTORY}/install/local_setup.zsh"
ROS_SETUP_SCRIPT="/opt/ros/${ROS_DISTRO}/setup.zsh"
else
echo shell $SHELL
echo "ERROR: Unsupported shell: $SHELL" >&2
return 1
fi
bash ${SCRIPT_DIRECTORY}/tools/check_adore_binaries.sh
printf "\n"
source "$ROS_SETUP_SCRIPT"
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
if [[ -f "${LOCAL_SETUP_SCRIPT}" ]]; then
set -a
source "${LOCAL_SETUP_SCRIPT}"
set +a
echo "Sourced ${LOCAL_SETUP_SCRIPT} environment"
else
echo "WARNING: ${LOCAL_SETUP_SCRIPT} does not exist. Did you build the ROS workspace?"
echo " To build the ROS nodes with 'cd ros2_workspace && make build' inside the ADORe CLI." >&2
fi
else
echo "ERROR: script designed to be sourced. Call again with 'source setup.sh'" >&2
return 1
fi
source /opt/adore_venv/bin/activate
source "${SCRIPT_DIRECTORY}/adore.env"
PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
export PYTHONPATH="/opt/adore_venv/lib/python${PYVER}/site-packages:/usr/lib/python3/dist-packages:${PYTHONPATH}"
bash ${SCRIPT_DIRECTORY}/tools/adore_api/adore_api.sh
bash ${SCRIPT_DIRECTORY}/tools/start_zenoh_router.sh
bash ${SCRIPT_DIRECTORY}/tools/start_zenoh_bridge.sh
bash ${SCRIPT_DIRECTORY}/tools/start_sumo_bridge.sh
bash ${SCRIPT_DIRECTORY}/tools/start_mqtt_broker.sh
bash ${SCRIPT_DIRECTORY}/tools/start_mqtt_bridge.sh