From f5d37bdccab12c667d9816e559a48d0562c243d0 Mon Sep 17 00:00:00 2001 From: Kalana Ratnayake Date: Tue, 23 Jul 2024 16:49:52 +1000 Subject: [PATCH] added jetson nano image --- ...mble.yml => orbbec_humble_amd64_arm64.yml} | 4 +- .github/workflows/orbbec_humble_j_nano.yml | 57 ++++++++ README.MD | 27 ++-- docker/Dockerfile.jetson-nano | 127 ++++++++++++++++++ ...{compose-build.yaml => compose.jnano.yaml} | 3 +- 5 files changed, 206 insertions(+), 12 deletions(-) rename .github/workflows/{astra_jammy_humble.yml => orbbec_humble_amd64_arm64.yml} (92%) create mode 100644 .github/workflows/orbbec_humble_j_nano.yml create mode 100644 docker/Dockerfile.jetson-nano rename docker/{compose-build.yaml => compose.jnano.yaml} (77%) diff --git a/.github/workflows/astra_jammy_humble.yml b/.github/workflows/orbbec_humble_amd64_arm64.yml similarity index 92% rename from .github/workflows/astra_jammy_humble.yml rename to .github/workflows/orbbec_humble_amd64_arm64.yml index b3d813c6..a32aead6 100644 --- a/.github/workflows/astra_jammy_humble.yml +++ b/.github/workflows/orbbec_humble_amd64_arm64.yml @@ -1,4 +1,4 @@ -name: ROS Humble Astra Control stack +name: ROS Humble Astra Control stack for AMD64 and ARM64 on: workflow_dispatch: @@ -50,7 +50,7 @@ jobs: with: context: . file: docker/Dockerfile - platforms: linux/amd64,linux/arm64, linux/arm64/v8 + platforms: linux/amd64,linux/arm64 push: true tags: | ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/orbbec_humble_j_nano.yml b/.github/workflows/orbbec_humble_j_nano.yml new file mode 100644 index 00000000..bbab38cc --- /dev/null +++ b/.github/workflows/orbbec_humble_j_nano.yml @@ -0,0 +1,57 @@ +name: ROS Humble Astra Control stack for Jetson Nano + +on: + workflow_dispatch: + + push: + branches: + - main + + pull_request: + branches: + - main + +env: + REGISTRY: ghcr.io + OWNER: airesearchlab + IMAGE_NAME: orbbec + +# https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + run: | + docker login --username ${{ env.OWNER }} --password ${{ secrets.GH_PAT }} ghcr.io + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile.jetson-nano + platforms: linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest-j-nano + ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:humble-j-nano \ No newline at end of file diff --git a/README.MD b/README.MD index 2e0c31fd..a5439eb8 100644 --- a/README.MD +++ b/README.MD @@ -11,7 +11,6 @@ supports ROS 2 Foxy, Humble, and Jazzy distributions. * [Table of Contents](#table-of-contents) * [Usage with Docker Compose](#usage-with-docker-compose) * [Setup for pulling container from ghcr.io](#setup-for-pulling-container-from-ghcrio) - * [Setup for building the container on device](#setup-for-building-the-container-on-device) * [Installation Instructions](#installation-instructions) * [Getting start](#getting-start) * [Launch parameters](#launch-parameters) @@ -63,6 +62,9 @@ Clone this reposiotory git clone https://github.com/AIResearchLab/OrbbecSDK_ROS2.git ``` +
+

on AMD64

+ Pull the Docker image and start compose (No need to run `docker compose build`) ```bash cd src/OrbbecSDK_ROS2/docker @@ -70,19 +72,28 @@ docker compose pull docker compose up ``` -### Setup for building the container on device +Reset the system and remove volume +```bash +docker compose down +``` -Clone this reposiotory +
+
+

on JetsonNano

