From 16bc293cf3f2b86fbdb9292218eede8af1692def Mon Sep 17 00:00:00 2001 From: Miekale Smith Date: Wed, 11 Feb 2026 18:56:27 -0500 Subject: [PATCH 1/3] docker file updates --- docker/perception/perception.Dockerfile | 44 ++++++++++++++++++++----- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/docker/perception/perception.Dockerfile b/docker/perception/perception.Dockerfile index 6835dc3..c3b4c46 100644 --- a/docker/perception/perception.Dockerfile +++ b/docker/perception/perception.Dockerfile @@ -1,9 +1,9 @@ ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 +ARG AMENT_WS=/root/ament_ws ################################ Source ################################ FROM ${BASE_IMAGE} AS source -ARG AMENT_WS=/root/ament_ws WORKDIR ${AMENT_WS}/src # Copy in source code @@ -55,8 +55,13 @@ RUN apt-get update && \ ca-certificates \ gnupg2 \ libgl1-mesa-glx \ - lsb-release && \ - rm -rf /var/lib/apt/lists/* + lsb-release \ + libssl-dev \ + usbutils \ + libusb-1.0-0-dev \ + pkg-config \ + libgtk-3-dev && \ + rm -rf /var/lib/apt/lists/* RUN python3 -m pip install --upgrade pip @@ -69,25 +74,46 @@ RUN python3 -m pip install --no-cache-dir \ cv_bridge \ opencv-python -# Install prebuilt spconv-cu120 (compatible with CUDA 12.2 due to minor version compatibility) -RUN python3 -m pip install --no-cache-dir spconv-cu120 + +# Clone realsense-ros r/4.56.3 (wrapper) +RUN git clone --branch r/4.56.3 --depth=1 https://github.com/IntelRealSense/realsense-ros.git ${AMENT_WS}/src/realsense-ros + +# Download and extract matching librealsense SDK (v2.56.3) +RUN cd ${AMENT_WS}/src/realsense-ros && \ + wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.56.3.tar.gz && \ + tar xvf v2.56.3.tar.gz && \ + mv librealsense-2.56.3 librealsense && \ + rm v2.56.3.tar.gz + +# Build librealsense SDK first +RUN cd ${AMENT_WS}/src/realsense-ros/librealsense && \ + mkdir build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release \ + -DFORCE_RSUSB_BACKEND=ON \ + -DBUILD_EXAMPLES=false \ + -DBUILD_GRAPHICAL_EXAMPLES=false && \ + make -j$(nproc) && make install # Dependency Cleanup WORKDIR / RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ - rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + rm -rf /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* ################################ Build ################################ FROM dependencies AS build -ARG AMENT_WS=/root/ament_ws +COPY --from=dependencies ${AMENT_WS}/src/realsense-ros ${AMENT_WS}/src/realsense-ros # Build ROS2 packages WORKDIR ${AMENT_WS} RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + --cmake-args \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_EXAMPLES=false \ + -DBUILD_GRAPHICAL_EXAMPLES=false \ + --install-base ${WATONOMOUS_INSTALL} # Source and Build Artifact Cleanup -RUN rm -rf src/* build/* devel/* install/* log/* +RUN rm -rf build/* devel/* install/* log/* # Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh From 14a796222299c81f8c28728c2a4f266f898f1dc3 Mon Sep 17 00:00:00 2001 From: Miekale Smith Date: Thu, 19 Feb 2026 01:32:59 -0500 Subject: [PATCH 2/3] docker file updates for realsense node integratioN --- README.md | 2 +- .../perception/launch/perception.launch.py | 10 +++ autonomy/perception/package.xml | 1 - docker/perception/perception.Dockerfile | 72 ++++++++----------- modules/docker-compose.perception.yaml | 11 ++- watod-config.sh | 1 - 6 files changed, 48 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 102d81b..289c6a7 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Before developing please read these documents. ## CAN Setup -If trying to stimulate robot using canable, you will need to set up the CAN interface. +If you are stimulating the robot using canable, you will need to set up the CAN interface. Run the setup script: ```bash diff --git a/autonomy/perception/launch/perception.launch.py b/autonomy/perception/launch/perception.launch.py index 73447e3..0c98aee 100644 --- a/autonomy/perception/launch/perception.launch.py +++ b/autonomy/perception/launch/perception.launch.py @@ -23,5 +23,15 @@ def generate_launch_description(): remappings=[ # Add any topic remappings here if needed ] + ), + Node( + package='realsense2_camera', + executable='realsense2_camera_node', + name='realsense_node', + output='screen', + parameters=[{ + 'depth_module.depth_profile': '640x480x30', + 'pointcloud.enable': True + }] ) ]) diff --git a/autonomy/perception/package.xml b/autonomy/perception/package.xml index 6e7e2f9..59b5cd8 100644 --- a/autonomy/perception/package.xml +++ b/autonomy/perception/package.xml @@ -11,7 +11,6 @@ ament_copyright diff --git a/docker/perception/perception.Dockerfile b/docker/perception/perception.Dockerfile index c3b4c46..0156b9c 100644 --- a/docker/perception/perception.Dockerfile +++ b/docker/perception/perception.Dockerfile @@ -1,5 +1,4 @@ ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 -ARG AMENT_WS=/root/ament_ws ################################ Source ################################ FROM ${BASE_IMAGE} AS source @@ -10,36 +9,38 @@ WORKDIR ${AMENT_WS}/src COPY autonomy/perception perception COPY autonomy/wato_msgs/common_msgs wato_msgs/common_msgs -# Scan for rosdeps -# RUN apt-get -qq update -# RUN rosdep update -# RUN rosdep install --from-paths . --ignore-src -r -s \ -# | grep 'apt-get install' \ -# | awk '{print $3}' \ -# | sort > /tmp/colcon_install_list +# Install rosdep if not present, update package lists +RUN apt-get update && \ + apt-get install -y --no-install-recommends python3-rosdep && \ + rm -rf /var/lib/apt/lists/* -RUN apt-get -qq update +# Update rosdep database (safe in containers) RUN rosdep update -RUN echo "" > /tmp/colcon_install_list + +# Generate dependency list (simulated install → extract apt packages) +RUN rosdep install \ + --from-paths . \ + --ignore-src \ + --rosdistro $ROS_DISTRO \ + -y \ + --simulate | \ + grep "apt-get install" | \ + sed 's/apt-get install -y //' > /tmp/colcon_install_list || true ################################# Dependencies ################################ FROM ${BASE_IMAGE} AS dependencies # Install Rosdep requirements COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list -RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +RUN apt-get update && \ + apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) # Dependency Cleanup WORKDIR / RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* -# Avoid interactive package prompts -ENV DEBIAN_FRONTEND=noninteractive \ - TZ=Etc/UTC \ - LANG=C.UTF-8 \ - LC_ALL=C.UTF-8 - # Essential build & Python tooling RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -60,7 +61,12 @@ RUN apt-get update && \ usbutils \ libusb-1.0-0-dev \ pkg-config \ - libgtk-3-dev && \ + libgtk-3-dev + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ros-$ROS_DISTRO-librealsense2* \ + ros-$ROS_DISTRO-realsense2-camera* && \ rm -rf /var/lib/apt/lists/* RUN python3 -m pip install --upgrade pip @@ -71,29 +77,8 @@ RUN python3 -m pip install --no-cache-dir \ pybind11>=2.6.0 \ numpy \ fire \ - cv_bridge \ opencv-python - -# Clone realsense-ros r/4.56.3 (wrapper) -RUN git clone --branch r/4.56.3 --depth=1 https://github.com/IntelRealSense/realsense-ros.git ${AMENT_WS}/src/realsense-ros - -# Download and extract matching librealsense SDK (v2.56.3) -RUN cd ${AMENT_WS}/src/realsense-ros && \ - wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.56.3.tar.gz && \ - tar xvf v2.56.3.tar.gz && \ - mv librealsense-2.56.3 librealsense && \ - rm v2.56.3.tar.gz - -# Build librealsense SDK first -RUN cd ${AMENT_WS}/src/realsense-ros/librealsense && \ - mkdir build && cd build && \ - cmake .. -DCMAKE_BUILD_TYPE=Release \ - -DFORCE_RSUSB_BACKEND=ON \ - -DBUILD_EXAMPLES=false \ - -DBUILD_GRAPHICAL_EXAMPLES=false && \ - make -j$(nproc) && make install - # Dependency Cleanup WORKDIR / RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ @@ -101,15 +86,14 @@ RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ ################################ Build ################################ FROM dependencies AS build -COPY --from=dependencies ${AMENT_WS}/src/realsense-ros ${AMENT_WS}/src/realsense-ros +COPY --from=source ${AMENT_WS}/src ${AMENT_WS}/src + # Build ROS2 packages WORKDIR ${AMENT_WS} + RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ colcon build \ - --cmake-args \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_EXAMPLES=false \ - -DBUILD_GRAPHICAL_EXAMPLES=false \ + --cmake-args -DCMAKE_BUILD_TYPE=Release \ --install-base ${WATONOMOUS_INSTALL} # Source and Build Artifact Cleanup diff --git a/modules/docker-compose.perception.yaml b/modules/docker-compose.perception.yaml index 14f9030..770cdd1 100644 --- a/modules/docker-compose.perception.yaml +++ b/modules/docker-compose.perception.yaml @@ -22,9 +22,12 @@ services: devices: - driver: nvidia capabilities: [gpu] + devices: + - /dev/bus/usb:/dev/bus/usb + privileged: true volumes: - ${MONO_DIR}/autonomy/perception:/root/ament_ws/src/perception - command: tail -F anything + command: /bin/bash -c "ros2 launch perception perception.launch.py" perception_dev: build: *perception_build @@ -34,6 +37,10 @@ services: - NVIDIA_VISIBLE_DEVICES=all - NVIDIA_DRIVER_CAPABILITIES=compute,utility profiles: [develop] + privileged: true + devices: + - /dev/bus/usb:/dev/bus/usb volumes: - ${MONO_DIR}/autonomy/perception:/root/ament_ws/src/perception - command: tail -F anything + command: /bin/bash -c "ros2 launch perception perception.launch.py" + # command: tail -f /dev/null diff --git a/watod-config.sh b/watod-config.sh index 6651432..32d00df 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -13,7 +13,6 @@ ## - infrastructure : starts visualization tools ## - interfacing : starts interfacing nodes ## - perception : starts perception nodes -## - controller : starts controller nodes ## - simulation : starts simulation ## - behaviour : starts behaviour nodes ## - samples : starts sample ROS2 pubsub nodes From d898e10a803fc3188cb030d26712265caa18f667 Mon Sep 17 00:00:00 2001 From: Miekale Smith Date: Thu, 19 Feb 2026 02:35:40 -0500 Subject: [PATCH 3/3] perception dep update --- autonomy/perception/launch/perception.launch.py | 7 ++++++- docker/perception/perception.Dockerfile | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/autonomy/perception/launch/perception.launch.py b/autonomy/perception/launch/perception.launch.py index 0c98aee..6497cad 100644 --- a/autonomy/perception/launch/perception.launch.py +++ b/autonomy/perception/launch/perception.launch.py @@ -31,7 +31,12 @@ def generate_launch_description(): output='screen', parameters=[{ 'depth_module.depth_profile': '640x480x30', - 'pointcloud.enable': True + 'pointcloud.enable': True, + 'enable_rgbd': True, + 'enable_sync': True, + 'align_depth.enable': True, + 'enable_color': True, + 'enable_depth': True }] ) ]) diff --git a/docker/perception/perception.Dockerfile b/docker/perception/perception.Dockerfile index 0156b9c..96b3a44 100644 --- a/docker/perception/perception.Dockerfile +++ b/docker/perception/perception.Dockerfile @@ -75,6 +75,7 @@ RUN python3 -m pip install --no-cache-dir \ pccm>=0.4.16 \ ccimport>=0.4.4 \ pybind11>=2.6.0 \ + cv_bridge \ numpy \ fire \ opencv-python