-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
179 lines (155 loc) · 6.71 KB
/
Dockerfile
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
# Copyright (C) 2022, Raffaello Bonghi <[email protected]>
# All rights reserved
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Jetpack 4.6.1
# Docker file for aarch64 based Jetson device
FROM dustynv/ros:foxy-ros-base-l4t-r32.7.1
# L4T variables
ENV L4T=32.7
ENV L4T_MINOR_VERSION=7.1
# Configuration CUDA
ENV CUDA=10.2
# Disable terminal interaction for apt
ENV DEBIAN_FRONTEND=noninteractive
# Install OpenCV dependencies
RUN apt-get update && apt-get install -y \
libavformat-dev \
libjpeg-dev \
libopenjp2-7-dev \
libpng-dev \
libpq-dev \
libswscale-dev \
libtbb2 \
libtbb-dev \
libtiff-dev \
pkg-config \
yasm && \
rm -rf /var/lib/apt/lists/*
# Install additional packages needed for ROS2 dependencies
RUN apt-get update && apt-get install -y \
python3-distutils \
libboost-all-dev \
libboost-dev \
libpcl-dev \
libode-dev \
lcov \
python3-zmq \
libxaw7-dev \
libgraphicsmagick++1-dev \
graphicsmagick-libmagick-dev-compat \
libceres-dev \
libsuitesparse-dev \
libncurses5-dev \
libassimp-dev \
libyaml-cpp-dev \
libpcap-dev && \
rm -rf /var/lib/apt/lists/*
# Install Git-LFS and other packages
RUN apt-get update && apt-get install -y \
git-lfs \
software-properties-common && \
rm -rf /var/lib/apt/lists/*
# Fix cuda info
ARG DPKG_STATUS
# Add nvidia repo/public key and install VPI libraries
RUN echo "$DPKG_STATUS" >> /var/lib/dpkg/status && \
curl https://repo.download.nvidia.com/jetson/jetson-ota-public.asc > /etc/apt/trusted.gpg.d/jetson-ota-public.asc && \
echo "deb https://repo.download.nvidia.com/jetson/common r${L4T} main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
apt-get update && apt-get install -y libnvvpi1 vpi1-dev && \
rm -rf /var/lib/apt/lists/*
# Update environment
ENV LD_LIBRARY_PATH="/opt/nvidia/vpi1/lib64:${LD_LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra:${LD_LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda-${CUDA}/targets/aarch64-linux/lib:${LD_LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra-egl:${LD_LIBRARY_PATH}"
# Install pcl_conversions & sensor_msgs_py
COPY nanosaur_perception/rosinstall/isaac_ros_fix.rosinstall isaac_ros_fix.rosinstall
RUN mkdir -p ${ROS_ROOT}/src && \
vcs import ${ROS_ROOT}/src < isaac_ros_fix.rosinstall && \
. /opt/ros/$ROS_DISTRO/install/setup.sh && \
cd ${ROS_ROOT} && \
rosdep install -y --ignore-src --from-paths src --rosdistro foxy && \
colcon build --merge-install --packages-up-to pcl_conversions sensor_msgs_py diagnostic_updater xacro && \
rm -Rf src logs build
# Install gcc8 for cross-compiled binaries from Ubuntu 20.04
RUN apt-get update && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get install -y gcc-8 g++-8 libstdc++6 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \
rm -rf /usr/bin/aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-g++ \
/usr/bin/aarch64-linux-gnu-g++-7 /usr/bin/aarch64-linux-gnu-gcc-7 && \
update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc \
/usr/bin/gcc-8 8 && \
update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ \
/usr/bin/g++-8 8 && \
rm -rf /var/lib/apt/lists/*
# https://github.com/dusty-nv/jetson-containers/issues/181
# https://github.com/dusty-nv/jetson-containers/pull/183
RUN apt-get update -y && \
apt-get install -y --allow-downgrades cmake-data=3.23.2-0kitware1ubuntu18.04.1 cmake=3.23.2-0kitware1ubuntu18.04.1 && apt-mark hold cmake cmake-data && \
rm -rf /var/lib/apt/lists/*
################ INSTALL ISAAC ROS ####################
# Download and build nanosaur_isaac_ros
ENV ISAAC_ROS_WS /opt/isaac_ros_ws
# Copy wstool isaac_ros.rosinstall
COPY nanosaur_perception/rosinstall/isaac_ros.rosinstall isaac_ros.rosinstall
RUN apt-get update && \
apt-get install python3-vcstool python3-pip -y && \
mkdir -p ${ISAAC_ROS_WS}/src && \
vcs import ${ISAAC_ROS_WS}/src < isaac_ros.rosinstall && \
rm -rf /var/lib/apt/lists/*
# Pull LFS files
COPY nanosaur_perception/scripts/git_lfs_pull_ws.sh git_lfs_pull_ws.sh
RUN TERM=xterm bash git_lfs_pull_ws.sh ${ISAAC_ROS_WS}/src
# Change workdir
WORKDIR $ISAAC_ROS_WS
# Build Isaac ROS
RUN . /opt/ros/$ROS_DISTRO/install/setup.sh && \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release
################ NANOSAUR PKGS ####################
# Download and build nanosaur_perception
ENV ROS_WS /opt/ros_ws
RUN mkdir -p ${ROS_WS}/src
ADD . $ROS_WS/src/nanosaur_perception
# Change workdir
WORKDIR $ROS_WS
# Build Isaac ROS
RUN . /opt/ros/$ROS_DISTRO/install/setup.sh && \
. $ISAAC_ROS_WS/install/setup.sh && \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release
################ Final enviroment setup ####################
# Restore using the default Foxy DDS middleware: FastRTPS
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp
STOPSIGNAL SIGINT
# source ros package from entrypoint
RUN sed --in-place --expression \
'$isource "$ROS_WS/install/setup.bash"' \
/ros_entrypoint.sh
# run ros package launch file
CMD ["ros2", "launch", "nanosaur_perception", "perception.launch.py"]