Skip to content

Commit 2fd1cc4

Browse files
authored
Merge pull request #36 from ACFR-RPG/jm/orin
2 parents 9157c3d + dbf1e50 commit 2fd1cc4

112 files changed

Lines changed: 8109 additions & 2492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 246 additions & 342 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ RUN apt-get update \
3232
# ROS installs
3333
RUN apt-get install -y \
3434
ros-kilted-ros2cli-common-extensions \
35-
ros-kilted-vision-opencv
35+
ros-kilted-vision-opencv \
36+
nlohmann-json3-dev
3637

3738
# other deps
3839
RUN apt-get install libpng++-dev

docker/Dockerfile.l4t_jetpack6

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
FROM rwthika/ros2-torch:jazzy-ros-base-torch2.5.0
2+
3+
MAINTAINER Jesse Morris "jesse.morris@sydney.edu.au"
4+
5+
6+
# To avoid tzdata asking for geographic location...
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
#Install build dependencies
10+
RUN apt-get update && apt-get upgrade -y --allow-downgrades --no-install-recommends apt-utils
11+
RUN apt-get update && apt-get install -y --allow-downgrades git cmake build-essential pkg-config
12+
# Install xvfb to provide a display to container for GUI realted testing.
13+
RUN apt-get update && apt-get install -y --allow-downgrades xvfb
14+
15+
# In the arm64 version of the base image we do not have the nvidia-cuda-development toolkit
16+
# as explained https://github.com/ika-rwth-aachen/docker-ros-ml-images/issues/16
17+
# this contains nvcc (ie we dont have it)
18+
# we need nvcc to build opencv with cuda
19+
# add extra nvidia container apt repository (otherwise we cannot find nvidia-cuda-toolkit)
20+
RUN curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
21+
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
22+
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
23+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
24+
25+
26+
#NOTE: both nvidia-cuda-toolkit and cuda-toolkit are needed (particularly for header files)
27+
RUN apt-get update \
28+
&& apt-get install -y \
29+
python3-pip \
30+
openssh-client \
31+
software-properties-common \
32+
nano \
33+
vim \
34+
clang-format \
35+
nvidia-cuda-toolkit \
36+
cuda-toolkit \
37+
libnvinfer-dev \
38+
libnvonnxparsers-dev \
39+
tensorrt-dev \
40+
&& pip3 install black pre-commit \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
44+
45+
# # ROS installs
46+
RUN apt-get update && apt-get install -y \
47+
ros-jazzy-ros2cli-common-extensions \
48+
ros-jazzy-cv-bridge \
49+
ros-jazzy-vision-opencv \
50+
ros-jazzy-pcl-ros \
51+
ros-jazzy-rmw-fastrtps-cpp \
52+
ros-jazzy-rmw-zenoh-cpp \
53+
ros-jazzy-image-transport \
54+
libpcl-conversions-dev
55+
56+
# other deps
57+
# RUN apt-get install libpng++-dev
58+
# is libpng-dev different from libpng++? I think not available as a apt for aarm64
59+
# RUN apt-get install libpng-dev
60+
61+
RUN python3 -m pip install pylatex evo setuptools pre-commit scipy argcomplete black pre-commit
62+
63+
# Install glog, gflags
64+
RUN apt-get update && apt-get install -y libgflags2.2 libgflags-dev libgoogle-glog-dev
65+
66+
# Install xvfb to provide a display to container for GUI realted testing.
67+
# vtk is needed for OpenCV to build its viz module (from contrib!)
68+
RUN apt-get update && apt-get install -y xvfb python3-dev python3-setuptools libvtk9-dev
69+
70+
RUN pip3 install setuptools pre-commit scipy matplotlib argcomplete
71+
72+
# install CSparse
73+
RUN DEBIAN_FRONTEND=noninteractive apt install -y libsuitesparse-dev
74+
75+
RUN python3 -m pip install "ultralytics==8.3.0" "numpy<2.0" "opencv-python<5.0"
76+
RUN python3 -m pip install https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.23.0-cp310-cp310-linux_aarch64.whl
77+
78+
# Parallelism C++ for CPU
79+
RUN apt-get update && apt-get install -y libboost-all-dev libtbb-dev
80+
81+
WORKDIR /root/
82+
83+
84+
85+
# Install OpenCV for Ubuntu
86+
RUN apt-get update && apt-get install -y \
87+
unzip \
88+
libjpeg-dev libpng-dev libpng++-dev libtiff-dev libgtk2.0-dev \
89+
libatlas-base-dev gfortran
90+
91+
92+
RUN git clone https://github.com/opencv/opencv.git
93+
RUN cd opencv && \
94+
git checkout tags/4.10.0 && \
95+
mkdir build
96+
97+
RUN git clone https://github.com/opencv/opencv_contrib.git
98+
RUN cd opencv_contrib && \
99+
git checkout tags/4.10.0
100+
101+
# on aarch64 there is no binary for nlohmann-json3
102+
RUN git clone https://github.com/nlohmann/json.git
103+
RUN cd json && mkdir build && \
104+
cd build && \
105+
cmake .. && make -j$(nproc) install
106+
107+
# OpenCV looks for the cuDNN version in cudnn_version.h, but it's been renamed to cudnn_version_v8.h
108+
RUN ln -sfnv /usr/include/$(uname -i)-linux-gnu/cudnn_version_v*.h /usr/include/$(uname -i)-linux-gnu/cudnn_version.h
109+
110+
# IMPORTANT: must specify CXX_17 version. Default is c++11 which will cause compilation issues
111+
# On aarch64 we can enable NEON for CPU level optimisations
112+
# It is vital we use gcc-11 as otheriwise we cannot compile the cuda level code (ie. CUDA 12.9)
113+
RUN cd opencv/build && \
114+
cmake -DCMAKE_BUILD_TYPE=Release \
115+
-DCMAKE_INSTALL_PREFIX=/usr/local \
116+
-DCMAKE_CXX_STANDARD=17 \
117+
-D BUILD_opencv_python=OFF \
118+
-D BUILD_opencv_python2=OFF \
119+
-D BUILD_opencv_python3=ON \
120+
-D WITH_CUDA=ON \
121+
-D WITH_CUDNN=ON \
122+
-D INSTALL_CUDA_LIBS=OFF \
123+
-D CUDA_ARCH_PTX= \
124+
-D CUDA_ARCH_BIN=8.7 \
125+
-D CUDNN_INCLUDE_DIR=/usr/include/$(uname -i)-linux-gnu \
126+
-D OPENCV_DNN_CUDA=ON \
127+
-D ENABLE_FAST_MATH=ON \
128+
-D CUDA_FAST_MATH=ON \
129+
-D WITH_VTK=ON \
130+
-D WITH_CUFFT=ON \
131+
-D WITH_CUBLAS=ON \
132+
-D WITH_TBB=ON \
133+
-DENABLE_NEON=ON \
134+
-D BUILD_TESTS=OFF \
135+
-D BUILD_PERF_TESTS=OFF \
136+
-D BUILD_opencv_ts=OFF \
137+
-D BUILD_opencv_sfm=OFF \
138+
-D BUILD_JAVA=OFF \
139+
-DOPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules .. && \
140+
make -j$(nproc) install
141+
142+
RUN git clone https://github.com/MIT-SPARK/config_utilities.git
143+
RUN cd config_utilities/config_utilities && mkdir build && \
144+
cd build && \
145+
cmake .. && make -j$(nproc) install
146+
147+
148+
149+
# Install GTSAM
150+
RUN git clone https://github.com/borglab/gtsam.git
151+
RUN cd gtsam && \
152+
git fetch && \
153+
git checkout tags/4.2.0 && \
154+
mkdir build && \
155+
cd build && \
156+
cmake -DCMAKE_INSTALL_PREFIX=/usr/local \
157+
-DGTSAM_USE_SYSTEM_EIGEN=ON \
158+
-DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DCMAKE_BUILD_TYPE=Release -DGTSAM_BUILD_UNSTABLE=ON -DGTSAM_POSE3_EXPMAP=ON -DGTSAM_ROT3_EXPMAP=ON -DGTSAM_TANGENT_PREINTEGRATION=OFF .. && \
159+
make -j$(nproc) install
160+
161+
162+
# Install Open_GV
163+
RUN git clone https://github.com/MIT-SPARK/opengv
164+
RUN cd opengv && \
165+
mkdir build
166+
RUN cd opengv/build && \
167+
cmake -DCMAKE_BUILD_TYPE=Release \
168+
-DCMAKE_INSTALL_PREFIX=/usr/local \
169+
.. && make -j$(nproc) install
170+
171+
172+
RUN echo 'export RMW_IMPLEMENTATION=rmw_zenoh_cpp' >> ~/.bashrc
173+
174+
RUN mkdir -p /home/user/dev_ws/src/core
175+
RUN mkdir -p /home/user/dev_ws/src/third_parties
176+
RUN mkdir -p /home/user/upstream_ws/src
177+
178+
SHELL ["/bin/bash", "-c"]
179+
180+
RUN source /opt/ros/jazzy/setup.bash
181+
182+
WORKDIR /home/user/dev_ws

