-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ubuntu18.sh
148 lines (120 loc) · 5.16 KB
/
Ubuntu18.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
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
#!/bin/bash
# InstallScript_AzureKinectMapping_NvidiaJetson_Ubuntu18
# Installation steps/script for mapping with Azure Kinect and Nvidia Jetson on Ubuntu 18 (Jetpack 4.4.1)
# remote desktop: https://www.nomachine.com/download/download&id=116&s=ARM
# add ROS repository
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# add microsoft repository
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
echo 'deb [arch=arm64] https://packages.microsoft.com/ubuntu/18.04/multiarch/prod bionic main' | sudo tee /etc/apt/sources.list.d/microsoft-prod.list
# add GTSAM repository
sudo add-apt-repository ppa:borglab/gtsam-release-4.0
# after upgrade choose gdm3 not lightdm (because screen was gone after choosing lightdm on AGX)
sudo apt upgrade
sudo apt update
sudo apt install \
apt-utils \
build-essential \
checkinstall \
curl \
gperf \
python3-pip \
k4a-tools \
libk4a1.4 \
libk4a1.4-dev \
libcanberra-gtk-module \
libgtsam-dev \
libgtsam-unstable-dev \
libogg-dev \
libqt4-dev \
libssl-dev \
mlocate \
python-catkin-tools \
ros-melodic-libg2o \
ros-melodic-pcl-ros \
ros-melodic-imu-filter-madgwick \
ros-melodic-tf2-geometry-msgs \
ros-melodic-rtabmap-ros \
sudo -H pip3 install -U jetson-stats
sudo updatedb
# Add rules for Azure Kinect
sudo wget -O /etc/udev/rules.d/99-k4a.rules https://github.com/microsoft/Azure-Kinect-Sensor-SDK/raw/develop/scripts/99-k4a.rules
# Make directory for packages that need to be build
mkdir ~/Repos && cd ~/Repos
# CMake
git clone https://github.com/Kitware/CMake
mkdir CMake/build && cd CMake/build
../bootstrap && make -j$(($(nproc) - 2))
sudo checkinstall --pkgname cmake --pkgversion 3.19.2 --provides cmake -y
cd ../..
# libnabo (needed for libpointmatcher)
git clone git://github.com/ethz-asl/libnabo.git
mkdir libnabo/build
cd libnabo/build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j$(($(nproc) - 2))
sudo make install
cd ../..
# libpointmatcher
git clone https://github.com/ethz-asl/libpointmatcher
mkdir libpointmatcher/build
cd libpointmatcher/build
cmake ..
make -j$(($(nproc) - 2))
sudo make install
cd ../..
sudo rm /usr/lib/aarch64-linux-gnu/libvtk*Qt*
sudo rm /usr/lib/cmake/vtk-6.3/Modules/vtkGUISupportQtWebkit.cmake
# get vtk6.3.0 files depending on Qt build with Qt4
wget "https://github.com/introlab/rtabmap/files/3457605/vtk6.3.0-arm64-qt4-libs-cmake.zip" -O vtk.zip
sudo unzip -j -d /usr/lib/aarch64-linux-gnu/ -o vtk.zip *.so*
sudo unzip -j -d /usr/lib/cmake/vtk-6.3/Modules/ -o vtk.zip *.cmake*
sudo cp /usr/lib/cmake/vtk-6.3/VTKTargets.cmake /usr/lib/cmake/vtk-6.3/VTKTargets.backup
sudo cp /usr/lib/cmake/vtk-6.3/VTKTargets-none.cmake /usr/lib/cmake/vtk-6.3/VTKTargets-none.backup
sudo sed -i 's/;Qt5::[^;|"]*//g' /usr/lib/cmake/vtk-6.3/VTKTargets.cmake
sudo sed -i 's/^.*"Qt5::[^;]*"$//g' /usr/lib/cmake/vtk-6.3/VTKTargets-none.cmake
sudo sed -i 's/;Qt5::[^;|"]*//g' /usr/lib/cmake/vtk-6.3/VTKTargets-none.cmake
# creating new links
cd /usr/lib/aarch64-linux-gnu
sudo ln -s libvtkGUISupportQtOpenGL-6.3.so.1 libvtkGUISupportQtOpenGL-6.3.so.6.3.0
sudo ln -s libvtkGUISupportQt-6.3.so.1 libvtkGUISupportQt-6.3.so.6.3.0
sudo ln -s libvtkRenderingQt-6.3.so.1 libvtkRenderingQt-6.3.so.6.3.0
sudo ln -s libvtkGUISupportQtSQL-6.3.so.1 libvtkGUISupportQtSQL-6.3.so.6.3.0
sudo ln -s libvtkViewsQt-6.3.so.1 libvtkViewsQt-6.3.so.6.3.0
sudo ln -s libvtkInteractionStyle-6.3.so.6.3.0 libvtkInteractionStyle-6.3.so.1
sudo ln -s libvtkRenderingOpenGL-6.3.so.6.3.0 libvtkRenderingOpenGL-6.3.so.1
sudo ln -s libvtkRenderingCore-6.3.so.6.3.0 libvtkRenderingCore-6.3.so.1
sudo ln -s libvtkFiltersExtraction-6.3.so.6.3.0 libvtkFiltersExtraction-6.3.so.1
sudo ln -s libvtkCommonDataModel-6.3.so.6.3.0 libvtkCommonDataModel-6.3.so.1
sudo ln -s libvtkCommonCore-6.3.so.6.3.0 libvtkCommonCore-6.3.so.1
sudo apt remove ros-melodic-rtabmap # no autoremove after that
source /opt/ros/melodic/setup.bash
# Build RtabMap with Qt4
cd ~/Repos
git clone https://github.com/introlab/rtabmap.git
cd rtabmap/build
cmake -DBUILD_EXAMPLES=OFF -DRTABMAP_QT_VERSION=4 ..
make -j$(($(nproc) - 2))
sudo make install
# config file for Azure Kinect
wget -O ~/.rtabmap/rtabmap.ini http://official-rtab-map-forum.67519.x6.nabble.com/file/n7187/config_k4a_icp_v3.ini
# start and test RtabMap
rtabmap
# create catkin workspace and download ros packages
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
catkin init
cd .. && catkin build
cd src
git clone https://github.com/ChemicalNRG/Azure_Kinect_ROS_Driver.git
git clone https://github.com/ros-perception/image_transport_plugins.git --branch noetic-devel --single-branch
git clone https://github.com/ros-perception/image_common.git --branch noetic-devel --single-branch
git clone https://github.com/BrutusTT/vision_opencv.git
git clone https://github.com/introlab/rtabmap_ros
# build the packages
cd ..
catkin build -j1 --cmake-args -DCATKIN_ENABLE_TESTING=False -DRTABMAP_QT_VERSION=4 -DCMAKE_BUILD_TYPE=Release
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
# test rtabmap_ros