-
Notifications
You must be signed in to change notification settings - Fork 150
/
install_sensors.bash
220 lines (183 loc) · 5.83 KB
/
install_sensors.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
#!/bin/bash
# Copyright (c) 2021 Juan Miguel Jimeno
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
BASE=$1
LASER_SENSOR=$2
DEPTH_SENSOR=$3
ARCH="$(uname -m)"
ROSDISTRO=$4
WORKSPACE="/root/linorobot2_ws"
ROBOT_TYPE_ARRAY=(2wd 4wd mecanum)
DEPTH_SENSOR_ARRAY=(realsense zed zedm zed2 zed2i oakd oakdlite oakdpro)
LASER_SENSOR_ARRAY=(ydlidar xv11 ld06 ld19 stl27l a1 a2 a3 c1 s1 s2 s3 ldlidar)
LASER_SENSOR_ARRAY+=(${DEPTH_SENSOR_ARRAY[@]})
if [ -z "$LASER_SENSOR" ]
then
LASER_SENSOR=""
fi
if [ -z "$DEPTH_SENSOR" ]
then
DEPTH_SENSOR=""
fi
function install_cuda_jetson {
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/sbsa/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_arm64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_arm64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub #verify this
sudo apt-get update
sudo apt-get -y install cuda
# Errors were encountered while processing:
# /tmp/apt-dpkg-install-TvUCLd/14-libnvidia-compute-470_470.57.02-0ubuntu1_arm64.deb
# /tmp/apt-dpkg-install-TvUCLd/18-libnvidia-gl-470_470.57.02-0ubuntu1_arm64.deb
# E: Sub-process /usr/bin/dpkg returned an error code (1)
}
function install_xv11 {
cd $WORKSPACE
git clone https://github.com/mjstn/xv_11_driver src/xv_11_driver
colcon build
source $WORKSPACE/install/setup.bash
}
function install_ydlidar {
cd /tmp
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
mkdir YDLidar-SDK/build
cd YDLidar-SDK/build
cmake ..
make
sudo make install
cd $WORKSPACE
git clone https://github.com/YDLIDAR/ydlidar_ros2_driver src/ydlidar_ros2_driver
chmod 0777 src/ydlidar_ros2_driver/startup/*
colcon build --symlink-install
source $WORKSPACE/install/setup.bash
}
function install_ldlidar {
cd $WORKSPACE
git clone https://github.com/linorobot/ldlidar src/ldlidar
colcon build
source $WORKSPACE/install/setup.bash
}
function install_ldlidar_stl_ros2 {
cd $WORKSPACE
git clone https://github.com/hippo5329/ldlidar_stl_ros2.git src/ldlidar_stl_ros2
colcon build
source $WORKSPACE/install/setup.bash
}
function install_ld06 {
install_ldlidar_stl_ros2
}
function install_ld19 {
install_ldlidar_stl_ros2
}
function install_stl27l {
install_ldlidar_stl_ros2
}
function install_sllidar_ros2 {
cd $WORKSPACE
git clone https://github.com/Slamtec/sllidar_ros2.git
colcon build
source $WORKSPACE/install/setup.bash
}
function install_a1 {
install_sllidar_ros2
}
function install_a2 {
install_sllidar_ros2
}
function install_a3 {
install_sllidar_ros2
}
function install_c1 {
install_sllidar_ros2
}
function install_s1 {
install_sllidar_ros2
}
function install_s2 {
install_sllidar_ros2
}
function install_s3 {
install_sllidar_ros2
}
function install_realsense {
sudo apt-get install -y ros-$ROS_DISTRO-realsense2-camera
cd /tmp
wget https://raw.githubusercontent.com/IntelRealSense/librealsense/master/config/99-realsense-libusb.rules
}
function install_astra {
cd $WORKSPACE
sudo apt-get install -y libuvc-dev libopenni2-dev
git clone https://github.com/linorobot/ros_astra_camera src/ros_astra_camera
colcon build
source $WORKSPACE/install/setup.bash
}
function install_zed {
cd /tmp
if [[ -f /etc/nv_tegra_release ]]
then
#TODO ADD CUDA INSTALLATION HERE
wget https://download.stereolabs.com/zedsdk/3.5/jp45/jetsons -O zed_sdk
elif lspci | grep VGA | grep -o NVIDIA
then
wget https://download.stereolabs.com/zedsdk/3.5/cu111/ubuntu20 -O zed_sdk
else
echo "Linux Machine not supported by Zed Camera"
exit 1
fi
chmod +x zed_sdk
./zed_sdk -- silent
cd $WORKSPACE
git clone https://github.com/stereolabs/zed-ros2-wrapper src/zed-ros2-wrapper
git clone https://github.com/ros-perception/image_common -b $ROS_DISTRO src/image_common #https://github.com/stereolabs/zed-ros2-wrapper#image-transport-and-topic-subscriptions
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
# colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --cmake-args=-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4
source $WORKSPACE/install/setup.bash
source ~/.bashrc
}
function install_zedm {
install_zed
}
function install_zed2 {
install_zed
}
function install_zed2i {
install_zed
}
function install_oakd {
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
sudo apt-get install ros-$ROS_DISTRO-depthai-ros
}
function install_oakdlite {
install_oakd
}
function install_oakdpro {
install_oakd
}
echo
echo "INSTALLING SENSORS NOW ..."
echo
source /opt/ros/$ROS_DISTRO/setup.bash
sudo apt-get update
if (printf '%s\n' "${LASER_SENSOR_ARRAY[@]}" | grep -xq $LASER_SENSOR)
then
install_$LASER_SENSOR
fi
if (printf '%s\n' "${DEPTH_SENSOR_ARRAY[@]}" | grep -xq $DEPTH_SENSOR)
then
install_$DEPTH_SENSOR
fi