-
Notifications
You must be signed in to change notification settings - Fork 64
/
env.sh
62 lines (49 loc) · 2.65 KB
/
env.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
62
#!/bin/bash
#####
# User input data: INSERT VALID VALUES ACCORDING TO YOUR SYSTEM
#####
# Set the ROS2 SDK workspace install path:
ROS2_SDK_INSTALL_PATH="/opt/ros/rolling"
# Set the performance test workspace install path:
ROS2_PERFORMANCE_TEST_INSTALL_PATH="/root/ws/install"
# Have the workspaces (ROS2 SDK and performance test) been compiled using --merge-install option?
MERGE_INSTALL=false
#####
# env.sh script: DO NOT MODIFY BELOW THIS LINE!!!
#####
# Performance Test Framework package containing the example executables
PERFORMANCE_TEST_EXAMPLES_PKG="performance_test_factory"
# Performance Test Framework package containing the benchmark application
PERFORMANCE_TEST_BENCHMARK_PKG="irobot_benchmark"
# Check if the specified directories exist
if [ ! -d "$ROS2_PERFORMANCE_TEST_INSTALL_PATH" ]; then
echo "Directory $ROS2_PERFORMANCE_TEST_INSTALL_PATH doesn't exist."
echo "Check if the ROS2_PERFORMANCE_TEST_INSTALL_PATH is correct"
return 1
fi
if [ ! -d "$ROS2_SDK_INSTALL_PATH" ]; then
echo "Directory $ROS2_SDK_INSTALL_PATH doesn't exist."
echo "Check if the ROS2_SDK_INSTALL_PATH is correct"
return 1
fi
if [ "$MERGE_INSTALL" = true ]; then
# With --merge-install `colcon_build` creates a common directory for all libraries in the workspace
ROS2_SDK_LIBRARIES="$ROS2_SDK_INSTALL_PATH/lib"
ROS2_PERFORMANCE_TEST_LIBRARIES="$ROS2_PERFORMANCE_TEST_INSTALL_PATH/lib"
ROS2_PERFORMANCE_TEST_EXECUTABLES_PATH="$ROS2_PERFORMANCE_TEST_LIBRARIES/$PERFORMANCE_TEST_EXAMPLES_PKG"
ROS2_PERFORMANCE_TEST_BENCHMARK_PATH="$ROS2_PERFORMANCE_TEST_LIBRARIES/$PERFORMANCE_TEST_BENCHMARK_PKG"
else
# Without --merge-install `colcon_build` creates a subdirectory for each package
ROS2_SDK_LIBRARIES="$(find $ROS2_SDK_INSTALL_PATH -name '*.so*' -printf '%h\n' | sort -u )"
ROS2_SDK_LIBRARIES="${ROS2_SDK_LIBRARIES//$'\n'/:}"
ROS2_PERFORMANCE_TEST_LIBRARIES="$(find $ROS2_PERFORMANCE_TEST_INSTALL_PATH -name '*.so*' -printf '%h\n' | sort -u )"
ROS2_PERFORMANCE_TEST_LIBRARIES="${ROS2_PERFORMANCE_TEST_LIBRARIES//$'\n'/:}"
ROS2_PERFORMANCE_TEST_EXECUTABLES_PATH="$ROS2_PERFORMANCE_TEST_INSTALL_PATH/$PERFORMANCE_TEST_EXAMPLES_PKG/lib/$PERFORMANCE_TEST_EXAMPLES_PKG"
ROS2_PERFORMANCE_TEST_BENCHMARK_PATH="$ROS2_PERFORMANCE_TEST_INSTALL_PATH/$PERFORMANCE_TEST_BENCHMARK_PKG/lib/$PERFORMANCE_TEST_BENCHMARK_PKG"
fi
# Add the libraries to the shared libraries path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROS2_SDK_LIBRARIES:$ROS2_PERFORMANCE_TEST_LIBRARIES
# Specify where the C++ executables installed are located
export ROS2_PERFORMANCE_TEST_EXECUTABLES_PATH
export ROS2_PERFORMANCE_TEST_BENCHMARK_PATH
echo "Environment sourced correctly!"