+ +Pull the Docker image and start compose (No need to run `docker compose build`) ```bash -git clone https://github.com/AIResearchLab/OrbbecSDK_ROS2.git +cd src/boxmotOrbbecSDK_ROS2_ros/docker +docker compose -f compose.jnano.yaml pull +docker compose -f compose.jnano.yaml up ``` -Build the Docker image and start compose +Reset the system and remove volume ```bash -cd src/OrbbecSDK_ROS2/docker -docker compose -f compose-build.yaml build -docker compose -f compose-build.yaml up +docker compose -f compose.jnano.yaml down +``` +
``` ## Installation Instructions diff --git a/docker/Dockerfile.jetson-nano b/docker/Dockerfile.jetson-nano new file mode 100644 index 00000000..71e40a4d --- /dev/null +++ b/docker/Dockerfile.jetson-nano @@ -0,0 +1,127 @@ +#--------------------------------------------------------------------------------------------------------------------------- +#---- +#---- Start base image +#---- +#--------------------------------------------------------------------------------------------------------------------------- + +FROM ghcr.io/kalanaratnayake/foxy-ros-pytorch:1-13-humble-core-r32.7.1 as base + +## Parameters +ENV ROS_DISTRO=humble +ENV WORKSPACE_ROOT=/boxmot + +############################################################################################################################# +##### +##### Install Dependencies +##### +############################################################################################################################# + +WORKDIR / + +RUN apt-get update -y + +RUN apt-get install -y --no-install-recommends ros-dev-tools \ + libgflags-dev \ + nlohmann-json3-dev \ + libudev-dev \ + libusb-dev \ + udev \ + pkg-config \ + ninja-build \ + doxygen \ + clang \ + python3 \ + nasm \ + libgl1-mesa-dev \ + libsoundio-dev \ + libvulkan-dev \ + libx11-dev \ + libxcursor-dev \ + libxinerama-dev \ + libxrandr-dev \ + libusb-1.0-0-dev \ + libssl-dev \ + libudev-dev \ + mesa-common-dev \ + uuid-dev + +RUN apt-get clean + +############################################################################################################################# +##### +##### Install Orbbec packages +##### +############################################################################################################################# + +WORKDIR /SDK + +RUN git clone https://github.com/orbbec/OrbbecSDK.git + +RUN mkdir -p /etc/udev/rules.d/ + +RUN cp /SDK/OrbbecSDK/misc/scripts/99-obsensor-libusb.rules /etc/udev/rules.d/99-obsensor-libusb.rules + +WORKDIR /SDK/OrbbecSDK/build + +RUN cmake .. && \ + make -j4 && \ + make install + +############################################################################################################################# +##### +##### Install Orbbec ROS2 packages +##### +############################################################################################################################# + +WORKDIR ${WORKSPACE_ROOT}/src + +RUN git clone https://github.com/orbbec/OrbbecSDK_ROS2.git + +WORKDIR ${WORKSPACE_ROOT} + +RUN . /opt/ros/humble/setup.sh && colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release + +WORKDIR / + +RUN + +############################################################################################################################# +##### +##### Remove workspace source and build files that are not relevent to running the system +##### +############################################################################################################################# + +RUN rm -rf /SDK +RUN rm -rf ${WORKSPACE_ROOT}/log +RUN rm -rf ${WORKSPACE_ROOT}/build + +RUN rm -rf /var/lib/apt/lists/* +RUN rm -rf /tmp/* +RUN apt-get clean + + +#--------------------------------------------------------------------------------------------------------------------------- +#---- +#---- Start final release image +#---- +#--------------------------------------------------------------------------------------------------------------------------- + + +FROM ghcr.io/kalanaratnayake/foxy-ros-pytorch:1-13-humble-core-r32.7.1 as final + +## Parameters +ENV WORKSPACE_ROOT=/orbbec +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +ENV LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 + +WORKDIR / + +COPY --from=base / / + +COPY docker/workspace_entrypoint.sh /workspace_entrypoint.sh +RUN chmod +x /workspace_entrypoint.sh + +ENTRYPOINT [ "/workspace_entrypoint.sh" ] + +WORKDIR ${WORKSPACE_ROOT} + \ No newline at end of file diff --git a/docker/compose-build.yaml b/docker/compose.jnano.yaml similarity index 77% rename from docker/compose-build.yaml rename to docker/compose.jnano.yaml index 8fe2ee9d..fc1ff02b 100644 --- a/docker/compose-build.yaml +++ b/docker/compose.jnano.yaml @@ -1,7 +1,6 @@ services: orbbec: - build: - dockerfile: Dockerfile + image: ghcr.io/airesearchlab/orbbec:humble-j-nano command: ros2 launch orbbec_camera femto_bolt.launch.py restart: unless-stopped privileged: true