diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 8c7c24e..37d4beb 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,71 +1,47 @@ -FROM robotlocomotion/drake:1.29.0 -LABEL maintainer="Aditya Kamireddypalli kamireddypalliaditya@gmail.com" +ARG ROS_DISTRO=rolling +ARG RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +ARG DRAKE_VERSION=1.30.0-1 -ENV ROS_DISTRO=humble -ENV WORKSPACE=/root/workspace/ -ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -ENV DEBIAN_FRONTEND=noninteractive +FROM moveit/moveit2:${ROS_DISTRO}-source +LABEL maintainer="Aditya Kamireddypalli kamireddypalliaditya@gmail.com" -# ROS installation -RUN apt update && \ - apt install locales && \ - locale-gen en_US en_US.UTF-8 && \ - update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ - export LANG=en_US.UTF-8 +ARG ROS_DISTRO +ARG RMW_IMPLEMENTATION +ARG DRAKE_VERSION -RUN apt install -y software-properties-common && \ - add-apt-repository universe +ENV DEBIAN_FRONTEND=noninteractive +ENV WORKSPACE=${ROS_UNDERLAY}/.. + +COPY . ${WORKSPACE}/src/moveit_drake + +RUN apt-get update && \ + apt-get install --no-install-recommends \ + ca-certificates \ + gnupg \ + lsb-release \ + wget -y && \ + wget -qO- https://drake-apt.csail.mit.edu/drake.asc | gpg --dearmor - \ + | sudo tee /etc/apt/trusted.gpg.d/drake.gpg >/dev/null && \ + echo "deb [arch=amd64] https://drake-apt.csail.mit.edu/$(lsb_release -cs) $(lsb_release -cs) main" \ + | sudo tee /etc/apt/sources.list.d/drake.list >/dev/null && \ + apt-get update && \ + apt-get install --no-install-recommends drake-dev=${DRAKE_VERSION} -y -RUN apt update && \ - apt install -y curl git && \ - 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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null +RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ + cd ${WORKSPACE}/src && \ + vcs import < moveit_drake/.docker/upstream.repos --recursive -RUN apt update && \ +RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ + cd ${WORKSPACE} && \ + rosdep update --rosdistro=$ROS_DISTRO && \ + apt-get update && \ apt upgrade -y && \ - apt install -y \ - build-essential \ - clang-format-14 \ - clangd-12 \ - cmake \ - git-lfs \ - python3-colcon-common-extensions \ - python3-flake8 \ - python3-rosdep \ - python3-setuptools \ - python3-vcstool \ - ros-dev-tools \ - ros-${ROS_DISTRO}-desktop \ - ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \ - wget && \ - update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-12 100 - -RUN pip3 install colcon-mixin pre-commit && \ - colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ - colcon mixin update default - -RUN apt update && \ - rosdep init && \ - rosdep update - -# Setup the workspace -WORKDIR ${WORKSPACE} -RUN mkdir -p src - -# Install dependencies of this package -# NOTE: Copying only the necessary files to not bust cache as much. -COPY moveit_drake.repos ${WORKSPACE}/src/moveit_drake/ -WORKDIR ${WORKSPACE}/src/ -RUN vcs import < moveit_drake/moveit_drake.repos - -WORKDIR ${WORKSPACE} -COPY package.xml ${WORKSPACE}/src/moveit_drake/ -RUN apt update && \ - . /opt/ros/${ROS_DISTRO}/setup.sh && \ - rosdep install -r --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y && \ - rm -rf src/moveit_drake + rosdep install --from-paths src --ignore-src -r -y && \ + apt-get install ros-${ROS_DISTRO}-rmw-cyclonedds-cpp -y RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ + cd ${WORKSPACE} && \ + . install/setup.sh && \ colcon build --mixin release --parallel-workers 1 # Set up the entrypoint diff --git a/.docker/upstream.repos b/.docker/upstream.repos new file mode 100644 index 0000000..ab99112 --- /dev/null +++ b/.docker/upstream.repos @@ -0,0 +1,9 @@ +repositories: + moveit_visual_tools: + type: git + url: https://github.com/moveit/moveit_visual_tools + version: ros2 + rviz_visual_tools: + type: git + url: https://github.com/PickNikRobotics/rviz_visual_tools.git + version: ros2 diff --git a/README.md b/README.md index 52f987c..4b6aac2 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,7 @@ rich specification of constraints and costs provided by `drake`. ### Steps The following steps clone and build the base image that you will require to -test/build/run/develop with the repo (and will take some time, as it builds -moveit) +test/build/run/develop with the repo git clone https://github.com/moveit/moveit_drake.git cd moveit_drake @@ -62,10 +61,11 @@ Download the MoveIt Tutorials source code: vcs import < moveit_drake/moveit_drake.repos rosdep install -r --from-paths . --ignore-src --rosdistro ${ROS_DISTRO} -y -Configure and build the workspace: +Configure and build the workspace (this will take some time, as it builds +moveit): cd ${WORKSPACE} - colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release + colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release --parallel-workers 1 ### Run the demo diff --git a/docker-compose.yaml b/docker-compose.yaml index 237c242..5baf316 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,6 +5,10 @@ services: build: context: . dockerfile: .docker/Dockerfile + args: + - ROS_DISTRO=rolling + - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + - DRAKE_VERSION=1.30.0-1 environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1