-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile_pf.l4t35-humble-release
185 lines (149 loc) · 8.07 KB
/
Dockerfile_pf.l4t35-humble-release
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
ARG IMAGE_NAME=dustynv/ros:humble-ros-base-l4t-r32.7.1
FROM ${IMAGE_NAME}
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0
ARG ZED_SDK_PATCH=7
ARG JETPACK_MAJOR=4
ARG JETPACK_MINOR=6
ARG L4T_MAJOR=32
ARG L4T_MINOR=6
ARG ROS2_DIST=humble # ROS2 distribution
# ZED ROS2 Wrapper dependencies version
ARG XACRO_VERSION=2.0.9
ARG DIAGNOSTICS_VERSION=3.1.2
ARG AMENT_LINT_VERSION=0.16.1
ARG GEOGRAPHIC_INFO_VERSION=1.0.5
ARG ROBOT_LOCALIZATION_VERSION=3.6.0
ENV DEBIAN_FRONTEND noninteractive apt --fix-broken -y install
# Disable apt-get warnings
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42D5A192B819C5DA || true && \
apt-get update || true && apt-get install -y --no-install-recommends apt-utils dialog && \
rm -rf /var/lib/apt/lists/*
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get update && \
apt-get install --yes lsb-release wget less udev sudo build-essential cmake python3 python3-dev python3-pip python3-wheel git jq libpq-dev zstd usbutils\
libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev \
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \
yasm libatlas-base-dev gfortran libpq-dev \
libxine2-dev libglew-dev libtiff5-dev zlib1g-dev libavutil-dev libpostproc-dev \
libeigen3-dev python3-numpy libx11-dev tzdata && \
rm -rf /var/lib/apt/lists/*
## Update g++ and gcc to 11
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt install -y gcc-11 && \
apt install -y g++-11 &&\
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 && \
update-alternatives --config gcc && \
update-alternatives --config g++
RUN apt install --yes build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev
########### INSTALLING OPENCV ########
RUN apt-get purge -y '*opencv*'
### since rosdep insatlls old verion of opencv3.2 and i need 4.5 i need to install it from scratch and add path to LD_LIBRARY_PATH
# OpenCV Version
ARG OPENCV_VERSION="4.7.0"
RUN mkdir ~/opencv_build && cd ~/opencv_build && \
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && \
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
cd ~/opencv_build/opencv && \
mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/ \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
-D PYTHON_DEFAULT_EXECUTABLES=$(which python3) \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON .. && \
make -j8 && \
sudo make install
########### FINISH INSTALLING OPENCV ########
# Copy files from your host to your current working directory
COPY ZED_SDK_Tegra_L4T32.7_v4.0.8.zstd.run .
# Install the ZED SDK
RUN python3 -m pip install --upgrade pip
RUN echo "# R${L4T_MAJOR} (release), REVISION: ${L4T_MINOR}" > /etc/nv_tegra_release && \
apt-get update -y || true && \
apt-get install -y --no-install-recommends zstd wget less cmake curl gnupg2 \
build-essential python3 python3-dev python3-pip python3-setuptools libusb-1.0-0-dev -y && \
pip install protobuf && \
sudo chmod +x ZED_SDK_Tegra_L4T32.7_v4.0.8.zstd.run && \
./ZED_SDK_Tegra_L4T32.7_v4.0.8.zstd.run -- silent skip_tools && \
rm -rf /usr/local/zed/resources/* && \
rm -rf ZED_SDK_Tegra_L4T32.7_v4.0.8.zstd.run && \
rm -rf /var/lib/apt/lists/*
########### INSTALLING ASSIMP ########
RUN git clone https://github.com/assimp/assimp.git && \
cd assimp && \
cmake CMakeLists.txt && \
make -j$(nproc) && \
make install
########### FINISH INSTALLING ASSIMP ########
# Install the ZED ROS2 Wrapper
ENV ROS_DISTRO ${ROS2_DIST}
# Install the ZED ROS2 Wrapper
WORKDIR /root/ros2_ws/src
RUN wget http://dlib.net/files/dlib-19.17.tar.bz2 && \
tar jxvf dlib-19.17.tar.bz2 && \
cd dlib-19.17 && \
sed -i 's/forward_algo = forward_best_algo;/\/\/forward_algo = forward_best_algo;/' dlib/cuda/cudnn_dlibapi.cpp && \
python3 setup.py install
#RUN pip3 install pysmartthings
#COPY mediapipe-bin/ .
#RUN cd mediapipe-bin && pip3 install numpy-1.19.4-cp36-none-manylinux2014_aarch64.whl mediapipe-0.8.5_cuda102-cp36-none-linux_aarch64.whl && \
# pip3 install dataclasses
# Install missing dependencies
WORKDIR /root/ros2_ws/src
RUN wget https://github.com/ros/xacro/archive/refs/tags/${XACRO_VERSION}.tar.gz -O - | tar -xvz && mv xacro-${XACRO_VERSION} xacro && \
wget https://github.com/ros/diagnostics/archive/refs/tags/${DIAGNOSTICS_VERSION}.tar.gz -O - | tar -xvz && mv diagnostics-${DIAGNOSTICS_VERSION} diagnostics && \
wget https://github.com/ament/ament_lint/archive/refs/tags/${AMENT_LINT_VERSION}.tar.gz -O - | tar -xvz && mv ament_lint-${AMENT_LINT_VERSION} ament-lint && \
wget https://github.com/cra-ros-pkg/robot_localization/archive/refs/tags/${ROBOT_LOCALIZATION_VERSION}.tar.gz -O - | tar -xvz && mv robot_localization-${ROBOT_LOCALIZATION_VERSION} robot-localization && \
wget https://github.com/ros-geographic-info/geographic_info/archive/refs/tags/${GEOGRAPHIC_INFO_VERSION}.tar.gz -O - | tar -xvz && mv geographic_info-${GEOGRAPHIC_INFO_VERSION} geographic-info && \
cp -r geographic-info/geographic_msgs/ . && \
rm -rf geographic-info && \
git clone --recursive https://github.com/olaghattas/zed-ros2-wrapper.git -b jetson && \
git clone https://github.com/ros-drivers/nmea_msgs.git --branch ros2 && \
git clone https://github.com/ros/angles.git --branch humble-devel && \
git clone https://github.com/MarzanShuvo/apriltag.git && \
git clone https://github.com/olaghattas/jetson_zed_setup.git && \
git clone https://github.com/olaghattas/apriltag_ros.git -b foxy-devel && \
git clone https://github.com/olaghattas/shr_utils.git && \
git clone https://github.com/olaghattas/face_recognition_zed.git && \
git clone https://github.com/olaghattas/particle_filter_msgs.git && \
git clone https://github.com/olaghattas/particle_filter_mesh.git -b multiple_cams
WORKDIR /root/ros2_ws/src/face_recognition_zed
RUN git pull
RUN pip install face_recognition
WORKDIR /root/ros2_ws
RUN apt-get update -y || true && rosdep fix-permissions && rosdep update && \
rosdep install --from-paths src --ignore-src --skip-keys "libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" -r -y && \
rm -rf /var/lib/apt/lists/*
# Install cython
RUN python3 -m pip install --upgrade cython
# Build the dependencies and the ZED ROS2 Wrapper
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/install/setup.bash && \
colcon build --parallel-workers $(nproc) \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' "
RUN ln -sf /usr/lib/aarch64-linux-gnu/libopencv_calib3d.so.4.7.0 /usr/lib/aarch64-linux-gnu/libopencv_calib3d.so.4.5 && \
ln -sf /usr/lib/aarch64-linux-gnu/libopencv_imgproc.so.4.7.0 /usr/lib/aarch64-linux-gnu/libopencv_imgproc.so.4.5 && \
ln -sf /usr/lib/aarch64-linux-gnu/libopencv_core.so.4.7.0 /usr/lib/aarch64-linux-gnu/libopencv_core.so.4.5 && \
ln -sf /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.4.7.0 /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.4.5 && \
ln -sf /usr/lib/aarch64-linux-gnu/libassimp.so.4 /usr/lib/aarch64-linux-gnu/libassimp.so.5
WORKDIR /root/ros2_ws
# Setup environment variables
COPY ros_entrypoint_jetson.sh /sbin/ros_entrypoint.sh
RUN sudo chmod 755 /sbin/ros_entrypoint.sh && \
echo "source /root/ros2_ws/install/setup.bash" >> ~/.bashrc
ENTRYPOINT ["/sbin/ros_entrypoint.sh"]
CMD ["bash"]