From e1f1d75a169f0c6a1f6c35a0a6782687cb8bf0e5 Mon Sep 17 00:00:00 2001 From: Ian Duran Date: Tue, 18 Oct 2022 12:10:20 -0500 Subject: [PATCH 1/9] add jetson-orbslam3 image --- README.md | 2 + jetson-orbslam3/Dockerfile | 97 +++++++++++++++++++++++++++++++ jetson-orbslam3/ros_entrypoint.sh | 6 ++ 3 files changed, 105 insertions(+) create mode 100644 jetson-orbslam3/Dockerfile create mode 100644 jetson-orbslam3/ros_entrypoint.sh diff --git a/README.md b/README.md index 96fc7ca..8dbf25e 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,5 @@ General purpose ros-kinetic image with acados and other USV dependencies. General purpose sdv ros2 image and scripts. ### rllib_trainer Used for rllib training. +### jetson-orbslam3 +ORB-SLAM3 CUDA-ready image installed with useful packages like OpenCV, Pangolin and other dependencies. diff --git a/jetson-orbslam3/Dockerfile b/jetson-orbslam3/Dockerfile new file mode 100644 index 0000000..a791d68 --- /dev/null +++ b/jetson-orbslam3/Dockerfile @@ -0,0 +1,97 @@ +FROM nvcr.io/nvidia/l4t-jetpack:r35.1.0 + +RUN apt-get update + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get install -y gnupg2 curl lsb-core vim wget python3-pip libpng16-16 libjpeg-turbo8 libtiff5 + + +# Installing ROS-noetic +RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +RUN curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - +RUN apt update +RUN apt install -y ros-noetic-desktop +RUN apt-get install -y python3-rosdep +RUN rosdep init +RUN rosdep update +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +RUN apt install -y python3-rosinstall python3-rosinstall-generator python3-wstool build-essential + +# Intalling python-catkin +RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' +RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add - +RUN apt-get update +RUN apt-get install -y python3-catkin-tools +RUN apt-get install -y software-properties-common + +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bash_profile + + +RUN apt-get install -y \ + # Base tools + cmake \ + build-essential \ + git \ + unzip \ + pkg-config \ + python-dev \ + # OpenCV dependencies + python-numpy \ + # Pangolin dependencies + libgl1-mesa-dev \ + libglew-dev \ + libpython2.7-dev \ + libeigen3-dev \ + apt-transport-https \ + ca-certificates\ + software-properties-common + +RUN curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - +RUN add-apt-repository "deb https://download.sublimetext.com/ apt/stable/" +RUN apt update +RUN apt install -y sublime-text + +# Build OpenCV (3.0 or higher should be fine) +RUN apt-get install -y python3-dev python3-numpy +RUN apt-get install -y python-dev python-numpy +RUN apt-get install -y libavcodec-dev libavformat-dev libswscale-dev +RUN apt-get install -y libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev +RUN apt-get install -y libgtk-3-dev + + + +# # Build Pangolin +RUN cd /tmp && git clone https://github.com/stevenlovegrove/Pangolin && \ + cd Pangolin && git checkout v0.6 && mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++11 .. && \ + make -j$nproc && make install && \ + cd / && rm -rf /tmp/Pangolin + + # Open CV +RUN cd /tmp && git clone https://github.com/opencv/opencv/ +RUN cd /tmp && git clone https://github.com/opencv/opencv_contrib/ +RUN cd /tmp/opencv && \ + mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++11 -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules .. && \ + make -j4 && make install && \ + cd / && rm -rf /tmp/opencv && rm -rf /tmp/opencv_contrib + +RUN apt install -y libopencv-dev python3-opencv python-is-python3 + +RUN cd / && \ + git clone -b docker_opencv3.2_fix https://github.com/jahaniam/ORB_SLAM3 /ORB_SLAM3 && \ + cd /ORB_SLAM3 && chmod +x build.sh && ./build.sh + +COPY ros_entrypoint.sh /ros_entrypoint.sh +RUN chmod +x /ros_entrypoint.sh +ENV ROS_DISTRO noetic +ENV LANG en_US.UTF-8 + +ENTRYPOINT ["/ros_entrypoint.sh"] + +USER $USERNAME +# terminal colors with xterm +ENV TERM xterm +WORKDIR /ORB_SLAM3 +CMD ["bash"] diff --git a/jetson-orbslam3/ros_entrypoint.sh b/jetson-orbslam3/ros_entrypoint.sh new file mode 100644 index 0000000..f481977 --- /dev/null +++ b/jetson-orbslam3/ros_entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# setup ros environment +source "/opt/ros/$ROS_DISTRO/setup.bash" +exec "$@" From 2cf5758666d19144303145e80baf6cfbc0a756c8 Mon Sep 17 00:00:00 2001 From: Ian Duran Date: Tue, 18 Oct 2022 16:19:14 -0500 Subject: [PATCH 2/9] fix Dockerfile and add ORB-SLAM3 --- jetson-orbslam3/Dockerfile | 122 ++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 55 deletions(-) diff --git a/jetson-orbslam3/Dockerfile b/jetson-orbslam3/Dockerfile index a791d68..21c6aff 100644 --- a/jetson-orbslam3/Dockerfile +++ b/jetson-orbslam3/Dockerfile @@ -3,41 +3,48 @@ FROM nvcr.io/nvidia/l4t-jetpack:r35.1.0 RUN apt-get update ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get install -y gnupg2 curl lsb-core vim wget python3-pip libpng16-16 libjpeg-turbo8 libtiff5 - - -# Installing ROS-noetic -RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' -RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 -RUN curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - -RUN apt update -RUN apt install -y ros-noetic-desktop -RUN apt-get install -y python3-rosdep -RUN rosdep init -RUN rosdep update -RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc -RUN apt install -y python3-rosinstall python3-rosinstall-generator python3-wstool build-essential - -# Intalling python-catkin -RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' -RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add - -RUN apt-get update -RUN apt-get install -y python3-catkin-tools -RUN apt-get install -y software-properties-common - -RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bash_profile - - -RUN apt-get install -y \ - # Base tools - cmake \ - build-essential \ + # Installing Base Tools +RUN apt-get update && apt-get install -y \ + gnupg2 \ + curl \ + lsb-core \ + vim wget \ + python3-pip \ + libpng16-16 \ + libjpeg-turbo8 \ + libtiff5 \ + build-essential \ + cmake \ git \ unzip \ pkg-config \ - python-dev \ - # OpenCV dependencies - python-numpy \ + && rm -rf /var/lib/apt/lists/* + + # Installing ROS-noetic +RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' && \ + apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \ + curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - && \ + apt-get update && apt-get install -y \ + ros-noetic-desktop \ + python3-rosdep \ + python3-rosinstall \ + python3-rosinstall-generator \ + python3-wstool \ + && rm -rf /var/lib/apt/lists/* && \ + rosdep init && rosdep update && \ + echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc + + # Intalling python-catkin +RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' && \ + wget http://packages.ros.org/ros.key -O - | sudo apt-key add - && \ + apt-get update && apt-get install -y \ + python3-catkin-tools \ + software-properties-common \ + && rm -rf /var/lib/apt/lists/* + +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bash_profile + +RUN apt-get update && apt-get install -y \ # Pangolin dependencies libgl1-mesa-dev \ libglew-dev \ @@ -45,40 +52,45 @@ RUN apt-get install -y \ libeigen3-dev \ apt-transport-https \ ca-certificates\ - software-properties-common - -RUN curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - -RUN add-apt-repository "deb https://download.sublimetext.com/ apt/stable/" -RUN apt update -RUN apt install -y sublime-text - -# Build OpenCV (3.0 or higher should be fine) -RUN apt-get install -y python3-dev python3-numpy -RUN apt-get install -y python-dev python-numpy -RUN apt-get install -y libavcodec-dev libavformat-dev libswscale-dev -RUN apt-get install -y libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev -RUN apt-get install -y libgtk-3-dev - - - -# # Build Pangolin + software-properties-common \ + # Build OpenCV Dependencies + python3-dev \ + python3-numpy \ + python-dev \ + python-numpy \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libgstreamer-plugins-base1.0-dev \ + libgstreamer1.0-dev \ + libgtk-3-dev \ + libopencv-dev \ + python3-opencv \ + && rm -rf /var/lib/apt/lists/* + + + # Build Pangolin RUN cd /tmp && git clone https://github.com/stevenlovegrove/Pangolin && \ cd Pangolin && git checkout v0.6 && mkdir build && cd build && \ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++11 .. && \ make -j$nproc && make install && \ cd / && rm -rf /tmp/Pangolin - # Open CV -RUN cd /tmp && git clone https://github.com/opencv/opencv/ -RUN cd /tmp && git clone https://github.com/opencv/opencv_contrib/ -RUN cd /tmp/opencv && \ + # Install Open CV from source +RUN cd /tmp && git clone https://github.com/opencv/opencv/ && \ + git clone https://github.com/opencv/opencv_contrib/ && \ + cd /tmp/opencv && \ mkdir build && cd build && \ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++11 -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules .. && \ make -j4 && make install && \ cd / && rm -rf /tmp/opencv && rm -rf /tmp/opencv_contrib -RUN apt install -y libopencv-dev python3-opencv python-is-python3 - + # Set Python3 as default +RUN apt-get update && apt-get install -y \ + python-is-python3 \ + && rm -rf /var/lib/apt/lists/* + + # Clone and build ORB-SLAM3 RUN cd / && \ git clone -b docker_opencv3.2_fix https://github.com/jahaniam/ORB_SLAM3 /ORB_SLAM3 && \ cd /ORB_SLAM3 && chmod +x build.sh && ./build.sh From 7624556e2f0f672034909985e6df526ba28e176e Mon Sep 17 00:00:00 2001 From: Ian Duran Date: Tue, 18 Oct 2022 16:26:05 -0500 Subject: [PATCH 3/9] update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f609e9d..8b3efaf 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -37,6 +37,8 @@ jobs: image: ghcr.io/vanttec/rllib_trainer - dockerfile: sdv_ros2_foxy/Dockerfile image: ghcr.io/vanttec/sdv_ros2_foxy + - dockerfile: jetson-orbslam3/Dockerfile + image: ghcr.io/vantec/jetson-orbslam3 steps: - name: Checkout repository uses: actions/checkout@v3 From 919b5901a7e023fac9738aeed0b41c37863607c0 Mon Sep 17 00:00:00 2001 From: ianjduran <74118170+ianjduran@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:53:35 -0500 Subject: [PATCH 4/9] Update Dockerfile --- jetson-orbslam3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetson-orbslam3/Dockerfile b/jetson-orbslam3/Dockerfile index 21c6aff..4ea9cb5 100644 --- a/jetson-orbslam3/Dockerfile +++ b/jetson-orbslam3/Dockerfile @@ -95,7 +95,7 @@ RUN cd / && \ git clone -b docker_opencv3.2_fix https://github.com/jahaniam/ORB_SLAM3 /ORB_SLAM3 && \ cd /ORB_SLAM3 && chmod +x build.sh && ./build.sh -COPY ros_entrypoint.sh /ros_entrypoint.sh +COPY ros_entrypoint.sh ros_entrypoint.sh RUN chmod +x /ros_entrypoint.sh ENV ROS_DISTRO noetic ENV LANG en_US.UTF-8 From 2483a0410d4fd3b70606bf5050b87f90c1b8156f Mon Sep 17 00:00:00 2001 From: ianjduran <74118170+ianjduran@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:57:50 -0500 Subject: [PATCH 5/9] fix COPY Dockerfile --- jetson-orbslam3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetson-orbslam3/Dockerfile b/jetson-orbslam3/Dockerfile index 4ea9cb5..c36d0ac 100644 --- a/jetson-orbslam3/Dockerfile +++ b/jetson-orbslam3/Dockerfile @@ -95,7 +95,7 @@ RUN cd / && \ git clone -b docker_opencv3.2_fix https://github.com/jahaniam/ORB_SLAM3 /ORB_SLAM3 && \ cd /ORB_SLAM3 && chmod +x build.sh && ./build.sh -COPY ros_entrypoint.sh ros_entrypoint.sh +COPY ros_entrypoint.sh /srv/visitor/ros_entrypoint.sh RUN chmod +x /ros_entrypoint.sh ENV ROS_DISTRO noetic ENV LANG en_US.UTF-8 From a44c8b0c30db69a1603f8e679a78e46503df0375 Mon Sep 17 00:00:00 2001 From: Abiel Fernandez Date: Wed, 19 Oct 2022 21:44:32 -0500 Subject: [PATCH 6/9] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8b3efaf..32023f6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -33,12 +33,16 @@ jobs: include: - dockerfile: ros-kinetic/Dockerfile image: ghcr.io/vanttec/ros-kinetic + path: ros-kinetic/ - dockerfile: rllib_trainer/Dockerfile image: ghcr.io/vanttec/rllib_trainer + path: rllib_trainer/ - dockerfile: sdv_ros2_foxy/Dockerfile image: ghcr.io/vanttec/sdv_ros2_foxy + path: sdv_ros2_foxy/ - dockerfile: jetson-orbslam3/Dockerfile image: ghcr.io/vantec/jetson-orbslam3 + path: jetson-orbslam3/ steps: - name: Checkout repository uses: actions/checkout@v3 @@ -85,6 +89,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: ${{ matrix.dockerfile }} + path: ${{ matrix.path }} # Sign the resulting Docker image digest except on PRs. # This will only write to the public Rekor transparency log when the Docker From cd4790d22f1b01100d39590bb3af8e609d6051c3 Mon Sep 17 00:00:00 2001 From: Abiel Fernandez Date: Wed, 19 Oct 2022 21:46:15 -0500 Subject: [PATCH 7/9] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 32023f6..12c6c28 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -84,7 +84,7 @@ jobs: id: build-and-push uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a with: - context: . + context: ${{ matrix.path }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 01257bbe041936f1b9a2186199429dd76b163973 Mon Sep 17 00:00:00 2001 From: Ian Duran Date: Fri, 28 Oct 2022 03:42:59 -0500 Subject: [PATCH 8/9] fix dockerfile jetpack --- .../Dockerfile | 19 ++++++------------- jetson-orbslam3/ros_entrypoint.sh | 6 ------ 2 files changed, 6 insertions(+), 19 deletions(-) rename {jetson-orbslam3 => cuda-jetpack-5.0.2}/Dockerfile (87%) delete mode 100644 jetson-orbslam3/ros_entrypoint.sh diff --git a/jetson-orbslam3/Dockerfile b/cuda-jetpack-5.0.2/Dockerfile similarity index 87% rename from jetson-orbslam3/Dockerfile rename to cuda-jetpack-5.0.2/Dockerfile index c36d0ac..e6e1e4f 100644 --- a/jetson-orbslam3/Dockerfile +++ b/cuda-jetpack-5.0.2/Dockerfile @@ -25,11 +25,12 @@ RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \ curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - && \ apt-get update && apt-get install -y \ - ros-noetic-desktop \ + ros-noetic-desktop-full \ python3-rosdep \ python3-rosinstall \ python3-rosinstall-generator \ python3-wstool \ + ros-noetic-sophus \ && rm -rf /var/lib/apt/lists/* && \ rosdep init && rosdep update && \ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc @@ -42,8 +43,6 @@ RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" software-properties-common \ && rm -rf /var/lib/apt/lists/* -RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bash_profile - RUN apt-get update && apt-get install -y \ # Pangolin dependencies libgl1-mesa-dev \ @@ -90,20 +89,14 @@ RUN apt-get update && apt-get install -y \ python-is-python3 \ && rm -rf /var/lib/apt/lists/* - # Clone and build ORB-SLAM3 -RUN cd / && \ - git clone -b docker_opencv3.2_fix https://github.com/jahaniam/ORB_SLAM3 /ORB_SLAM3 && \ - cd /ORB_SLAM3 && chmod +x build.sh && ./build.sh - -COPY ros_entrypoint.sh /srv/visitor/ros_entrypoint.sh -RUN chmod +x /ros_entrypoint.sh ENV ROS_DISTRO noetic ENV LANG en_US.UTF-8 - -ENTRYPOINT ["/ros_entrypoint.sh"] +RUN ["/bin/bash"] +#ENTRYPOINT ["/ros_entrypoint.sh"] USER $USERNAME # terminal colors with xterm ENV TERM xterm -WORKDIR /ORB_SLAM3 +RUN mkdir /ws +WORKDIR /ws CMD ["bash"] diff --git a/jetson-orbslam3/ros_entrypoint.sh b/jetson-orbslam3/ros_entrypoint.sh deleted file mode 100644 index f481977..0000000 --- a/jetson-orbslam3/ros_entrypoint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -e - -# setup ros environment -source "/opt/ros/$ROS_DISTRO/setup.bash" -exec "$@" From 19176621b4a23b7bd27d03b179c56ca90a571a2e Mon Sep 17 00:00:00 2001 From: Ian Duran Date: Fri, 28 Oct 2022 03:47:36 -0500 Subject: [PATCH 9/9] update docker-publish.yml and README --- .github/workflows/docker-publish.yml | 6 +++--- README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 12c6c28..84c35e9 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -40,9 +40,9 @@ jobs: - dockerfile: sdv_ros2_foxy/Dockerfile image: ghcr.io/vanttec/sdv_ros2_foxy path: sdv_ros2_foxy/ - - dockerfile: jetson-orbslam3/Dockerfile - image: ghcr.io/vantec/jetson-orbslam3 - path: jetson-orbslam3/ + - dockerfile: cuda-jetpack-5.0.2/Dockerfile + image: ghcr.io/vantec/cuda-jetpack-5.0.2 + path: cuda-jetpack-5.0.2/ steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/README.md b/README.md index 8dbf25e..8c64ae4 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ General purpose ros-kinetic image with acados and other USV dependencies. General purpose sdv ros2 image and scripts. ### rllib_trainer Used for rllib training. -### jetson-orbslam3 -ORB-SLAM3 CUDA-ready image installed with useful packages like OpenCV, Pangolin and other dependencies. +### cuda-jetpack-5.0.2 +General Purpose image installed with CUDA, ROS Noetic, OpenCV, Pangolin and other useful dependencies.