Add lider ROS node and move robot control into its own directory
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ── 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 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /ws
|
||||
|
||||
# Copy the ROS package into the standard colcon src/ layout and build it
|
||||
COPY robot/src/raspbot_v2/ src/raspbot_v2/
|
||||
|
||||
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
|
||||
colcon build --packages-select raspbot_v2
|
||||
|
||||
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
||||
FROM ros:kilted-ros-core
|
||||
|
||||
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 \
|
||||
ros-${ROS_DISTRO}-sensor-msgs \
|
||||
ros-${ROS_DISTRO}-launch-ros \
|
||||
python3-smbus \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install the Raspbot hardware library directly into site-packages
|
||||
COPY robot/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
|
||||
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /etc/bash.bashrc && \
|
||||
echo "source /ws/install/setup.bash" >> /etc/bash.bashrc
|
||||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["ros2", "launch", "raspbot_v2", "robot.launch.py"]
|
||||
Reference in New Issue
Block a user