From 45fd06c6e9e8f813f72eca0cf7302ebca4834c27 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Tue, 22 Oct 2024 11:46:34 -0400 Subject: [PATCH] Fix the navigation2 build (issue #198) --- navigation2/Dockerfile | 21 +++++++++++++++------ navigation2/README.md | 6 +++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/navigation2/Dockerfile b/navigation2/Dockerfile index 6c6f2d7..0f059f4 100644 --- a/navigation2/Dockerfile +++ b/navigation2/Dockerfile @@ -43,8 +43,17 @@ ARG DEBIAN_FRONTEND=noninteractive SHELL ["/bin/bash", "-c"] +# Install required dependencies +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt update && \ + sudo apt install -y \ + python3-rosdep \ + python3-vcstool +RUN sudo rosdep init && rosdep update + # Define workspace locations -ENV NAVIGATION2_WS=${HOME_DIR}/nav2_ws +ENV NAVIGATION2_WS=${HOME}/nav2_ws RUN mkdir -p ${NAVIGATION2_WS}/src @@ -56,19 +65,19 @@ RUN vcs import --shallow src < navigation2.repos COPY --chown=spaceros-user:spaceros-user src/ src RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - source ${SPACEROS_DIR}/install/setup.bash && \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + source ${SPACEROS_DIR}/setup.bash && \ sudo apt update && \ rosdep install -i --from-path src --skip-keys $(cat excluded-pkgs.txt) -y -RUN source ${SPACEROS_DIR}/install/setup.bash && \ +RUN source ${SPACEROS_DIR}/setup.bash && \ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --no-warn-unused-cli RUN rm -rf src build log -# Install rviz2 to send goals to Nav2. +# Install rviz2 to send goals to Nav2. # TODO(xfiderek): Remove rviz2 and humble-nav2 froms this image RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ sudo apt update && \ sudo apt install -y ros-humble-rviz2 ros-humble-nav2-bringup diff --git a/navigation2/README.md b/navigation2/README.md index 1b8bb04..d9a2a65 100644 --- a/navigation2/README.md +++ b/navigation2/README.md @@ -33,9 +33,9 @@ docker image list The output will look something like this: ``` -REPOSITORY TAG IMAGE ID CREATED SIZE -osrf/space_nav2 latest 6edb2edc9643 10 hours ago 15.5GB -osrf/space-ros latest 629b13cf7b74 12 hours ago 7.8GB +REPOSITORY TAG IMAGE ID CREATED SIZE +osrf/space_nav2 latest 7016292fba1c 32 minutes ago 3.65GB +osrf/space-ros latest cf10cd2cb82c 4 days ago 1.05GB ``` The new image is named **osrf/space_nav2:latest**.