Files
Matt Spencer 46f7cbb8b5 Migrate to ROS2 Lyrical for all non-lidar packages
- Switch base image / repos file / rosdep distro from jazzy to lyrical
  (ros:lyrical is built on Ubuntu resolute/26.04).
- Vendor transport_drivers (serial_driver/io_context/udp_driver) since
  lyrical apt packages for them are not yet published; patch removes
  the now-gone ament_target_dependencies() macro.
- Fix ament_target_dependencies() removal across agv_pro_base,
  agv_pro_hardware, agv_pro_rviz_plugins, and slam_gmapping by switching
  to target_link_libraries() with namespaced imported targets (or raw
  *_LIBRARIES/*_INCLUDE_DIRS variables for packages with no modern
  target: serial_driver, ASIO).
- Migrate agv_pro_rviz_plugins from Qt5 to Qt6.
- Fix Boost 1.90 dropping libboost-system-dev: use header-only
  Boost::boost instead of a system component.
- Rename boost::asio::io_service -> io_context and
  mutable_buffers_1 -> mutable_buffer (Asio API removal) in
  agv_pro_hardware and agv_pro_base.
- Update tf2/message_filters includes from removed .h shims to .hpp,
  and fix message_filters::Subscriber's QoS constructor signature.
- Regenerate rosdep-packages.txt for lyrical; skip cartographer_ros/
  orbbec_camera in rosdep install (exec_depend-only, not yet published
  as ros-lyrical-* apt packages -- tracked in TODO.md).
- Lidar packages (fast_lio, livox_*, lslidar_*, point_lio,
  unitree_lidar_*) are deferred; their patches are present but not
  verified yet under lyrical.

Verified: full docker build succeeds with colcon build reporting all
23 non-lidar/transport packages finished, 0 failed.
2026-10-19 17:48:21 +01:00

70 lines
3.0 KiB
Docker

FROM ros:lyrical
# Create the workspace and copy all source directories into it
WORKDIR /ros2_ws
ARG TARGETARCH
COPY src ./src/
COPY patches ./patches/
COPY upstream.lyrical.repos ./upstream.lyrical.repos
# Import all upstream repostories
RUN mkdir -p src/upstream && vcs import ./src/upstream < ./upstream.lyrical.repos
# Apply patches to upstream
RUN ./patches/apply_patches.sh
# Make sure the base image is completely up to date
# ros:lyrical ships /etc/apt/apt.conf.d/docker-clean which purges downloaded .debs;
# remove it so the --mount=type=cache on /var/cache/apt actually retains archives.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
# system deps from frozen rosdep manifest — no rosdep at build or startup
# NOTE: There should be a check in your CI that this file is up to date.
# Something like:
# ./scripts/freeze-rosdep.sh && git diff --exit-code rosdep-packages.txt
COPY rosdep-packages.txt /tmp/rosdep-packages.txt
# The --mount=type=cache option caches the apt packages with buildkit
# The id-apt-cache-${TARGETARCH} option allows for separate caches for different architectures
# this enables parallel builds for different architectures without cache conflicts
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& xargs -r -a /tmp/rosdep-packages.txt apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# iproute2 provides `ip`, used by agv_pro_hardware/AgvProHardwareInterface and
# agv_pro_bringup's can_power_on.py to bring up the wheel CAN interface at runtime.
# Not a ROS package so rosdep won't pull it in -- install it explicitly.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends iproute2 \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies with rosdep
# This will catch anything that wasn't installed via .deb's from the frozen rosdep manifest.
# cartographer_ros/orbbec_camera are skipped: both are exec_depend-only (not needed to
# build) and aren't published as ros-lyrical-* apt packages yet -- see TODO.md.
RUN apt-get update && \
rosdep update && \
rosdep install --from-paths src --ignore-src -r -y \
--skip-keys "cartographer_ros orbbec_camera" && \
rm -rf /var/lib/apt/lists/*
# Build the workspace with symlink install
# livox_sdk is now an ament_cmake package built by colcon (no manual /usr/local install needed).
RUN . /opt/ros/lyrical/setup.sh && \
colcon build --symlink-install \
--cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=lyrical
# Source the overlay on container startup
RUN echo "source /opt/ros/lyrical/setup.bash" >> /root/.bashrc && \
echo "source /ros2_ws/install/setup.bash" >> /root/.bashrc
CMD ["bash"]