diff --git a/.gitignore b/.gitignore index 093c8cba..236ffc30 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ build/ !.devcontainer/.env .cache .venv + + +**/compile_commands.json diff --git a/dockerfiles/dev-pkgs.txt b/dockerfiles/dev-pkgs.txt new file mode 100644 index 00000000..e1ac50fd --- /dev/null +++ b/dockerfiles/dev-pkgs.txt @@ -0,0 +1 @@ + ros-jazzy-nmea-navsat-driver diff --git a/dockerfiles/general/pre_install.dockerfile b/dockerfiles/general/pre_install.dockerfile deleted file mode 100644 index 445b5e8f..00000000 --- a/dockerfiles/general/pre_install.dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -#Pull the base image: -FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 AS base -ARG COLCON_BUILD_SEQUENTIAL -ENV UNAME=rcdt -ENV UID=1000 - -# Remove existing user with same UID if exists: -RUN if getent passwd $UID; then userdel $(id -nu $UID); else :; fi - -# Add user: -RUN useradd -m -u $UID -p "$(openssl passwd -1 $UNAME)" $UNAME -RUN usermod -aG sudo,dialout $UNAME - -# Update apt: -RUN apt update - -# Create bashrc file: -RUN echo "if test -f ~/.personal.bashrc; then\nsource ~/.personal.bashrc\nfi" >> /home/$UNAME/.bashrc -RUN echo "if test -f ~/.env; then\nset -a && source ~/.env && set +a\nfi" >> /home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/core_packages.sh b/dockerfiles/install_scripts/core_packages.sh deleted file mode 100755 index 4ba0b389..00000000 --- a/dockerfiles/install_scripts/core_packages.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash -apt install -y \ - flake8 \ - git-lfs \ - htop \ - nano \ - python3-pip \ - zstd - -apt install -y \ - ros-$ROS_DISTRO-launch-pytest \ - ros-$ROS_DISTRO-moveit \ - ros-$ROS_DISTRO-moveit-servo \ - ros-$ROS_DISTRO-moveit-visual-tools \ - ros-$ROS_DISTRO-navigation2 \ - ros-$ROS_DISTRO-nav2-bringup \ - ros-$ROS_DISTRO-plotjuggler-ros \ - ros-$ROS_DISTRO-realsense2-camera \ - ros-$ROS_DISTRO-realsense2-description \ - ros-$ROS_DISTRO-rmw-cyclonedds-cpp \ - ros-$ROS_DISTRO-ros-gz \ - ros-$ROS_DISTRO-ros2-controllers \ - ros-$ROS_DISTRO-rqt-tf-tree \ - ros-$ROS_DISTRO-slam-toolbox \ - ros-$ROS_DISTRO-pointcloud-to-laserscan - -pip install uv --break-system-packages - -echo "export PYTHONPATH=\"/home/$UNAME/rcdt_robotics/.venv/lib/python3.12/site-packages:\$PYTHONPATH\"" \ - >> /home/$UNAME/.bashrc - -echo "export PATH=\"/home/$UNAME/rcdt_robotics/.venv/bin:\$PATH\"" \ - >> /home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/dev_packages.sh b/dockerfiles/install_scripts/dev_packages.sh deleted file mode 100755 index 588f642f..00000000 --- a/dockerfiles/install_scripts/dev_packages.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -apt install -y \ - ros-$ROS_DISTRO-nmea-navsat-driver \ No newline at end of file diff --git a/dockerfiles/install_scripts/franka_lock_unlock.sh b/dockerfiles/install_scripts/franka_lock_unlock.sh deleted file mode 100755 index 6cdad285..00000000 --- a/dockerfiles/install_scripts/franka_lock_unlock.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -mkdir -p /home/$UNAME/franka_lock_unlock/src -cd /home/$UNAME/franka_lock_unlock -git clone https://github.com/alliander-opensource/franka_lock_unlock.git - -rosdep update --rosdistro $ROS_DISTRO -rosdep install --from-paths src -y -i - -colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -echo "source /home/$UNAME/franka_lock_unlock/install/setup.bash" >>/home/$UNAME/.bashrc diff --git a/dockerfiles/install_scripts/franka_ros2.sh b/dockerfiles/install_scripts/franka_ros2.sh deleted file mode 100755 index 2ef5aebf..00000000 --- a/dockerfiles/install_scripts/franka_ros2.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -#Install ros2 franka: https://github.com/frankaemika/franka_ros2 -apt update -mkdir -p /home/$UNAME/franka_ws/src -cd /home/$UNAME/franka_ws - -# Clone a fork with jazzy support, since Franka offers no support yet: -git clone -b v3.0.0 https://github.com/frankarobotics/franka_ros2.git src/franka_ros2 -vcs import src --recursive --skip-existing >/home/$UNAME/.bashrc diff --git a/dockerfiles/install_scripts/husarion_ugv_ros.sh b/dockerfiles/install_scripts/husarion_ugv_ros.sh deleted file mode 100755 index 19e8a942..00000000 --- a/dockerfiles/install_scripts/husarion_ugv_ros.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -#Install husarion_ugv_ros: https://github.com/husarion/husarion_ugv_ros -cd /home/$UNAME -mkdir husarion_ws -cd /home/$UNAME/husarion_ws -git clone -b 2.3.1 https://github.com/husarion/husarion_ugv_ros.git src/husarion_ugv_ros -export HUSARION_ROS_BUILD_TYPE=simulation -vcs import src < src/husarion_ugv_ros/husarion_ugv/${HUSARION_ROS_BUILD_TYPE}_deps.repos - -rosdep update --rosdistro $ROS_DISTRO -rosdep install --from-paths src -y -i - -colcon build --symlink-install --packages-up-to husarion_ugv --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -echo "source /home/$UNAME/husarion_ws/install/setup.bash" >>/home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/nav2_plugins.sh b/dockerfiles/install_scripts/nav2_plugins.sh deleted file mode 100755 index e6d5db98..00000000 --- a/dockerfiles/install_scripts/nav2_plugins.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -mkdir -p /home/$UNAME/nav2_plugins_ws/src -cd /home/$UNAME/nav2_plugins_ws/src -git clone -b jazzy-devel https://github.com/blackcoffeerobotics/vector_pursuit_controller.git -cd /home/$UNAME/nav2_plugins_ws - -rosdep update --rosdistro $ROS_DISTRO -rosdep install --from-paths src -y -i - -colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -echo "source /home/$UNAME/nav2_plugins_ws/install/setup.bash" >>/home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/pyflow.sh b/dockerfiles/install_scripts/pyflow.sh deleted file mode 100755 index 54cac00f..00000000 --- a/dockerfiles/install_scripts/pyflow.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -apt install -y libxcb-cursor-dev -pip install git+https://github.com/alliander-opensource/PyFlow.git@master diff --git a/dockerfiles/install_scripts/ros2_jazzy.sh b/dockerfiles/install_scripts/ros2_jazzy.sh deleted file mode 100755 index 3c214148..00000000 --- a/dockerfiles/install_scripts/ros2_jazzy.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -apt install -y software-properties-common -add-apt-repository universe - -apt update && apt install -y curl -export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') -curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb" # If using Ubuntu derivates use $UBUNTU_CODENAME -dpkg -i /tmp/ros2-apt-source.deb - -apt-get update -apt-get install -y --no-install-recommends \ - ros-dev-tools \ - ros-jazzy-desktop - -rosdep init -rosdep update - -echo "source /opt/ros/jazzy/setup.bash" >> /home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/rosboard.sh b/dockerfiles/install_scripts/rosboard.sh deleted file mode 100644 index 54533b6e..00000000 --- a/dockerfiles/install_scripts/rosboard.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -mkdir -p /home/$UNAME/rosboard_ws/src -cd /home/$UNAME/rosboard_ws -git clone https://github.com/dheera/rosboard.git src/rosboard - -colcon build -echo "source /home/$UNAME/rosboard_ws/install/setup.bash" >>/home/$UNAME/.bashrc diff --git a/dockerfiles/install_scripts/velodyne_ros.sh b/dockerfiles/install_scripts/velodyne_ros.sh deleted file mode 100755 index 84ef5e65..00000000 --- a/dockerfiles/install_scripts/velodyne_ros.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -apt-get install -y libpcap-dev \ - ros-$ROS_DISTRO-velodyne-description \ - -mkdir -p /home/$UNAME/velodyne_ws/src -cd /home/$UNAME/velodyne_ws -git clone -b ros2 https://github.com/alliander-opensource/velodyne.git -rosdep update --rosdistro $ROS_DISTRO -rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y - -colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release - -echo "source /home/$UNAME/velodyne_ws/install/setup.bash" >>/home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/vizanti.sh b/dockerfiles/install_scripts/vizanti.sh deleted file mode 100755 index 673bc122..00000000 --- a/dockerfiles/install_scripts/vizanti.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -mkdir -p /home/$UNAME/vizanti_ws/src -cd /home/$UNAME/vizanti_ws/src -git clone -b ros2 https://github.com/MoffKalast/vizanti.git -git clone -b jazzy https://github.com/alliander-opensource/rws.git - -cd /home/$UNAME/vizanti_ws -rosdep update --rosdistro $ROS_DISTRO -rosdep install --from-paths src -y -i - -colcon build --symlink-install -echo "source /home/$UNAME/vizanti_ws/install/setup.bash" >>/home/$UNAME/.bashrc \ No newline at end of file diff --git a/dockerfiles/install_scripts/zed_sdk.sh b/dockerfiles/install_scripts/zed_sdk.sh deleted file mode 100755 index c472da14..00000000 --- a/dockerfiles/install_scripts/zed_sdk.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -# Based on dockerfile of ZED-ros2-wrapper at: -# https://github.com/stereolabs/zed-ros2-wrapper/blob/e9f54907fbf41ee9ce5d54f3bb694af93dad8bb3/docker/Dockerfile.desktop-humble - -set -e - -UBUNTU_RELEASE_YEAR=24 -CUDA_MAJOR=12 -CUDA_MINOR=9 -ZED_SDK_MAJOR=5 -ZED_SDK_MINOR=0 - -### CUDA “version.txt” marker -echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt || true - -### Download + install ZED SDK -installer="ZED_SDK_Ubuntu${UBUNTU_RELEASE_YEAR}_cuda${CUDA_MAJOR}.${CUDA_MINOR}.run" -sdk_url="https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}/ubuntu${UBUNTU_RELEASE_YEAR}" - -echo "Downloading ${sdk_url} → ${installer} ..." -wget -q -O "${installer}" "${sdk_url}" -chmod +x "${installer}" - -echo "Running installer …" -./"${installer}" -- silent - -chmod -R u+rwX,go+rX /usr/local/zed - -rm -f "${installer}" -rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/dockerfiles/install_scripts/zed_wrapper.sh b/dockerfiles/install_scripts/zed_wrapper.sh deleted file mode 100755 index 851cd0cd..00000000 --- a/dockerfiles/install_scripts/zed_wrapper.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -i - -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -set -e -source /home/$UNAME/.bashrc -apt update - -cd /home/$UNAME -mkdir zed_ws -cd /home/$UNAME/zed_ws -git clone -b jazzy https://github.com/stereolabs/zed-ros2-wrapper.git src/zed_ros2_wrapper - -sudo apt update -rosdep update -rosdep install --from-paths src --rosdistro $ROS_DISTRO -y -r -colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release - -echo "source /home/$UNAME/zed_ws/install/setup.bash" >>/home/$UNAME/.bashrc diff --git a/dockerfiles/rcdt_base.Dockerfile b/dockerfiles/rcdt_base.Dockerfile new file mode 100644 index 00000000..2ad9cfc2 --- /dev/null +++ b/dockerfiles/rcdt_base.Dockerfile @@ -0,0 +1,51 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV UID=1000 +ENV ROS_DISTRO=jazzy + +# Remove existing user with same UID if exists, then add new user: +RUN \ + if getent passwd $UID; then userdel $(id -nu $UID); else :; fi \ + && useradd -m -u $UID -p "$(openssl passwd -1 $UNAME)" $UNAME \ + && usermod -aG sudo,dialout $UNAME + +# Create bashrc file: +RUN echo "if test -f ~/.personal.bashrc; then\nsource ~/.personal.bashrc\nfi" >> /home/$UNAME/.bashrc \ + && echo "if test -f ~/.env; then\nset -a && source ~/.env && set +a\nfi" >> /home/$UNAME/.bashrc + +# Add ROS2 to apt sources +RUN apt update && apt install -y -qq --no-install-recommends \ + bash \ + curl \ + git \ + nano \ + nvim \ + software-properties-common \ + && add-apt-repository universe \ + && export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') \ +&& curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release \ +&& echo $VERSION_CODENAME)_all.deb" \ +&& dpkg -i /tmp/ros2-apt-source.deb + +# Install ROS2 +# two-stage install is because otherwise it can't find dependencies in ARM build +RUN apt update && apt install -y --no-install-recommends \ + ros-dev-tools \ + && apt install -y --no-install-recommends \ + ros-$ROS_DISTRO-desktop \ + && rm -rf /var/lib/apt/lists/* \ + && apt autoremove -y \ + && apt clean + +# Run rosdep +RUN rosdep init \ + && rosdep update + +CMD ["sleep", "infinity"] diff --git a/dockerfiles/rcdt_core.Dockerfile b/dockerfiles/rcdt_core.Dockerfile new file mode 100644 index 00000000..26e77b29 --- /dev/null +++ b/dockerfiles/rcdt_core.Dockerfile @@ -0,0 +1,82 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV ROS_DISTRO=jazzy + +# Install core packages +RUN apt-get update \ + && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ + && apt-get install -y --no-install-recommends \ + flake8 \ + git-lfs \ + htop \ + nano \ + python3-pip \ + zstd + +# Install ROS dependencies @TODO some of these can be moved to other files +RUN apt-get install -y --no-install-recommends \ + ros-$ROS_DISTRO-launch-pytest \ + ros-$ROS_DISTRO-moveit \ + ros-$ROS_DISTRO-moveit-servo \ + ros-$ROS_DISTRO-moveit-visual-tools \ + ros-$ROS_DISTRO-navigation2 \ + ros-$ROS_DISTRO-nav2-bringup \ + ros-$ROS_DISTRO-plotjuggler-ros \ + ros-$ROS_DISTRO-realsense2-camera \ + ros-$ROS_DISTRO-realsense2-description \ + ros-$ROS_DISTRO-rmw-cyclonedds-cpp \ + ros-$ROS_DISTRO-ros-gz \ + ros-$ROS_DISTRO-ros2-controllers \ + ros-$ROS_DISTRO-rqt-tf-tree \ + ros-$ROS_DISTRO-slam-toolbox \ + ros-$ROS_DISTRO-pointcloud-to-laserscan \ + && rm -rf /var/lib/apt/lists/* \ + && apt autoremove -y \ + && apt clean + +# Python dependencies +RUN pip install uv --break-system-packages +RUN echo "export PYTHONPATH=\"/home/$UNAME/rcdt_robotics/.venv/lib/python3.12/site-packages:\$PYTHONPATH\"" \ + >> /home/$UNAME/.bashrc \ + && echo "export PATH=\"/home/$UNAME/rcdt_robotics/.venv/bin:\$PATH\"" \ + >> /home/$UNAME/.bashrc + +# Install nav2 plugins +RUN mkdir -p /home/$UNAME/nav2_plugins_ws/src \ + && cd /home/$UNAME/nav2_plugins_ws/src \ + && git clone -b jazzy-devel https://github.com/blackcoffeerobotics/vector_pursuit_controller.git \ + && cd /home/$UNAME/nav2_plugins_ws \ + && rosdep update --rosdistro $ROS_DISTRO \ + && rosdep install --from-paths src -y -i + +WORKDIR /home/$UNAME/nav2_plugins_ws +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build \ + --symlink-install \ + --cmake-args -DCMAKE_BUILD_TYPE=Release \ + --event-handlers console_direct+ \ + && echo "source /home/$UNAME/nav2_plugins_ws/install/setup.bash" >>/home/$UNAME/.bashrc + +# Install vizanti +RUN apt-get update \ + && mkdir -p /home/$UNAME/vizanti_ws/src \ + && cd /home/$UNAME/vizanti_ws/src \ + && git clone -b ros2 https://github.com/MoffKalast/vizanti.git \ + && git clone -b jazzy https://github.com/alliander-opensource/rws.git \ + && cd /home/$UNAME/vizanti_ws \ + && rosdep update --rosdistro $ROS_DISTRO \ + && rosdep install --from-paths src -y -i + +WORKDIR /home/$UNAME/vizanti_ws +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --symlink-install \ + && echo "source /home/$UNAME/vizanti_ws/install/setup.bash" >>/home/$UNAME/.bashrc + +ENTRYPOINT ["/bin/bash"] diff --git a/dockerfiles/rcdt_franka.Dockerfile b/dockerfiles/rcdt_franka.Dockerfile new file mode 100644 index 00000000..309a2496 --- /dev/null +++ b/dockerfiles/rcdt_franka.Dockerfile @@ -0,0 +1,48 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV ROS_DISTRO=jazzy + +# Franka ROS2 library +RUN apt-get update \ + && mkdir -p /home/$UNAME/franka_ws/src \ + && cd /home/$UNAME/franka_ws + +RUN git clone -b v3.0.0 https://github.com/frankarobotics/franka_ros2.git src/franka_ros2 \ + && vcs import src --recursive --skip-existing >/home/$UNAME/.bashrc + +# Franka lock_unlock +RUN . /home/$UNAME/.bashrc \ + && apt-get update \ + && mkdir -p /home/$UNAME/franka_lock_unlock/src \ + && cd /home/$UNAME/franka_lock_unlock + +RUN git clone https://github.com/alliander-opensource/franka_lock_unlock.git \ + && rosdep update --rosdistro $ROS_DISTRO \ + && rosdep install --from-paths src -y -i + +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \ + && echo "source /home/$UNAME/franka_lock_unlock/install/setup.bash" >>/home/$UNAME/.bashrc + +# Install dev packages +COPY dev-pkgs.txt /home/$UNAME/dev-pkgs.txt +RUN apt-get update && apt-get install -y -qq --no-install-recommends \ + `cat /home/$UNAME/dev-pkgs.txt`\ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove \ + && apt-get clean + +ENTRYPOINT ["/bin/bash"] diff --git a/dockerfiles/rcdt_husarion.Dockerfile b/dockerfiles/rcdt_husarion.Dockerfile new file mode 100644 index 00000000..99664b79 --- /dev/null +++ b/dockerfiles/rcdt_husarion.Dockerfile @@ -0,0 +1,34 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV ROS_DISTRO=jazzy + +RUN apt-get update \ + && mkdir -p /home/$UNAME/husarion_ws/src \ + && cd /home/$UNAME/husarion_ws + +RUN git clone -b 2.3.1 https://github.com/husarion/husarion_ugv_ros.git src/husarion_ugv_ros \ + && export HUSARION_ROS_BUILD_TYPE=simulation \ + && vcs import src < src/husarion_ugv_ros/husarion_ugv/${HUSARION_ROS_BUILD_TYPE}_deps.repos \ + && rosdep update --rosdistro $ROS_DISTRO \ + && rosdep install --from-paths src -y -i + +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --symlink-install --packages-up-to husarion_ugv --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \ + && echo "source /home/$UNAME/husarion_ws/install/setup.bash" >>/home/$UNAME/.bashrc + +# Install dev packages +COPY dev-pkgs.txt /home/$UNAME/dev-pkgs.txt +RUN apt-get update && apt-get install -y -qq --no-install-recommends \ + `cat /home/$UNAME/dev-pkgs.txt`\ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove \ + && apt-get clean + +INCLUDE rcdt_post_install.Dockerfile diff --git a/dockerfiles/general/post_install.dockerfile b/dockerfiles/rcdt_post_install.Dockerfile similarity index 100% rename from dockerfiles/general/post_install.dockerfile rename to dockerfiles/rcdt_post_install.Dockerfile diff --git a/dockerfiles/rcdt_robotics.Dockerfile b/dockerfiles/rcdt_robotics.Dockerfile deleted file mode 100644 index a49f98b0..00000000 --- a/dockerfiles/rcdt_robotics.Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# syntax = devthefuture/dockerfile-x -# SPDX-FileCopyrightText: Alliander N. V. -# -# SPDX-License-Identifier: Apache-2.0 - -INCLUDE ./general/pre_install.dockerfile - -COPY ./install_scripts/ros2_jazzy.sh . -RUN ./ros2_jazzy.sh - -COPY ./install_scripts/core_packages.sh . -RUN ./core_packages.sh - -COPY ./install_scripts/zed_sdk.sh . -RUN ./zed_sdk.sh - -COPY ./install_scripts/zed_wrapper.sh . -RUN ./zed_wrapper.sh - -COPY ./install_scripts/franka_ros2.sh . -RUN ./franka_ros2.sh - -COPY ./install_scripts/husarion_ugv_ros.sh . -RUN ./husarion_ugv_ros.sh - -COPY ./install_scripts/nav2_plugins.sh . -RUN ./nav2_plugins.sh - -COPY ./install_scripts/velodyne_ros.sh . -RUN ./velodyne_ros.sh - -COPY ./install_scripts/vizanti.sh . -RUN ./vizanti.sh - -COPY ./install_scripts/franka_lock_unlock.sh . -RUN ./franka_lock_unlock.sh - -COPY ./install_scripts/dev_packages.sh . -RUN ./dev_packages.sh - -INCLUDE ./general/post_install.dockerfile \ No newline at end of file diff --git a/dockerfiles/rcdt_velodyne.Dockerfile b/dockerfiles/rcdt_velodyne.Dockerfile new file mode 100644 index 00000000..c0db3cc2 --- /dev/null +++ b/dockerfiles/rcdt_velodyne.Dockerfile @@ -0,0 +1,38 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV ROS_DISTRO=jazzy + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libpcap-dev \ + ros-$ROS_DISTRO-velodyne-description \ + && rm -rf /var/lib/apt/lists/* \ + && apt autoremove -y \ + && apt clean + +RUN mkdir -p /home/$UNAME/velodyne_ws/src \ + && cd /home/$UNAME/velodyne_ws \ + && git clone -b ros2 https://github.com/alliander-opensource/velodyne.git \ + && rosdep update --rosdistro $ROS_DISTRO \ + && rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y + +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \ + && echo "source /home/$UNAME/velodyne_ws/install/setup.bash" >>/home/$UNAME/.bashrc + +# Install dev packages +COPY dev-pkgs.txt /home/$UNAME/dev-pkgs.txt +RUN apt-get update && apt-get install -y -qq --no-install-recommends \ + `cat /home/$UNAME/dev-pkgs.txt`\ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove \ + && apt-get clean + +INCLUDE rcdt_post_install.Dockerfile diff --git a/dockerfiles/rcdt_vision.Dockerfile b/dockerfiles/rcdt_vision.Dockerfile new file mode 100644 index 00000000..5f2ad21e --- /dev/null +++ b/dockerfiles/rcdt_vision.Dockerfile @@ -0,0 +1,59 @@ +# syntax = devthefuture/dockerfile-x +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARG BASE_IMAGE=ubuntu:latest +FROM $BASE_IMAGE + +ARG TARGETARCH +ARG COLCON_BUILD_SEQUENTIAL +ENV UNAME=rcdt +ENV ROS_DISTRO=jazzy + +ENV UBUNTU_RELEASE_YEAR=24 +ENV CUDA_MAJOR=12 +ENV CUDA_MINOR=9 +ENV ZED_SDK_MAJOR=5 +ENV ZED_SDK_MINOR=0 + +# Exit early if arm64 -- support for ZED SDK in arm64 is not added here yet +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + echo "ZED SDK is not available (yet) for Ubuntu 24.04 on arm64. Please run again with amd64 base image."; \ + exit 1; \ + fi + +# Download and install ZED SDK +RUN echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt || true \ + && installer="ZED_SDK_Ubuntu${UBUNTU_RELEASE_YEAR}_cuda${CUDA_MAJOR}.${CUDA_MINOR}.run" \ + && sdk_url="https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}/ubuntu${UBUNTU_RELEASE_YEAR}" \ + && echo "Downloading ${sdk_url} → ${installer} ..." \ + && wget -q -O "${installer}" "${sdk_url}" \ + && chmod +x "${installer}" \ + && echo "Running installer …" \ + && ./"${installer}" -- silent \ + && chmod -R u+rwX,go+rX /usr/local/zed \ + && rm -f "${installer}" \ + && rm -rf /var/lib/apt/lists/* + +RUN . /home/$UNAME/.bashrc \ + && cd /home/$UNAME \ + && mkdir zed_ws \ + && cd /home/$UNAME/zed_ws \ + && git clone -b jazzy https://github.com/stereolabs/zed-ros2-wrapper.git src/zed_ros2_wrapper \ + && apt update \ + && rosdep update \ + && rosdep install --from-paths src --rosdistro $ROS_DISTRO -y -r + +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release \ + && echo "source /home/$UNAME/zed_ws/install/setup.bash" >>/home/$UNAME/.bashrc + +# Install dev packages +COPY dev-pkgs.txt /home/$UNAME/dev-pkgs.txt +RUN apt-get update && apt-get install -y -qq --no-install-recommends \ + `cat /home/$UNAME/dev-pkgs.txt`\ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove \ + && apt-get clean + +INCLUDE rcdt_post_install.Dockerfile diff --git a/dockerfiles/scripts/build.sh b/dockerfiles/scripts/build.sh new file mode 100755 index 00000000..946a10bd --- /dev/null +++ b/dockerfiles/scripts/build.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 + +############################################################################################ +# Script to build one of the non-base Dockerfiles. +# Each needs the following arguments: +# - ARCH: architecture to build for [amd64 / arm64] +# - PACKAGE: package name to build [core / franka / husarion / velodyne / vision] +# - BASE_PACKAGE: base image tag [base / core] +############################################################################################ + +ARCH=$1 +PACKAGE=$2 +BASE_PACKAGE=$3 +NO_CACHE=$4 +export DOCKER_BUILDKIT=1 + +# Set Docker image tag +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +GIT_BRANCH=$(git branch --show-current) +if [ "$GIT_BRANCH" == "main" ] ; then + IMAGE_TAG=$PACKAGE +else + IMAGE_TAG=$PACKAGE-$GIT_BRANCH +fi + +source ./checks.sh $ARCH + +# Check if base image with specific branch tag exists, otherwise use latest +if [ -n "$(docker images | grep rcdt/robotics | grep $BASE_PACKAGE-$GIT_BRANCH-$ARCH)" ] ; then + echo "Using base image with tag $BASE_PACKAGE-$GIT_BRANCH-$ARCH." + BASE_IMAGE_GIT_TAG=$BASE_PACKAGE-$GIT_BRANCH-$ARCH +else + BASE_IMAGE_GIT_TAG=$BASE_PACKAGE-$ARCH + echo "Base image with tag $BASE_PACKAGE-$GIT_BRANCH-$ARCH not found. Using latest." +fi +echo $BASE_IMAGE_GIT_TAG +BASE_IMAGE=rcdt/robotics:$BASE_IMAGE_GIT_TAG +echo $BASE_IMAGE + +# Build the Docker image +( + cd "$SCRIPT_DIR"/.. && \ + docker build -f rcdt_$PACKAGE.Dockerfile \ + --build-arg BASE_IMAGE=$BASE_IMAGE \ + --platform $PLATFORM \ + $NO_CACHE \ + -t "rcdt/robotics:$IMAGE_TAG-$ARCH" \ + . + ) diff --git a/dockerfiles/scripts/build_base.sh b/dockerfiles/scripts/build_base.sh new file mode 100755 index 00000000..fc469214 --- /dev/null +++ b/dockerfiles/scripts/build_base.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=base + +export DOCKER_BUILDKIT=1 + +# Set Docker image tag +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +GIT_BRANCH=$(git branch --show-current) +if [ "$GIT_BRANCH" == "main" ] ; then + IMAGE_TAG=$PACKAGE +else + IMAGE_TAG=$PACKAGE-$GIT_BRANCH +fi + +source ./checks.sh $ARCH + +# Build the Docker image +BASE_IMAGE=nvidia/cuda:12.9.1-cudnn-devel-ubuntu24.04-$ARCH +( + cd "$SCRIPT_DIR"/.. && \ + docker build -f rcdt_$PACKAGE.Dockerfile \ + --build-arg BASE_IMAGE=$BASE_IMAGE \ + --platform $PLATFORM \ + -t "rcdt/robotics:$IMAGE_TAG-$ARCH" \ + . + ) diff --git a/dockerfiles/scripts/build_core.sh b/dockerfiles/scripts/build_core.sh new file mode 100755 index 00000000..206d087a --- /dev/null +++ b/dockerfiles/scripts/build_core.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=core +BASE_PACKAGE=base + +./build.sh $ARCH $PACKAGE $BASE_PACKAGE diff --git a/dockerfiles/scripts/build_franka.sh b/dockerfiles/scripts/build_franka.sh new file mode 100755 index 00000000..5ed00fa7 --- /dev/null +++ b/dockerfiles/scripts/build_franka.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=franka +BASE_PACKAGE=core + +./build.sh $ARCH $PACKAGE $BASE_PACKAGE diff --git a/dockerfiles/scripts/build_husarion.sh b/dockerfiles/scripts/build_husarion.sh new file mode 100755 index 00000000..3a0d02d3 --- /dev/null +++ b/dockerfiles/scripts/build_husarion.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=husarion +BASE_PACKAGE=core + +./build.sh $ARCH $PACKAGE $BASE_PACKAGE diff --git a/dockerfiles/scripts/build_velodyne.sh b/dockerfiles/scripts/build_velodyne.sh new file mode 100755 index 00000000..3269bcaa --- /dev/null +++ b/dockerfiles/scripts/build_velodyne.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=velodyne +BASE_PACKAGE=core + +./build.sh $ARCH $PACKAGE $BASE_PACKAGE diff --git a/dockerfiles/scripts/build_vision.sh b/dockerfiles/scripts/build_vision.sh new file mode 100755 index 00000000..16d3b242 --- /dev/null +++ b/dockerfiles/scripts/build_vision.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 +PACKAGE=vision +BASE_PACKAGE=core + +./build.sh $ARCH $PACKAGE $BASE_PACKAGE diff --git a/dockerfiles/scripts/checks.sh b/dockerfiles/scripts/checks.sh new file mode 100755 index 00000000..33b3821e --- /dev/null +++ b/dockerfiles/scripts/checks.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 + +# Check the platform +if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ] ; then + echo "Invalid architecture $ARCH. Please choose either 'amd64' or 'arm64'." + exit 1 +else + echo "Running for architecture $ARCH." +fi + +# Set platform and start QEMU if needed +if [ "$ARCH" == "amd64" ] ; then + PLATFORM="linux/amd64" + if [ "$(uname -p)" != "x86_64" ] ; then + echo "ERROR: Running amd64 build on $(uname -p) device, exiting." + exit 1 + fi +else + PLATFORM="linux/arm64/v8" + if [ "$(uname -p)" == "x86_64" ] ; then + echo "***** Setting up QEMU environment... *****" + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + fi +fi diff --git a/dockerfiles/scripts/pull.sh b/dockerfiles/scripts/pull.sh new file mode 100755 index 00000000..de21fe8d --- /dev/null +++ b/dockerfiles/scripts/pull.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Alliander N. V. +# +# SPDX-License-Identifier: Apache-2.0 +ARCH=$1 + +BASE_IMAGE=nvidia/cuda:12.9.1-cudnn-devel-ubuntu24.04 + +if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ] ; then + echo "Invalid architecture $ARCH. Please choose either 'amd64' or 'arm64'." + exit 1 +fi + +docker pull --platform linux/$ARCH $BASE_IMAGE +docker tag $BASE_IMAGE $BASE_IMAGE-$ARCH +echo "Pulled and tagged image $BASE_IMAGE-$ARCH." diff --git a/pyproject.toml b/pyproject.toml index c993b55c..a5bbc02c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ dependencies = [ "psutil>=7.0.0", "pydoclint>=0.6.6", "pymongo>=4.14.1", - "pyrealsense2>=2.56.5.9235", "pytest<8.4.0", "pytest-timeout>=2.4.0", "scipy>=1.16.2", @@ -47,6 +46,11 @@ dependencies = [ "xmltodict>=1.0.2", ] +[project.optional-dependencies] +realsense = [ + "pyrealsense2; platform_machine == 'x86_64'" +] + [dependency-groups] dev = [ "click>=8.2.1",