Skip to content

Commit

Permalink
Use prepared ROS2 Jazzy base image for ARM and cross-compile containe…
Browse files Browse the repository at this point in the history
…r on x86. (#16)
  • Loading branch information
aentinger authored Jan 13, 2025
1 parent 20fac12 commit f183fe3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
34 changes: 13 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM arm64v8/ubuntu:22.04
FROM docker.io/arm64v8/ros:jazzy-ros-base AS install_packages

USER root

WORKDIR /usr/src/app

RUN apt-get update -y
RUN apt-get install -y apt-utils
RUN apt-get update && \
apt-get install -y \
git \
bash \
vim

RUN apt-get install -y locales
RUN apt-get install -yq tzdata
RUN echo "Europe/Berlin" > /etc/timezone && \
Expand All @@ -25,28 +28,18 @@ RUN apt-get update -yq
COPY ./keyboard /etc/default/keyboard
RUN apt-get install keyboard-configuration -yq

RUN apt-get install -yq software-properties-common
RUN add-apt-repository universe

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

RUN apt-get install -yq bash
RUN apt-get install -yq git
#RUN apt-get install -yq ros-dev-tools
RUN apt-get -yq update --fix-missing
RUN apt-get -yq install python3 python3-pip
RUN apt-get -yq install python3-opencv
RUN apt-get -yq install ros-humble-rosbridge-server
RUN apt-get -yq install ros-jazzy-rosbridge-server
RUN apt-get -yq install tmux
RUN pip3 install pyserial
RUN apt-get -yq install ros-humble-compressed-image-transport
#RUN pip3 install pyserial
RUN apt-get -yq install python3-serial
RUN apt-get -yq install ros-jazzy-compressed-image-transport

SHELL ["/bin/bash", "-c"]
RUN source /opt/ros/humble/setup.bash && \
RUN source /opt/ros/jazzy/setup.bash && \
cd /usr/src/app && \
git clone https://github.com/107-systems/l3xz_openmv_camera && \
cd /usr/src/app/l3xz_openmv_camera && \
Expand All @@ -57,4 +50,3 @@ COPY entrypoint.sh /usr/src/app
COPY head_launch.py /usr/src/app

ENTRYPOINT ["/bin/bash", "/usr/src/app/entrypoint.sh"]

18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ git clone https://github.com/107-systems/l3xz-sw-pan-tilt-head
cd l3xz-sw-pan-tilt-head
sudo ./install.sh
~~~

or cross-compile image for ARM on x86:
```bash
docker buildx build \
--platform linux/arm64 \
--tag ros2 \
--output type=docker \
.
```
followed by exporting the image and copying to the target device:
```bash
docker save ros2:latest | gzip > ros2_image_latest.tar.gz
scp ros2_image_latest.tar.gz [email protected]:/root
```
and concluded by loading the updated image:
```bash
docker load < ros2_image_latest.tar.gz
```
The Docker environment for the ROS infrastructure will be built and the application files will be bootstrapped over the system. Finally, the software will come up as a ```systemd``` service with the name ```head.service```.
The status of the software can be checked with the following command:
~~~bash
Expand Down

0 comments on commit f183fe3

Please sign in to comment.