First run on target hardware

The robot rotated with the ros2 topic pub command in the readme
This commit is contained in:
2026-04-16 13:53:01 +00:00
parent a8042c814e
commit 212821793a
8 changed files with 19 additions and 24 deletions
+9 -13
View File
@@ -3,25 +3,18 @@
# ── Stage 1: build ────────────────────────────────────────────────────────────
FROM ros:kilted AS builder
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-colcon-common-extensions \
python3-pip \
ros-${ROS_DISTRO}-ament-cmake-python \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /ws
# Install the vendored Raspbot hardware library
COPY raspbot_v2_interface/ raspbot_v2_interface/
# PEP 668: newer Debian/Ubuntu marks the system Python as externally managed and blocks pip
# by default. --break-system-packages overrides this; safe here as the container is isolated.
RUN pip3 install --no-cache-dir --break-system-packages ./raspbot_v2_interface
# Copy the ROS package into the standard colcon src/ layout and build it
COPY package.xml setup.py setup.cfg CMakeLists.txt src/my_robot/
COPY my_robot/ src/my_robot/my_robot/
COPY src/my_robot/ src/my_robot/
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --packages-select my_robot
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
@@ -31,10 +24,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rclpy \
ros-${ROS_DISTRO}-geometry-msgs \
ros-${ROS_DISTRO}-std-msgs \
python3-smbus \
&& rm -rf /var/lib/apt/lists/*
# Bring across the installed Raspbot library and the built ROS overlay
COPY --from=builder /usr/local/lib /usr/local/lib
# Install the Raspbot hardware library directly into site-packages
COPY raspbot_v2_interface/ /usr/local/lib/python3.12/dist-packages/raspbot_v2_interface/
# Bring across the built ROS overlay
COPY --from=builder /ws/install /ws/install
# Source both ROS base and the workspace overlay on every shell/exec