From a8874fa0d761e48e25b47582080526bd54542b7b Mon Sep 17 00:00:00 2001 From: Bill Finger Date: Wed, 20 Nov 2024 21:07:19 +0300 Subject: [PATCH] Update Dockerfile and dependencies, add installation guide - Switched base image in `Dockerfile` to `nvidia/cuda:12.6.2-cudnn-devel-ubuntu22.04`. - Added non-interactive mode for Debian and streamlined package installation. - Removed unused JSON library build steps. - Enhanced ROS2 installation with keyring and repository setup. - Simplified Python package and framework dependencies installation. - Added commands for `git-lfs` installation and cloning `rbs_assets_library`. - Introduced a new Russian installation guide (`doc/ru/installation.md`) with detailed steps for setting up the framework and dependencies. - Fixed import paths in `octree.py` for consistency with project structure. - Added `all-deps.repos` and `requirements.txt` for managing dependencies. --- Dockerfile | 69 ++++++++++++------- doc/ru/installation.md | 32 +++++++++ .../rbs_gym/envs/observation/octree.py | 2 +- repos/all-deps.repos | 37 ++++++++++ repos/requirements.txt | 29 ++++++++ 5 files changed, 143 insertions(+), 26 deletions(-) create mode 100644 doc/ru/installation.md create mode 100644 repos/all-deps.repos create mode 100644 repos/requirements.txt diff --git a/Dockerfile b/Dockerfile index 1ff2dcb..0aa4050 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,46 +1,65 @@ -FROM billf1nger/ros2-humble-cuda:v12.2.2-cudnn8-ubuntu22.04-gz-nvidia - +FROM nvidia/cuda:12.6.2-cudnn-devel-ubuntu22.04 ARG WSDIR=rbs_ws -ARG config_type=sim ENV RBS_ASSEMBLY_DIR=/assembly +ENV DEBIAN_FRONTEND=noninteractive # COPY /home/bill-finger/assembly /assembly ENV IGN_GAZEBO_RESOURCE_PATH=/${WSDIR}/install/rbs_simulation/share/rbs_simulation/ -RUN apt update && apt install -y \ +RUN apt-get update && apt-get upgrade -y && apt-get install -y \ git \ + software-properties-common \ python3-pip \ lsb-release \ - wget \ - gnupg + curl \ + wget -RUN pip install vcstool -WORKDIR /libs -RUN wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz &&\ - tar -xf v3.11.3.tar.gz &&\ - cd json-3.11.3 &&\ - mkdir build &&\ - cd build &&\ - cmake .. &&\ - make &&\ - make install +# WORKDIR /libs +# RUN wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz &&\ +# tar -xf v3.11.3.tar.gz &&\ +# cd json-3.11.3 &&\ +# mkdir build &&\ +# cd build &&\ +# cmake .. &&\ +# make &&\ +# make install -RUN git clone https://gitlab.com/robossembler/forks/megapose6d.git &&\ - cd megapose6d &&\ - pip install bokeh joblib pin torch transforms3d webdataset omegaconf tqdm &&\ - pip install -e . -RUN git clone https://github.com/thodan/bop_toolkit &&\ - cd bop_toolkit &&\ - pip install -e . +RUN add-apt-repository universe +RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg +RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null + + +RUN apt-get update && apt-get upgrade && apt-get install -y ros-humble-ros-base + +# RUN git clone https://gitlab.com/robossembler/forks/megapose6d.git &&\ +# cd megapose6d &&\ +# pip install bokeh joblib pin torch transforms3d webdataset omegaconf tqdm &&\ +# pip install -e . +# RUN git clone https://github.com/thodan/bop_toolkit &&\ +# cd bop_toolkit &&\ +# pip install -e . WORKDIR /${WSDIR} COPY . src/robossembler-ros2/ -RUN vcs import src/. < src/robossembler-ros2/rbs.${config_type}.repos -RUN apt update && rosdep update && \ +RUN pip install vcstool uv + +# Install framework and dependencies +RUN vcs import src/. < src/robossembler-ros2/repos/all-deps.repos +RUN uv pip install --system -r src/robossembler-ros2/repos/requirements.txt +RUN apt-get update && rosdep update && \ rosdep install -y -r -q --from-paths src --ignore-src --rosdistro humble RUN . /opt/ros/humble/setup.sh && \ colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + + +WORKDIR /${RBS_ASSEMBLY_DIR} +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash +RUN apt-get install git-lfs +RUN git clone https://github.com/solid-sinusoid/rbs_assets_library.git +RUN cd rbs_assets_library && git lfs pull && pip install -e . + +WORKDIR /${WSDIR} diff --git a/doc/ru/installation.md b/doc/ru/installation.md new file mode 100644 index 0000000..55d2446 --- /dev/null +++ b/doc/ru/installation.md @@ -0,0 +1,32 @@ +# Инструкция по установке фреймворка + +Первым делом необходимо установить [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debs.html). Рекомендуется минимальная установка. + +Вторым делом надо собрать [`ros2_control`](https://github.com/ros-controls/ros2_control) из исходников из этого [форка](https://github.com/solid-sinusoid/ros2_control/tree/gz-ros2-cartesian-controllers) стоит отметить, что также существует альтернативная установка с использованием [`vsctool`](https://github.com/dirk-thomas/vcstool) который поставляется с базовыми пакетами ROS2. + +Если устанавливать через `vcstool` тогда необходимые пакеты будут клонированы в тоже рабочее пространство, что и сам фреймворк. Сама команда будет выглядеть так +```sh +vcs import . < robossembler-ros2/repos/all-deps.repos +``` + +Заодно можно выполнить команду для установки всех требуемых библиотек Python +```shell +pip insatll -r robossembler-ros2/repos/requirements.txt +``` + +При этом команду надо выполнять в директории `{robossembler_ws}/src/` + +Более четкая последовательность команд кому лень: +```sh +cd +mkdir -p robossembler-ros2/src && cd robossembler-ros2 +git clone git clone https://seed.robossembler.org/z46gtVRpXaXrGQM7Fxiqu7pLy7kip.git robossembler-ros2 +# Или если вы предпочитаете radicle +rad clone rad:z46gtVRpXaXrGQM7Fxiqu7pLy7kip +cd src +vcs import . < robossembler-ros2/repos/all-deps.repos +pip insatll -r robossembler-ros2/repos/requirements.txt +cd .. +rosdep install --from-paths src -y --ignore-src +colcon build --symlink-install +``` diff --git a/env_manager/rbs_gym/rbs_gym/envs/observation/octree.py b/env_manager/rbs_gym/rbs_gym/envs/observation/octree.py index 4b8f5d0..55caaaf 100644 --- a/env_manager/rbs_gym/rbs_gym/envs/observation/octree.py +++ b/env_manager/rbs_gym/rbs_gym/envs/observation/octree.py @@ -7,7 +7,7 @@ import torch from rclpy.node import Node from sensor_msgs.msg import PointCloud2 -from rbs_gym.envs.utils import Tf2Listener, conversions +from env_manager.utils import Tf2Listener, conversions class OctreeCreator: diff --git a/repos/all-deps.repos b/repos/all-deps.repos new file mode 100644 index 0000000..6dde101 --- /dev/null +++ b/repos/all-deps.repos @@ -0,0 +1,37 @@ +repositories: + rbs_arm: + type: git + url: https://github.com/solid-sinusoid/rbs-arm.git + version: main + robot_builder: + type: git + url: https://github.com/solid-sinusoid/robot-builder.git + version: main + rbs_gripper: + type: git + url: https://github.com/solid-sinusoid/rbs-gripper.git + version: main + behavior_tree: + type: git + url: https://github.com/BehaviorTree/BehaviorTree.ROS2.git + version: humble + dynamic_message_introspection: + type: git + url: https://github.com/osrf/dynamic_message_introspection.git + version: main + robot_builder: + type: git + url: https://github.com/solid-sinusoid/robot-builder.git + version: main + cartesian_controllers: + type: git + url: https://github.com/solid-sinusoid/cartesian_controllers.git + version: gazebo-simulation + ros2_control: + type: git + url: https://github.com/solid-sinusoid/ros2_control.git + version: gz-ros2-cartesian-controllers + gz_ros2_control: + type: git + url: https://github.com/solid-sinusoid/gz_ros2_control.git + version: fts-sensor diff --git a/repos/requirements.txt b/repos/requirements.txt new file mode 100644 index 0000000..1b63770 --- /dev/null +++ b/repos/requirements.txt @@ -0,0 +1,29 @@ +trimesh +pcg-gazebo +loguru +# markupsafe==2.0.1 +# Jinja2==2.6 + + +numpy!=1.24.0,>=1.20 +flask==3.0.3 +Jinja2>=3.1.2 +docutils<0.18,>=0.15 +markdown-it-py<3.0.0,>=1.0.0 +setuptools-scm + +dacite>=1.8.1 +gymnasium>=0.29.1 +numpy>=1.24.0 +open3d>=0.18.0 +scipy>=1.14.1 +tensorflow>=2.17.0 +torch>=2.4.1 +torchvision>=0.19.1 +trimesh>=4.4.9 +wandb>=0.18.6 + +# Packages from devpi custom repository +scenario @ https://devpi.solid-sinusoid.duckdns.org/narmak/dev/+f/63e/86b0583c22e52/scenario-1.4.0-cp310-cp310-linux_x86_64.whl#sha256=63e86b0583c22e52c299b9a25e74a26178fc7dbc423f661bf34e4dd26543d11f +gym-gz @ https://devpi.solid-sinusoid.duckdns.org/narmak/dev/+f/539/1f448c1391486/gym_gz-1.4.0-py3-none-any.whl#sha256=5391f448c13914860e2a65904f6d0fac7eba71daaa3327d8399d7ae516471a68 +gym-gz-models @ https://devpi.solid-sinusoid.duckdns.org/narmak/dev/+f/f42/4784934183e88/gym_gz_models-1.2.0-cp310-cp310-linux_x86_64.whl#sha256=f424784934183e88541c703c789315ba6118661bd221a4bf9135c6a0ee012e96