diff --git a/scripts/Dockerfile.dependencies_humble b/scripts/Dockerfile.dependencies_humble index e82779a..bbe7e02 100644 --- a/scripts/Dockerfile.dependencies_humble +++ b/scripts/Dockerfile.dependencies_humble @@ -2,8 +2,8 @@ FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04 # Make all NVIDIA GPUS visible ARG NVIDIA_VISIBLE_DEVICES=all -ENV NVIDIA_DRIVER_CAPABILITIES all -ENV VIRTUALGL_VERSION=3.0.2 +ENV NVIDIA_DRIVER_CAPABILITIES=all +ENV VIRTUALGL_VERSION=3.1.4 ENV TURBOVNC_VERSION=3.0.3 # Setup NON INTERACTIVE ENVIRONMENT @@ -11,13 +11,13 @@ ENV DEBIAN_FRONTEND=noninteractive # Install locales to prevent errors RUN apt-get clean && \ - apt-get update && \ - apt-get install --no-install-recommends -y locales && \ - rm -rf /var/lib/apt/lists/* && \ - locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 + apt-get update && \ + apt-get install --no-install-recommends -y locales && \ + rm -rf /var/lib/apt/lists/* && \ + locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 ENV ROS_DISTRO=humble ENV AMENT_PREFIX_PATH=/opt/ros/${ROS_DISTRO} @@ -28,6 +28,12 @@ ENV PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python3.10/site-packages ENV ROS_PYTHON_VERSION=3 ENV ROS_VERSION=2 +# gz.msgs10 Python bindings (installed by gz-harmonic apt package) are compiled +# with protoc 3.x and cannot create descriptors under protobuf 4.x / 5.x C++ +# extension. Force pure-Python protobuf parser (backward-compatible with all +# .pb2 files) so gz.msgs10 and onnxruntime-gpu coexist without version pinning. +ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + # Install common tools RUN apt-get update && apt-get install -y \ software-properties-common \ @@ -41,80 +47,66 @@ RUN apt-get update && apt-get install -y \ sudo \ net-tools \ pciutils \ + nlohmann-json3-dev \ && rm -rf /var/lib/apt/lists/* # Install ROS2 and ROS packages RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \ && apt-get update && apt-get install -y \ - ros-${ROS_DISTRO}-ros-base \ - ros-${ROS_DISTRO}-xacro \ - ros-${ROS_DISTRO}-joint-state-publisher \ - ros-${ROS_DISTRO}-rviz2 \ - python3-colcon-common-extensions \ - python3-pip python3-rosdep python3-vcstool \ - python3-argcomplete \ + ros-${ROS_DISTRO}-ros-base \ + ros-${ROS_DISTRO}-xacro \ + ros-${ROS_DISTRO}-joint-state-publisher \ + ros-${ROS_DISTRO}-rviz2 \ + python3-colcon-common-extensions \ + python3-pip python3-rosdep python3-vcstool \ + python3-argcomplete \ && rosdep init \ && rm -rf /var/lib/apt/lists/* -# Install Gazebo 11 -RUN add-apt-repository ppa:openrobotics/gazebo11-gz-cli -RUN apt-get update && apt-get install -y \ - gazebo11 \ - ros-humble-gazebo-ros-pkgs \ - gstreamer1.0-plugins-bad \ - gstreamer1.0-plugins-good \ - gstreamer1.0-plugins-ugly \ - gstreamer1.0-libav \ - libgstreamer-plugins-base1.0-dev \ - libimage-exiftool-perl \ - && apt-get -y autoremove \ - && apt-get clean autoclean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir ~/.gazebo && touch ~/.gazebo/gui.ini - # Install Gazebo Harmonic RUN apt-get update \ && wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ && apt-get update && apt-get install -y -q \ - gz-harmonic \ + gz-harmonic \ && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y \ - ros-humble-ros-gzharmonic \ + ros-humble-ros-gzharmonic \ && rm -rf /var/lib/apt/lists/* # Install VNC # Xorg segfault error mitigation RUN apt-get update && apt-get install -y --no-install-recommends \ - dbus-x11 \ - libdbus-c++-1-0v5 \ - xvfb xauth xfonts-base xkb-data x11-xkb-utils \ - x11vnc \ - xterm \ - xserver-xorg-video-dummy \ - x11-apps \ - && apt-get -y autoremove \ - && apt-get clean autoclean \ - && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* - -RUN wget https://xpra.org/xorg.conf \ + dbus-x11 \ + libdbus-c++-1-0v5 \ + xvfb xauth xfonts-base xkb-data x11-xkb-utils \ + x11vnc \ + xterm \ + xserver-xorg-video-dummy \ + x11-apps \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN curl -L -o xorg.conf https://xpra.org/xorg.conf || echo "Download failed" \ && rm -rf /tmp/* # Install noVNC and websockify -RUN git clone -b v1.4.0 https://github.com/novnc/noVNC.git -RUN cd /noVNC/utils && git clone -b v0.11.0 https://github.com/novnc/websockify.git +RUN git clone --depth=1 --single-branch -b v1.4.0 https://github.com/novnc/noVNC.git +RUN cd /noVNC/utils && git clone --depth=1 --single-branch -b v0.11.0 https://github.com/novnc/websockify.git # VirtualGL and TurboVNC COPY ./gpu/virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./gpu/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb ./gpu/turbovnc_${TURBOVNC_VERSION}_amd64.deb / RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y \ - libxtst6:i386 \ - libxv1:i386 \ - libglu1-mesa:i386 \ - libegl1-mesa:i386 \ - libegl1-mesa:amd64 + libxtst6:i386 \ + libxv1:i386 \ + libglu1-mesa:i386 \ + libegl1-mesa:i386 \ + libegl1-mesa:amd64 \ + && rm -rf /var/lib/apt/lists/* RUN apt-get update && dpkg -i /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \ && rm /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \ @@ -125,7 +117,7 @@ RUN apt-get update && dpkg -i /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtual && chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so \ && chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so \ && apt-get update && apt-get install -y --no-install-recommends \ - /turbovnc_${TURBOVNC_VERSION}_amd64.deb \ + /turbovnc_${TURBOVNC_VERSION}_amd64.deb \ && rm turbovnc_${TURBOVNC_VERSION}_amd64.deb \ && rm -rf /var/lib/apt/lists/* @@ -133,75 +125,117 @@ RUN apt-get update && \ apt-get install -y lxde-common && \ rm -rf /var/lib/apt/lists/* -ENV PATH "$PATH:/opt/VirtualGL/bin:/opt/TurboVNC/bin" - -# Node -RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \ - && apt-get install -y nodejs \ - && npm install -g yarn +ENV PATH="$PATH:/opt/VirtualGL/bin:/opt/TurboVNC/bin" # Install Python 3 pip build dependencies first -RUN python3.10 -m pip install --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2 selenium +RUN python3.10 -m pip install --no-cache-dir --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2 selenium # pip install dependencies -RUN python3.10 -m pip install \ - pylint==3.3.1 transitions==0.9.0 pydantic==2.4.2 websocket-client==1.5.2 \ - argparse==1.4.0 coverage==6.2 cerberus==1.3.4 empy==3.3.4 jinja2==3.0.3 kconfiglib==14.1.0 \ - matplotlib==3.0.* numpy==1.24.3 nunavut==1.1.0 packaging==21.3 pkgconfig==1.5.5 pyros-genmsg==0.5.8 \ - pyulog==1.0.1 pyyaml==5.4.1 requests==2.31.0 serial==0.0.97 six==1.16.0 toml==0.10.2 psutil==5.9.0 \ - onnxruntime==1.15.0 Pillow==9.0.1 opencv-python==4.5.5.64 netron seaborn==0.11.2 watchdog==2.1.5 utm==0.7.0 psycopg2 jedi pyapriltags +RUN python3.10 -m pip install --no-cache-dir \ + pylint==3.3.1 transitions==0.9.0 pydantic==2.4.2 websocket-client==1.5.2 \ + argparse==1.4.0 coverage==6.2 cerberus==1.3.4 empy==3.3.4 jinja2==3.0.3 kconfiglib==14.1.0 \ + matplotlib==3.0.* numpy==1.24.3 nunavut==1.1.0 packaging==21.3 pkgconfig==1.5.5 pyros-genmsg==0.5.8 \ + pyulog==1.0.1 pyyaml==5.4.1 requests==2.31.0 serial==0.0.97 six==1.16.0 toml==0.10.2 psutil==5.9.0 \ + onnxruntime-gpu==1.22.0 Pillow==9.0.1 opencv-python==4.5.5.64 watchdog==2.1.5 utm==0.7.0 psycopg2 jedi pyapriltags + +# CUDA runtime wheels for onnxruntime-gpu==1.22.0 CUDA Execution Provider. +# +# All seven packages below must be upgraded together whenever onnxruntime-gpu +# is bumped. Compatibility ranges declared by the wheel (via ~= operator): +# nvidia-cuda-runtime-cu12 ~= 12.0 nvidia-cuda-nvrtc-cu12 ~= 12.0 +# nvidia-cublas-cu12 (runtime dep of cudnn) +# nvidia-cudnn-cu12 ~= 9.0 +# nvidia-curand-cu12 ~= 10.0 nvidia-cufft-cu12 ~= 11.0 +# +# Upgrade checklist: +# 1. Check the new ORT release notes for CUDA / cuDNN major version changes. +# 2. Run: pip show onnxruntime-gpu | grep Requires — to see declared ~= ranges. +# 3. Pick PyPI versions whose MAJOR matches those ranges (stay on CUDA 12.x, +# cuDNN 9.x, curand 10.x, cufft 11.x until ORT itself changes the range). +# 4. After build, verify inside the container: +# python3 -c "import onnxruntime as ort; print(ort.get_available_providers())" +# CUDAExecutionProvider must appear first. +# 5. Run: ldd $(python3 -c "import onnxruntime, os; print(os.path.dirname(onnxruntime.__file__))")/capi/libonnxruntime_providers_cuda.so +# Every .so must resolve (no "not found" lines). +RUN python3.10 -m pip install --no-cache-dir \ + nvidia-cuda-runtime-cu12==12.8.90 \ + nvidia-cublas-cu12==12.8.4.1 \ + nvidia-cudnn-cu12==9.10.2.21 \ + nvidia-nvjitlink-cu12==12.8.93 \ + nvidia-cuda-nvrtc-cu12==12.8.93 \ + nvidia-curand-cu12==10.3.10.19 \ + nvidia-cufft-cu12==11.4.1.4 + +# Register all pip-installed nvidia .so files with ldconfig so onnxruntime-gpu +# finds them regardless of whether pip used site-packages or dist-packages +COPY config-nvidia-libs.py / +WORKDIR / +RUN chmod u+x config-nvidia-libs.py +RUN python3.10 config-nvidia-libs.py && ldconfig # monaco editor -RUN python3.10 -m pip install black==24.10.0 +RUN python3.10 -m pip install --no-cache-dir black==24.10.0 + +# Install ONNX Runtime C++ API +RUN apt-get update && apt-get install -y wget && \ + wget -q https://github.com/microsoft/onnxruntime/releases/download/v1.22.0/onnxruntime-linux-x64-1.22.0.tgz -O /tmp/onnxruntime.tgz && \ + tar -zxvf /tmp/onnxruntime.tgz -C /tmp && \ + cp -r /tmp/onnxruntime-linux-x64-1.22.0/include/* /usr/local/include/ && \ + cp -r /tmp/onnxruntime-linux-x64-1.22.0/lib/* /usr/local/lib/ && \ + ldconfig && \ + rm -rf /tmp/onnxruntime* && \ + rm -rf /var/lib/apt/lists/* # websocket server dependency -RUN python3.10 -m pip install websocket_server==0.6.4 posix-ipc==1.1.1 django==4.1.7 djangorestframework==3.13.1 \ - django-webpack-loader==1.5.0 django-cors-headers==3.14.0 websockets==11.0.3 asyncio==3.4.3 +RUN python3.10 -m pip install --no-cache-dir websocket_server==0.6.4 posix-ipc==1.1.1 django==4.1.7 djangorestframework==3.13.1 \ + django-webpack-loader==1.5.0 django-cors-headers==3.14.0 websockets==11.0.3 asyncio==3.4.3 # BT STUDIO hotfix -RUN python3.10 -m pip install py-trees autopep8 +RUN python3.10 -m pip install --no-cache-dir py-trees autopep8 RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \ && apt-get update && apt-get install -y \ - ros-humble-py-trees \ - ros-humble-py-trees-ros + ros-humble-py-trees \ + ros-humble-py-trees-ros \ + && rm -rf /var/lib/apt/lists/* ## Aerostack2 WORKDIR /root/ RUN apt-get update && \ - apt-get install apt-utils -y \ - software-properties-common \ - git \ - tmux \ - tmuxinator \ - python3-rosdep \ - python3-pip \ - python3-colcon-common-extensions \ - python3-colcon-mixin \ - python-is-python3 \ - ros-dev-tools \ - python3-flake8 \ - python3-flake8-builtins \ - python3-flake8-comprehensions \ - python3-flake8-docstrings \ - python3-flake8-import-order \ - python3-flake8-quotes \ - cppcheck \ - lcov \ - lsb-release \ - wget \ - gnupg \ - && rm -rf /var/lib/apt/lists/* - -RUN pip3 install \ - pylint \ - flake8==4.0.1 \ - pycodestyle==2.8 \ - cmakelint \ - cpplint \ - colcon-lcov-result \ - PySimpleGUI-4-foss + apt-get install apt-utils -y \ + software-properties-common \ + git \ + tmux \ + tmuxinator \ + python3-rosdep \ + python3-pip \ + python3-colcon-common-extensions \ + python3-colcon-mixin \ + python-is-python3 \ + ros-dev-tools \ + python3-flake8 \ + python3-flake8-builtins \ + python3-flake8-comprehensions \ + python3-flake8-docstrings \ + python3-flake8-import-order \ + python3-flake8-quotes \ + cppcheck \ + lcov \ + lsb-release \ + wget \ + gnupg \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install --no-cache-dir \ + pylint \ + flake8==4.0.1 \ + pycodestyle==2.8 \ + cmakelint \ + cpplint \ + transforms3d \ + colcon-lcov-result \ + PySimpleGUI-4-foss RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml RUN colcon mixin update default @@ -209,7 +243,7 @@ RUN rm -rf log # remove log folder RUN mkdir -p /home/drones_ws/src/ WORKDIR /home/drones_ws/src/ -RUN git clone https://github.com/aerostack2/aerostack2.git -b robotics-academy-fix +RUN git clone --depth=1 https://github.com/aerostack2/aerostack2.git -b 1.1.3 RUN touch aerostack2/as2_hardware_drivers/COLCON_IGNORE RUN touch aerostack2/as2_behavior_tree/COLCON_IGNORE RUN touch aerostack2/as2_map_server/COLCON_IGNORE @@ -220,106 +254,113 @@ RUN touch aerostack2/as2_user_interfaces/as2_visualization/as2_rviz_plugins/COLC WORKDIR /home/drones_ws/ RUN apt-get update && \ - apt-get install -y \ - libbenchmark-dev \ - libeigen3-dev \ - libgeographic-dev \ - libncurses-dev \ - libyaml-cpp-dev \ - pybind11-dev \ - python3-jinja2 \ - python3-pydantic \ - python3-pymap3d \ - python3-pytest \ - ros-humble-action-msgs \ - ros-humble-ament-cmake \ - ros-humble-ament-cmake-gtest \ - ros-humble-ament-cmake-lint-cmake \ - ros-humble-ament-cmake-pytest \ - ros-humble-ament-cmake-python \ - ros-humble-ament-cmake-xmllint \ - ros-humble-ament-copyright \ - ros-humble-ament-flake8 \ - ros-humble-ament-index-cpp \ - ros-humble-ament-lint-auto \ - ros-humble-ament-lint-common \ - ros-humble-ament-pep257 \ - ros-humble-backward-ros \ - ros-humble-builtin-interfaces \ - ros-humble-cv-bridge \ - ros-humble-geographic-msgs \ - ros-humble-geometry-msgs \ - ros-humble-image-transport \ - ros-humble-mocap4r2-msgs \ - ros-humble-nav-msgs \ - ros-humble-pluginlib \ - ros-humble-rclcpp \ - ros-humble-rclcpp-action \ - ros-humble-rclcpp-components \ - ros-humble-rclcpp-lifecycle \ - ros-humble-rclpy \ - ros-humble-robot-state-publisher \ - ros-humble-rosidl-default-generators \ - ros-humble-rosidl-default-runtime \ - ros-humble-rviz2 \ - ros-humble-sdformat-urdf \ - ros-humble-sensor-msgs \ - ros-humble-std-msgs \ - ros-humble-std-srvs \ - ros-humble-tf2 \ - ros-humble-tf2-geometry-msgs \ - ros-humble-tf2-msgs \ - ros-humble-tf2-ros \ - ros-humble-trajectory-msgs \ - ros-humble-visualization-msgs \ - ros-humble-moveit \ - ros-humble-ros2-control \ - ros-humble-ros2-controllers \ - ros-humble-gripper-controllers \ - ros-humble-rmw-cyclonedds-cpp \ - ros-humble-ur \ - ros-humble-ros-testing \ - libpoco-dev \ - && rm -rf /var/lib/apt/lists/* + apt-get install -y \ + libbenchmark-dev \ + libeigen3-dev \ + libgeographic-dev \ + libncurses-dev \ + libyaml-cpp-dev \ + pybind11-dev \ + python3-jinja2 \ + python3-pydantic \ + python3-pymap3d \ + python3-pytest \ + ros-humble-action-msgs \ + ros-humble-ament-cmake \ + ros-humble-ament-cmake-gtest \ + ros-humble-ament-cmake-lint-cmake \ + ros-humble-ament-cmake-pytest \ + ros-humble-ament-cmake-python \ + ros-humble-ament-cmake-xmllint \ + ros-humble-ament-copyright \ + ros-humble-ament-flake8 \ + ros-humble-ament-index-cpp \ + ros-humble-ament-lint-auto \ + ros-humble-ament-lint-common \ + ros-humble-ament-pep257 \ + ros-humble-backward-ros \ + ros-humble-builtin-interfaces \ + ros-humble-cv-bridge \ + ros-humble-geographic-msgs \ + ros-humble-geometry-msgs \ + ros-humble-image-transport \ + ros-humble-mocap4r2-msgs \ + ros-humble-nav-msgs \ + ros-humble-pluginlib \ + ros-humble-rclcpp \ + ros-humble-rclcpp-action \ + ros-humble-rclcpp-components \ + ros-humble-rclcpp-lifecycle \ + ros-humble-rclpy \ + ros-humble-robot-state-publisher \ + ros-humble-rosidl-default-generators \ + ros-humble-rosidl-default-runtime \ + ros-humble-rviz2 \ + ros-humble-sdformat-urdf \ + ros-humble-sensor-msgs \ + ros-humble-std-msgs \ + ros-humble-std-srvs \ + ros-humble-tf2 \ + ros-humble-tf2-geometry-msgs \ + ros-humble-tf2-msgs \ + ros-humble-tf2-ros \ + ros-humble-trajectory-msgs \ + ros-humble-visualization-msgs \ + ros-humble-moveit \ + ros-humble-ros2-control \ + ros-humble-ros2-controllers \ + ros-humble-gripper-controllers \ + ros-humble-rmw-cyclonedds-cpp \ + ros-humble-ur \ + ros-humble-ros-testing \ + ros-humble-pcl-ros \ + ros-humble-tf-transformations \ + ros-humble-pcl-conversions \ + ros-humble-pcl-msgs \ + libpoco-dev \ + libpcl-dev \ + && rm -rf /var/lib/apt/lists/* +# On arm64 (e.g. Apple Silicon), disable parallel colcon builds and LTO +# to avoid GNU make jobserver failures under amd64 emulation. + +ARG TARGETARCH RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release + if [ "$TARGETARCH" = "arm64" ]; then \ + colcon build \ + --symlink-install \ + --executor sequential \ + --cmake-args \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF ; \ + else \ + colcon build \ + --symlink-install \ + --cmake-args \ + -DCMAKE_BUILD_TYPE=Release ; \ + fi # Install CycloneDDS RMW for ROS 2 Humble to fix cycle time issues in humble-moveit (temporary fix) RUN echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> ~/.bashrc -# Instalation for industrial robots - -RUN mkdir -p /home/industrial_ws/src/ABBDriver -WORKDIR /home/industrial_ws/src/ABBDriver -RUN git clone https://github.com/PickNikRobotics/abb_ros2.git -b rolling -RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep update -RUN vcs import < abb_ros2/abb.repos -RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y -WORKDIR /home/industrial_ws/src -RUN git clone https://github.com/ros-controls/gazebo_ros2_control.git -RUN cd gazebo_ros2_control && git reset --hard 9a3736c # Commit for the 0.4.6 version! -RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkAttacher.git -RUN git clone https://github.com/IFRA-Cranfield/IFRA_ObjectPose.git -RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkPose.git -RUN git clone https://github.com/IFRA-Cranfield/ros2_RobotiqGripper.git -# Forked needed in order to read the parameters from main launcher -RUN git clone https://github.com/javizqh/ros2_SimRealRobotControl -RUN sudo cp /home/industrial_ws/src/ros2_SimRealRobotControl/include/move_group_interface_improved.h /opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h -WORKDIR /home/industrial_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release - # Create workspace and add drone packages -RUN echo "source /usr/share/gazebo/setup.bash" >> ~/.bashrc RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc RUN echo 'export AEROSTACK2_PATH=/home/drones_ws/src/aerostack2' >> ~/.bashrc RUN echo 'source $AEROSTACK2_PATH/as2_cli/setup_env.bash' >> ~/.bashrc RUN echo "source /home/drones_ws/install/setup.bash" >> ~/.bashrc -RUN echo "source /home/industrial_ws/install/setup.bash" >> ~/.bashrc # Download and install OMPL library COPY install-ompl-ubuntu.sh / WORKDIR / RUN chmod u+x install-ompl-ubuntu.sh -RUN ./install-ompl-ubuntu.sh --github --python +RUN ./install-ompl-ubuntu.sh --github --python && rm -rf /ompl + +# Clone and build gz_ros2_control for Gazebo Harmonic (gz-sim8) +# This is required for Pick Place Harmonic exercise controller loading +WORKDIR /home/ws/src +RUN git clone --depth 1 https://github.com/ros-controls/gz_ros2_control.git -b humble +WORKDIR /home/ws +RUN /bin/bash -c "source /opt/ros/humble/setup.bash && \ + export GZ_VERSION=harmonic && \ + colcon build --packages-select gz_ros2_control --allow-overriding gz_ros2_control" +WORKDIR / \ No newline at end of file diff --git a/scripts/Dockerfile.humble b/scripts/Dockerfile.humble index b6f09b0..397f491 100644 --- a/scripts/Dockerfile.humble +++ b/scripts/Dockerfile.humble @@ -4,45 +4,45 @@ WORKDIR / # RoboticsInfrasctructure Repository ARG ROBOTICS_INFRASTRUCTURE=$ROBOTICS_INFRASTRUCTURE -RUN mkdir -p /opt/jderobot && \ - git clone --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git -b $ROBOTICS_INFRASTRUCTURE /opt/jderobot - -# create workspace and add Robot packages -RUN mkdir -p /home/ws/src -RUN mv /opt/jderobot/CustomRobots /opt/jderobot/jderobot_drones /home/ws/src/ -RUN mv /opt/jderobot/resources /resources +# Launchers/, Worlds/, Universes/ are intentionally retained in /opt/jderobot (hardcoded in all launch files). +# Only .git history is stripped to recover extra space. +RUN mkdir -p /opt/jderobot /home/ws/src && \ + git clone --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git -b $ROBOTICS_INFRASTRUCTURE /opt/jderobot && \ + mv /opt/jderobot/CustomRobots /opt/jderobot/jderobot_drones /opt/jderobot/jderobot_drones_cpp /opt/jderobot/Industrial /opt/jderobot/common_interfaces_cpp /home/ws/src/ && \ + mv /opt/jderobot/resources /resources && \ + mv -t / /opt/jderobot/scripts/.env /opt/jderobot/scripts/entrypoint.sh /opt/jderobot/scripts/ram_entrypoint.py /opt/jderobot/scripts/test/check_device.py /opt/jderobot/scripts/set_dri_name.sh /opt/jderobot/scripts/check_ram_version.sh && \ + mv -f /opt/jderobot/scripts/rc.xml /etc/xdg/openbox/LXDE/rc.xml && \ + chmod +x /entrypoint.sh /set_dri_name.sh && \ + rm -rf /opt/jderobot/.git \ + /opt/jderobot/.github \ + /opt/jderobot/database \ + /opt/jderobot/deprecated_assets \ + /opt/jderobot/Docs \ + /opt/jderobot/scripts \ + /opt/jderobot/test \ + /opt/jderobot/Universes \ + /opt/jderobot/utils \ + && rm -f /opt/jderobot/Scenes/*.glb ARG IMAGE_TAG ENV IMAGE_TAG=${IMAGE_TAG} # Clone the RoboticsApplicationManager repository into the src folder inside RoboticsAcademy -ARG RAM=$RAM -RUN git clone https://github.com/JdeRobot/RoboticsApplicationManager.git -b $RAM /RoboticsApplicationManager - -# copy scripts -RUN mv -t / /opt/jderobot/scripts/.env /opt/jderobot/scripts/entrypoint.sh /opt/jderobot/scripts/start_vnc.sh /opt/jderobot/scripts/start_vnc_gpu.sh /opt/jderobot/scripts/kill_all.sh /opt/jderobot/scripts/test/check_device.py /opt/jderobot/scripts/set_dri_name.sh - -# give execution permissions -WORKDIR / -RUN chmod +x /start_vnc.sh /kill_all.sh /entrypoint.sh /start_vnc_gpu.sh /set_dri_name.sh +RUN python3 -m pip install --no-cache-dir robotics_application_manager # Compiling and sourcing the workspace WORKDIR /home/ws RUN /bin/bash -c "source /home/drones_ws/install/setup.bash" -RUN /bin/bash -c "source /home/industrial_ws/install/setup.bash" -RUN /bin/bash -c "source /opt/ros/humble/setup.bash; colcon build --symlink-install" +RUN /bin/bash -c "source /opt/ros/humble/setup.bash; colcon build --symlink-install --packages-ignore gz_ros2_control gz_ros2_control_demos" # Manager websocket EXPOSE 7163 -# noVNC Console -EXPOSE 1108 - -# noVNC Gazebo -EXPOSE 6080 +# Tools ports +EXPOSE 6080-6090 WORKDIR / # Setting environment in both interactive or non-interactive shells -ENV BASH_ENV /.env +ENV BASH_ENV=/.env ENTRYPOINT ["./entrypoint.sh", "-ns"] diff --git a/scripts/build.sh b/scripts/build.sh old mode 100644 new mode 100755 index 4238313..6e9db6a --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,37 +1,35 @@ #!/bin/bash # Default branch if not specified -ROBOTICS_ACADEMY="master" -ROBOTICS_INFRASTRUCTURE="noetic-devel" -RAM="main" -ROS_DISTRO="noetic" +ROBOTICS_ACADEMY="humble-devel" +ROBOTICS_INFRASTRUCTURE="humble-devel" +RAM="humble-devel" +ROS_DISTRO="humble" IMAGE_TAG="test" FORCE_BUILD=false +FORCE_BUILD_NO_CACHE=false Help() { - # Display Help echo "Syntax: build.sh [options]" echo "Options:" - echo " -h Print this Help." - echo " -f Force creation of the base image. If omitted, the base image is created only if " - echo " it doesn't exist." - echo " -a, --academy Branch of RoboticsAcademy. Default: master" - echo " -i, --infra Branch of RoboticsInfrastructure. Default: noetic-devel" - echo " -m, --ram Branch of RoboticsApplicationManager. Default: main" - echo " -r, --ros ROS Distro (humble or noetic). Default: noetic" - echo " -t, --tag Tag name of the image. Default: test" + echo " -h Print this Help." + echo " -f Force creation of the base image. If omitted, the base image is created only if it doesn't exist." + echo " -F Force creation of the base image without using docker cache." + echo " -a, --academy Branch of RoboticsAcademy. Default: humble-devel" + echo " -i, --infra Branch of RoboticsInfrastructure. Default: humble-devel" + echo " -m, --ram Branch of RoboticsApplicationManager. Default: humble-devel" + echo " -r, --ros ROS Distro (humble). Default: humble" + echo " -t, --tag Tag name of the image. Default: test" echo echo "Example:" echo " ./build.sh -t my_image" - echo " ./build.sh -f -a master -i noetic-devel -m main -r noetic -t my_image" - echo " ./build.sh -f --academy master --infra noetic-devel --ram main --ros noetic --tag my_image" echo } while [[ $# -gt 0 ]]; do case "$1" in - -a | --academy) + -a | --academy) ROBOTICS_ACADEMY="$2" shift 2 ;; @@ -55,8 +53,12 @@ while [[ $# -gt 0 ]]; do FORCE_BUILD=true shift ;; - -h | --help) # display Help - echo "Generates RoboticsAcademy RADI image" + -F | --force-no-cache) + FORCE_BUILD_NO_CACHE=true + shift + ;; + -h | --help) + echo "Generates Robotics Backend image" echo Help exit 0 @@ -76,28 +78,37 @@ echo "ROS_DISTRO:-------------------:$ROS_DISTRO" echo "IMAGE_TAG:--------------------:$IMAGE_TAG" echo -# Determine Dockerfile based on ROS_DISTRO -if [[ $ROS_DISTRO == "noetic" ]]; then - DOCKERFILE_BASE="Dockerfile.dependencies_noetic" - DOCKERFILE="Dockerfile.noetic" -elif [[ $ROS_DISTRO == "humble" ]]; then +if [[ $ROS_DISTRO == "humble" ]]; then DOCKERFILE_BASE="Dockerfile.dependencies_humble" DOCKERFILE="Dockerfile.humble" else - echo "Error: Unknown ROS_DISTRO ($ROS_DISTRO). Please set it to 'noetic' or 'humble'." + echo "Error: Unknown ROS_DISTRO ($ROS_DISTRO). Please set it to 'humble'." exit 1 fi -# Build the Docker Base image -if $FORCE_BUILD || [[ "$(docker images -q jderobot/robotics-applications:dependencies-$ROS_DISTRO 2> /dev/null)" == "" ]]; then +if $FORCE_BUILD_NO_CACHE; then + NO_CACHE="--no-cache" +else + NO_CACHE="" +fi + +if $FORCE_BUILD_NO_CACHE || $FORCE_BUILD || [[ "$(docker images -q jderobot/robotics-applications:dependencies-$ROS_DISTRO 2> /dev/null)" == "" ]]; then echo "===================== BUILDING $ROS_DISTRO BASE IMAGE =====================" echo "Building base using $DOCKERFILE_BASE for ROS $ROS_DISTRO" - docker build -f $DOCKERFILE_BASE -t jderobot/robotics-applications:dependencies-$ROS_DISTRO . + docker build $NO_CACHE -f $DOCKERFILE_BASE \ + --build-arg TARGETARCH=$(uname -m | sed 's/x86_64/amd64/;s/arm64/arm64/') \ + -t jderobot/robotics-applications:dependencies-$ROS_DISTRO . +fi + +if [ $? -eq 0 ]; then + echo "Docker Base Image Build Successful" +else + echo "Docker Base Image Build FAILED...exiting" + exit fi -# Build the Docker image -echo "===================== BUILDING $ROS_DISTRO RADI =====================" -echo "Building RADI using $DOCKERFILE for ROS $ROS_DISTRO" +echo "===================== BUILDING $ROS_DISTRO Robotics Backend =====================" +echo "Building Robotics Backend using $DOCKERFILE for ROS $ROS_DISTRO" docker build --no-cache -f $DOCKERFILE \ --build-arg ROBOTICS_ACADEMY=$ROBOTICS_ACADEMY \ @@ -105,4 +116,5 @@ docker build --no-cache -f $DOCKERFILE \ --build-arg RAM=$RAM \ --build-arg ROS_DISTRO=$ROS_DISTRO \ --build-arg IMAGE_TAG=$IMAGE_TAG \ - -t jderobot/robotics-academy:$IMAGE_TAG . + -t jderobot/robotics-backend:$IMAGE_TAG . + \ No newline at end of file diff --git a/scripts/config-nvidia-libs.py b/scripts/config-nvidia-libs.py new file mode 100644 index 0000000..9748328 --- /dev/null +++ b/scripts/config-nvidia-libs.py @@ -0,0 +1,12 @@ +""" +Auxiliary script for setting the Nvidia libraries in the RADI + +Register all pip-installed nvidia .so files with ldconfig so onnxruntime-gpu +finds them regardless of whether pip used site-packages or dist-packages +""" + +import sysconfig, pathlib + +site = pathlib.Path(sysconfig.get_path("purelib")) +conf = "\n".join(str(d) for d in site.glob("nvidia/*/lib") if d.is_dir()) +pathlib.Path("/etc/ld.so.conf.d/nvidia-pip.conf").write_text(conf + "\n") diff --git a/scripts/gpu/virtualgl32_3.0.2_amd64.deb b/scripts/gpu/virtualgl32_3.0.2_amd64.deb deleted file mode 100644 index 4409470..0000000 Binary files a/scripts/gpu/virtualgl32_3.0.2_amd64.deb and /dev/null differ diff --git a/scripts/gpu/virtualgl32_3.1.4_amd64.deb b/scripts/gpu/virtualgl32_3.1.4_amd64.deb new file mode 100644 index 0000000..dc06ed7 Binary files /dev/null and b/scripts/gpu/virtualgl32_3.1.4_amd64.deb differ diff --git a/scripts/gpu/virtualgl_3.0.2_amd64.deb b/scripts/gpu/virtualgl_3.0.2_amd64.deb deleted file mode 100644 index 06f6f2b..0000000 Binary files a/scripts/gpu/virtualgl_3.0.2_amd64.deb and /dev/null differ diff --git a/scripts/gpu/virtualgl_3.1.4_amd64.deb b/scripts/gpu/virtualgl_3.1.4_amd64.deb new file mode 100644 index 0000000..8f7b461 Binary files /dev/null and b/scripts/gpu/virtualgl_3.1.4_amd64.deb differ