Skip to content

Commit

Permalink
added jetson nano image
Browse files Browse the repository at this point in the history
  • Loading branch information
KalanaRatnayake committed Jul 23, 2024
1 parent 83c4294 commit f5d37bd
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ROS Humble Astra Control stack
name: ROS Humble Astra Control stack for AMD64 and ARM64

on:
workflow_dispatch:
Expand Down Expand Up @@ -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
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/orbbec_humble_j_nano.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 19 additions & 8 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -63,26 +62,38 @@ Clone this reposiotory
git clone https://github.com/AIResearchLab/OrbbecSDK_ROS2.git
```

<details>
<summary> <h3> on AMD64 </h3> </summary>

Pull the Docker image and start compose (No need to run `docker compose build`)
```bash
cd src/OrbbecSDK_ROS2/docker
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
</details>

<details>
<summary> <h3> on JetsonNano </h3> </summary>

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
```
</details>
```
## Installation Instructions
Expand Down
127 changes: 127 additions & 0 deletions docker/Dockerfile.jetson-nano
Original file line number Diff line number Diff line change
@@ -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}

3 changes: 1 addition & 2 deletions docker/compose-build.yaml → docker/compose.jnano.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f5d37bd

Please sign in to comment.