Skip to content

Commit

Permalink
feat: Jetson foxy docker image added
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiranda-queiros committed Dec 4, 2023
1 parent 25e95dc commit c245b5d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
context: .
tag: foxy-desktop
platform: linux/amd64
- dockerfile: ./docker_foxy_jetson/Dockerfile
context: .
tag: foxy-jetson
platform: linux/arm64

permissions:
contents: read
Expand Down
41 changes: 41 additions & 0 deletions docker_foxy_jetson/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###########################################
# Xplore Navigation image
###########################################
FROM ghcr.io/epflxplore/docker_commons:foxy-jetson

ARG DEBIAN_FRONTEND=noninteractive

# Install ROS 2 Nav packages
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-slam-toolbox \
ros-${ROS_DISTRO}-smac-planner \
ros-${ROS_DISTRO}-test-msgs \
ros-${ROS_DISTRO}-joint-state-publisher-gui \
ros-${ROS_DISTRO}-libg2o \
ros-${ROS_DISTRO}-depthai-ros \
python3-zmq \
libyaml-cpp-dev \
lcov

# Add USB rules
RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
RUN /etc/init.d/udev restart

USER $USERNAME

# Set a diretory to store the project
WORKDIR /home/$USERNAME/dev_ws/src
COPY . .

# Set a directory to build the project
WORKDIR /home/$USERNAME/dev_ws

# Install ROS 2 Nav dependencies
# RUN rosdep update \
# && rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y --skip-keys "libg2o g2o"

# Clean up
RUN sudo rm -rf /var/lib/apt/lists/*
1 change: 1 addition & 0 deletions docker_foxy_jetson/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/nav:foxy-jetson -f Dockerfile ..
50 changes: 50 additions & 0 deletions docker_foxy_jetson/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# If not working, first do: sudo rm -rf /tmp/.docker.xauth
# If still not working, try running the script as root.

XAUTH=/tmp/.docker.xauth

echo "Preparing Xauthority data..."
xauth_list=$(xauth nlist :0 | tail -n 1 | sed -e 's/^..../ffff/')
if [ ! -f $XAUTH ]; then
if [ ! -z "$xauth_list" ]; then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi

echo "Done."
echo ""
echo "Verifying file contents:"
file $XAUTH
echo "--> It should say \"X11 Xauthority data\"."
echo ""
echo "Permissions:"
ls -FAlh $XAUTH
echo ""
echo "Running docker..."

# Get the current working directory
current_dir=$(pwd)

# Use dirname to get the parent directory
parent_dir=$(dirname "$current_dir")

docker run -it \
--name nav_foxy_jetson \
--rm \
--runtime=nvidia \
--gpus all \
--privileged \
--net=host \
-e DISPLAY=unix$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=$XAUTH \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v $XAUTH:$XAUTH \
-v /run/user/1000/at-spi:/run/user/1000/at-spi \
-v /dev:/dev \
-v $parent_dir:/home/xplore/dev_ws/src \
-v nav_foxy_desktop_home_volume:/home/xplore \
ghcr.io/epflxplore/nav:foxy-jetson

0 comments on commit c245b5d

Please sign in to comment.