Skip to content

Commit

Permalink
Add Dockerfile for ARM (#572)
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Schweiger <[email protected]>
Co-authored-by: mhidalgo-bdai <[email protected]>
  • Loading branch information
mschweig and mhidalgo-bdai authored Feb 13, 2025
1 parent f9af8f5 commit e882afc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 12 deletions.
55 changes: 44 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
FROM osrf/ros:humble-desktop-full
# Use official Ubuntu 22.04 base image
FROM ubuntu:22.04

# Install dependencies (taken from devcontainer dockerfile)
RUN DEBIAN_FRONTEND=noninteractive apt-get update -q && \
apt-get update -q && \
apt-get install -yq --no-install-recommends \
#RMW ZENOH experimental flag
ARG EXPERIMENTAL_ZENOH_RMW=FALSE

# Set noninteractive mode for APT
ENV DEBIAN_FRONTEND=noninteractive

# Env setup
ENV SHELL=/bin/bash
SHELL ["/bin/bash", "-c"]

# Install system dependencies
RUN apt-get update && apt-get install -y \
locales \
curl \
wget \
git \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

# Add ROS 2 apt repository
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" \
| tee /etc/apt/sources.list.d/ros2.list > /dev/null \
&& apt-get update

# Install dependencies
RUN apt-get update -q && \
apt-get install -yq --no-install-recommends \
wget \
software-properties-common \
python3-pip \
python-is-python3 \
python3-argcomplete \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
libpython3-dev && \
rm -rf /var/lib/apt/lists/*
libpython3-dev \
python3-tk \
ros-humble-ros-base \
ros-dev-tools \
#check if Zenoh should be installed
$(if [ "$EXPERIMENTAL_ZENOH_RMW" = "TRUE" ]; then echo "ros-humble-rmw-zenoh-cpp"; fi) \
&& rm -rf /var/lib/apt/lists/*

# Create ROS workspace
# Set up workspace
WORKDIR /ros_ws/src

# Initialize rosdep
RUN rosdep init && rosdep update

# Clone driver code
RUN git clone https://github.com/bdaiinstitute/spot_ros2.git .
RUN git submodule update --init --recursive

# Run install script
RUN /ros_ws/src/install_spot_ros2.sh
# Run install script and pass in the architecture
RUN ARCH=$(dpkg --print-architecture) && echo "Building driver with $ARCH" && /ros_ws/src/install_spot_ros2.sh --$ARCH

# Build packages with Colcon
WORKDIR /ros_ws/
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
spot-ros2-driver:
image: spot_ros2:latest
volumes:
- ./spot_driver/config/spot_ros_example.yaml:/ros_ws/src/robot.yaml
environment:
- SPOT_NAME=${SPOT_NAME:-spot}
# Default value, can be set via CLI with >>SPOT_NAME=spot docker compose up<<
command: >
bash -c "
source /opt/ros/humble/setup.bash &&
source /ros_ws/install/setup.bash &&
ros2 launch spot_driver spot_driver.launch.py config_file:=/ros_ws/src/robot.yaml spot_name:=$${SPOT_NAME} launch_rviz:=False
"
2 changes: 1 addition & 1 deletion install_spot_ros2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REQUIREMENTS_FILE=spot_wrapper/requirements.txt

while true; do
case "$1" in
--arm64 ) ARCH="arm64"; shift ;;
--arm64 | --aarch64 ) ARCH="arm64"; shift ;;
-h | --help ) echo "$HELP"; exit 0;;
-- ) shift; break ;;
* ) break ;;
Expand Down

0 comments on commit e882afc

Please sign in to comment.