docker/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Docker Files for DynoSAM
2+
3+
Base images are pulled from [docker-ros-ml-images](https://github.com/ika-rwth-aachen/docker-ros-ml-images)
4+
5+
- Dockerfile.amd64 is a linux/amd64 image tested on x86_64 desktop
6+
- Dockerfile.l4t_jetpack6 is build from linux/arm64 tested on an NVIDIA ORIN NX with Jetpack 6
7+
8+
## Jetson Settings
9+
Architecture | aarch64
10+
Ubuntu | 22.04.5 LTS (Jammy Jellyfish)
11+
Jetson Linux | 36.4.7
12+
Python | 3.10.12
13+
ROS | jazzy
14+
CMake | 3.22.1
15+
CUDA | 12.6.77-1
16+
cuDNN | 9.3.0.75-1
17+
TensorRT | 10.7.0.23-1+cuda12.6
18+
PyTorch | 2.8.0
19+
GPUs | (Orin (nvgpu))
20+
OpenCV | 4.10.0
21+
22+
> NOTE: The CUDA/Pytorch/TensorRT versions settings come with the base dockerfile but in practice we have been using CUDA 12.9.
23+
24+
## Other versioning
25+
matplotlib=3.6.3
26+
numpy=1.26.4

docker/build_docker.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

docker/build_docker_amd64.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
bash build_docker_base.sh Dockerfile.amd64 acfr_rpg/dyno_sam_cuda

docker/build_docker_base.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
DOCKERFILE=$1
3+
TAG=$2
4+
5+
if [[ -z $TAG ]] || [[ -z $DOCKERFILE ]]; then
6+
SCRIPT_NAME=$(basename "$0")
7+
echo "Usage: ./$SCRIPT_NAME DOCKERFILE TAG"
8+
exit -1
9+
fi
10+
11+
12+
# 2. Identify the directory where this script is located
13+
# This resolves the path even if called from a different location
14+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
15+
16+
# 3. Temporarily change into the script's directory
17+
echo "Changing working directory to: $SCRIPT_DIR"
18+
cd "$SCRIPT_DIR" || { echo "Failed to change directory"; exit 1; }
19+
20+
# 4. Verify the file exists in this directory
21+
if [ -f "$DOCKERFILE" ]; then
22+
echo "Building dockerfile $DOCKERFILE with tag $TAG"
23+
DOCKER_BUILDKIT=1 docker build --network=host -f $DOCKERFILE -t $TAG .
24+
# ----------------------------
25+
26+
else
27+
echo "Error: File '$DOCKERFILE' not found in $SCRIPT_DIR"
28+
exit 1
29+
fi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
bash build_docker_base.sh Dockerfile.l4t_jetpack6 acfr_rpg/dynosam_cuda_l4t

docker/create_container_amd64.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
### EDIT THIS TO WHEREVER YOU'RE STORING YOU DATA ###
4+
# folder should exist before you mount it
5+
LOCAL_DATA_FOLDER=/media/jmor6670/T7/datasets
6+
LOCAL_RESULTS_FOLDER=~/results/
7+
LOCAL_DYNO_SAM_FOLDER=~/Code/src/DynOSAM/
8+
LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER=~/Code/src/third_party_dynosam/
9+
10+
bash create_container_base.sh acfr_rpg/dyno_sam_cuda dyno_sam $LOCAL_DATA_FOLDER $LOCAL_RESULTS_FOLDER $LOCAL_DYNO_SAM_FOLDER $LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER
Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
#!/usr/bin/env bash
22

3-
CONTAINER_NAME=dyno_sam
4-
CONTAINER_IMAGE_NAME=acfr_rpg/dyno_sam_cuda
3+
CONTAINER_IMAGE_NAME=$1
4+
CONTAINER_NAME=$2
55

6-
### EDIT THIS TO WHEREVER YOU'RE STORING YOU DATA ###
7-
# folder should exist before you mount it
8-
LOCAL_DATA_FOLDER=/media/jmor6670/T7/datasets
9-
LOCAL_RESULTS_FOLDER=~/results/
10-
LOCAL_DYNO_SAM_FOLDER=~/Code/src/DynOSAM/
11-
LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER=~/Code/src/third_party_dynosam/
6+
LOCAL_DATA_FOLDER=$3
7+
LOCAL_RESULTS_FOLDER=$4
8+
LOCAL_DYNO_SAM_FOLDER=$5
9+
LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER=$6
10+
11+
echo "Creating dynosam container ($CONTAINER_NAME) from image: $CONTAINER_IMAGE_NAME"
12+
echo "Local data folder: $LOCAL_DATA_FOLDER"
13+
echo "Local results folder: $LOCAL_RESULTS_FOLDER"
14+
echo "Local DynoSAM folder: $LOCAL_DYNO_SAM_FOLDER"
15+
echo "Local third party dynosam folder: $LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER"
1216

1317

1418
CONTAINER_DATA_FOLDER=/root/data
@@ -17,8 +21,6 @@ CONTAINER_WORKSPACE_FOLDER=/home/user/dev_ws/src/core/
1721
CONTAINER_WORKSPACE_FOLDER_THIRD_PARTY=/home/user/dev_ws/src/third_parties/
1822

1923

20-
21-
2224
USE_NVIDIA=false
2325

2426
# If we are running in a docker-in-docker scenario NVIDIA_SOS will be populated
@@ -78,11 +80,34 @@ if "$USE_NVIDIA"; then
7880
else
7981
TERMINAL_FLAGS='-t'
8082
fi
83+
84+
echo "$@"
8185
# Create the container based on the launchfile it's launching (if any)
8286
# removes '.launch' from the last argument
8387
echo "Container name will be: $CONTAINER_NAME"
8488
# docker run $DOCKER_NVIDIA_SO_VOLUMES \
85-
docker run \
89+
# docker run \
90+
# --privileged \
91+
# --gpus all \
92+
# -i -d \
93+
# --volume $XSOCK:$XSOCK:rw \
94+
# -v $LOCAL_DATA_FOLDER:$CONTAINER_DATA_FOLDER \
95+
# -v $LOCAL_RESULTS_FOLDER:$CONTAINER_RESULTS_FOLDER \
96+
# -v $LOCAL_DYNO_SAM_FOLDER:$CONTAINER_WORKSPACE_FOLDER \
97+
# -v $LOCAL_THIRD_PARTY_DYNO_SAM_FOLDER:$CONTAINER_WORKSPACE_FOLDER_THIRD_PARTY \
98+
# -v /var/run/docker.sock:/var/run/docker.sock \
99+
# --env DISPLAY=$DISPLAY \
100+
# --env XAUTHORITY=$XAUTH \
101+
# --env QT_X11_NO_MITSHM=0 \
102+
# --env QT_X11_NO_XRENDER=0 \
103+
# --volume $XAUTH:$XAUTH:rw \
104+
# --net host \
105+
# --pid host \
106+
# --ipc host \
107+
# -it \
108+
# --name=$CONTAINER_NAME \
109+
# $CONTAINER_IMAGE_NAME "$@"
110+
docker run \
86111
--privileged \
87112
--gpus all \
88113
-i -d \
@@ -102,7 +127,8 @@ if "$USE_NVIDIA"; then
102127
--ipc host \
103128
-it \
104129
--name=$CONTAINER_NAME \
105-
$CONTAINER_IMAGE_NAME "$@"
130+
$CONTAINER_IMAGE_NAME
106131
fi
107132

133+
# FOR NOW?
108134
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' $CONTAINER_NAME`

0 commit comments

Comments
 (0)