-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bash
More file actions
executable file
·184 lines (156 loc) · 3.96 KB
/
Copy pathinstall.bash
File metadata and controls
executable file
·184 lines (156 loc) · 3.96 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
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
#!/bin/bash
set -e
# This script is called by install.bash in beam_robotics/scripts
# Specify location of installation scripts
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_SCRIPTS=$SCRIPT_DIR
# Set the repo directory as an environment variable
export REPO_DIR=$SCRIPT_DIR
# get UBUNTU_CODENAME, ROS_DISTRO, CATKIN_DIR
source $INSTALL_SCRIPTS/identify_environment.bash
main() {
menu
parse_arguments $@
install_routine
}
menu() {
echo "Running this script will delete your /build /devel and /logs folders in your $CATKIN_DIR directory and re-build them."
echo "Do you wish to continue? (y/n):"
while read ans; do
case "$ans" in
y) break ;;
n)
exit
break
;;
*) echo "(y/n):" ;;
esac
done
}
parse_arguments() {
# defaults
GTSAM=false
PYTORCH=false
ROBOT=""
echo "Parsing any optional commandline arguments..."
while getopts ":pr:" arg; do
case $arg in
g)
GTSAM=true
echo "-g) GTSAM option <$GTSAM> selected..."
;;
p)
PYTORCH=true
echo "-p) Pytorch option <$PYTORCH> selected..."
;;
r)
ROBOT="$OPTARG"
verify_robot
;;
\?) print_usage ;;
esac
done
}
verify_robot() {
declare -a robot_list=("ig-handle" "ig2" "pierre")
if printf '%s\n' "${robot_list[@]}" | grep -P "$ROBOT" >/dev/null; then
echo "-r) Robot option <$ROBOT> selected..."
else
echo "-r) Robot option <$ROBOT> not available. Exiting."
print_usage
fi
}
print_usage() {
echo "Usage:"
echo " -g: install GTSAM"
echo " -p: install pytorch"
echo " -r: install software on a specific beam robot"
printf " options: "
for val in ${robot_list[@]}; do
printf "$val "
done
printf "\n"
exit 1
}
install_routine() {
sudo -v
# Ensure wget is available
sudo apt-get install -qq wget >/dev/null
# Get UBUNTU_CODENAME, ROS_DISTRO, REPO_DIR, CATKIN_DIR
source $INSTALL_SCRIPTS/identify_environment.bash
# Import functions to install required dependencies
source $INSTALL_SCRIPTS/beam_dependencies_install.bash
if [ "$ROS_DISTRO" = "melodic" ]; then
install_gcc7
fi
if [ "$ROS_DISTRO" = "noetic" ]; then
install_gcc9
fi
# Source catkin setup script
source $INSTALL_SCRIPTS/catkin_setup.bash
# Install ROS
bash $INSTALL_SCRIPTS/ros_install.bash
create_catkin_ws
# Install ROS dependencies
bash $INSTALL_SCRIPTS/rosdeps_install.bash
# Install required development machine dependencies
install_cmake
install_catch2
install_eigen3
install_ceres
install_pcl
install_geographiclib
install_pcap
install_parmetis
install_json
install_dbow3
install_opencv4
install_git_lfs
# Install optional software for development machines
install_docker
if [ "$GTSAM" = true ]; then
install_gtsam
fi
if [ "$PYTORCH" = true ]; then
install_pytorch
fi
# Install beam robot drivers and dependencies
if [ ! -z "$ROBOT" ]; then
source $INSTALL_SCRIPTS/robot_dependencies_install.bash
if [ "$ROBOT" = "ig-handle" ]; then
echo "Installing drivers for $ROBOT..."
install_ig_handle
elif [ "$ROBOT" = "ig2" ]; then
echo "Installing drivers for $ROBOT..."
install_ig_handle
install_husky_packages
elif [ "$ROBOT" = "pierre" ]; then
echo "Installing drivers for $ROBOT..."
install_ig_handle
install_dt100
fi
fi
# Check that ros installed correctly
ROS_CHECK="$(rosversion -d)"
if [ "$ROS_CHECK" == "$ROS_DISTRO" ]; then
echo "Ros install okay"
else
echo $ROS_CHECK
echo $ROS_DISTRO
echo "ROS not installed"
exit
fi
# Check that catkin_ws was created
if [ -d "$CATKIN_DIR" ]; then
echo "Catkin Directory found"
else
echo "Catkin Directory not created"
exit
fi
# Compile
echo "Beam robotics installation completed. Compiling catkin workspace..."
compile
# Echo success
echo "Catkin workspace successfully compiled. Please open a new terminal to re-source environment variables."
}
main $@