diff --git a/.github/workflows/build_and_publish_docker.yaml b/.github/workflows/build_and_publish_docker.yaml new file mode 100644 index 0000000..0489de1 --- /dev/null +++ b/.github/workflows/build_and_publish_docker.yaml @@ -0,0 +1,55 @@ +--- +name: build and publish docker images + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * FRI' + +jobs: + build_images_debian11: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + ros_distro: ['humble', 'iron'] + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.debian12 + tags: ghcr.io/${{ github.repository_owner }}/ros:${{ matrix.ros_distro }}-debian + build-args: | + ROS_DISTRO=${{ matrix.ros_distro }} + build_images_debian12: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + ros_distro: ['rolling'] + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.debian11 + tags: ghcr.io/${{ github.repository_owner }}/ros:${{ matrix.ros_distro }}-debian + build-args: | + ROS_DISTRO=${{ matrix.ros_distro }} diff --git a/Dockerfile.debian11 b/Dockerfile.debian11 new file mode 100644 index 0000000..73ddf27 --- /dev/null +++ b/Dockerfile.debian11 @@ -0,0 +1,133 @@ +ARG from=debian:11-slim + +FROM ${from} + +ARG CMAKE_INSTALL_PREFIX=/usr/local +ARG NUM_THREADS=8 + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Update all packages +RUN apt-get update && apt-get -y dist-upgrade \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# install system dependencies +RUN apt-get update -y -qq && \ + : "system dependencies" && \ + apt-get install -y -qq \ + \ + aptitude \ + autoconf \ + automake \ + build-essential \ + cmake \ + curl \ + dnsutils \ + git \ + gnupg2 \ + intltool \ + iputils-ping \ + libblosc1 \ + libbondcpp-dev \ + libcgal-dev \ + lsb-release \ + mlocate \ + npm \ + pkg-config \ + python3-pip \ + software-properties-common \ + tar \ + unzip \ + wget \ + xterm \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# add the ROS 2 GPG key with apt and setup sources.list +RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' && \ + curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - + +# setup environment +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 +ARG ROS_DISTRO +# Environment variables defined using the ENV instruction always override an ARG instruction of the same name. +ENV ROS_DISTRO=${ROS_DISTRO:-rolling} + +# ros-base include begin +# https://github.com/osrf/docker_images/blob/master/ros/galactic/ubuntu/focal/ros-core/Dockerfile +# https://github.com/osrf/docker_images/blob/master/ros/iron/ubuntu/jammy/ros-base/Dockerfile + +# install bootstrap tools + +# there is a broken package python3-colcon-notification, lets install the fix first and then install python3-colcon-common-extensions +# https://github.com/colcon/colcon-notification/issues/63#issuecomment-1823763950 +#TODO(christophfroehlich): remove this fix when the package is fixed +COPY install_colcon_fix.sh /tmp/ +RUN apt-get update && \ + . /tmp/install_colcon_fix.sh && \ + apt-get install --no-install-recommends -y python3-colcon-common-extensions \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install --no-install-recommends -y \ + # python3-colcon-common-extensions \ # there is a broken package python3-colcon-notification, use fix from above or install the others manually from next line + # python3-colcon-cmake python3-colcon-core python3-colcon-defaults python3-colcon-devtools python3-colcon-library-path python3-colcon-metadata python3-colcon-output python3-colcon-package-information python3-colcon-package-selection python3-colcon-parallel-executor python3-colcon-powershell python3-colcon-python-setup-py python3-colcon-recursive-crawl python3-colcon-ros python3-colcon-test-result python3-colcon-argcomplete python3-colcon-bash python3-colcon-cd python3-colcon-override-check \ + python3-colcon-mixin \ + python3-rosdep \ + python3-vcstool \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# bootstrap rosdep +RUN rosdep init && \ + rosdep update --rosdistro $ROS_DISTRO + +# install dependencies via apt +ENV DEBCONF_NOWARNINGS yes + +# install and activate ccache, lld, cppcheck +RUN \ + : "install ccache" \ + && apt-get update -y -qq \ + && apt-get -y install --no-install-recommends ccache lld cppcheck \ + && /usr/sbin/update-ccache-symlinks \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# install new cmake, needed for generate_parameter_library +WORKDIR $CMAKE_WS +RUN \ + : "install cmake" \ + cd /opt/ && \ + git clone --depth 1 --branch v3.23.5 https://github.com/Kitware/CMake.git && \ + cd CMake && \ + ./bootstrap && make && sudo make install + +# ---- ROS ---- +# clone source, ROS core +ENV ROS2_WS /opt/ros2_ws +RUN mkdir -p $ROS2_WS/src +WORKDIR $ROS2_WS +ADD ros-controls.$ROS_DISTRO.repos . +RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/$ROS_DISTRO/ros2.repos src &&\ + vcs import src < ros-controls.$ROS_DISTRO.repos +# build source, ROS core +RUN colcon \ + build \ + --mixin release build-testing-off \ + --cmake-args --no-warn-unused-cli \ + --packages-up-to robot_state_publisher tf2_ros yaml_cpp_vendor tf2_geometry_msgs filters \ + ros2param ros2interface ros2topic ros2action ros2lifecycle ros2launch xacro && \ + rm -rf log + +# set up sourcing of ros +COPY ./ros_entrypoint.sh / +ENTRYPOINT [ "/ros_entrypoint.sh" ] +CMD ["bash"] diff --git a/Dockerfile.debian12 b/Dockerfile.debian12 new file mode 100644 index 0000000..df25e83 --- /dev/null +++ b/Dockerfile.debian12 @@ -0,0 +1,136 @@ +ARG from=debian:12-slim +FROM ${from} + +ARG CMAKE_INSTALL_PREFIX=/usr/local +ARG NUM_THREADS=8 + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Update all packages +RUN apt-get update && apt-get -y dist-upgrade \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# install system dependencies +RUN apt-get update -y -qq && \ + : "system dependencies" && \ + apt-get install -y -qq \ + \ + aptitude \ + autoconf \ + automake \ + build-essential \ + cmake \ + curl \ + dnsutils \ + git \ + gnupg2 \ + intltool \ + iputils-ping \ + libblosc1 \ + libbondcpp-dev \ + libcgal-dev \ + lsb-release \ + mlocate \ + npm \ + pkg-config \ + python3-pip \ + software-properties-common \ + tar \ + unzip \ + wget \ + xterm \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# install project dependencies +COPY install_deps.sh /tmp/ +RUN apt-get update && \ + . /tmp/install_deps.sh \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# add the ROS 2 GPG key with apt and setup sources.list +RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' && \ + curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - + +# setup environment +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 +ARG ROS_DISTRO +# Environment variables defined using the ENV instruction always override an ARG instruction of the same name. +ENV ROS_DISTRO=${ROS_DISTRO:-iron} + +# ros-base include begin +# https://github.com/osrf/docker_images/blob/master/ros/galactic/ubuntu/focal/ros-core/Dockerfile +# https://github.com/osrf/docker_images/blob/master/ros/iron/ubuntu/jammy/ros-base/Dockerfile + +# install bootstrap tools +RUN apt-get update && apt-get install --no-install-recommends -y \ + python3-colcon-common-extensions \ + python3-colcon-mixin \ + python3-rosdep \ + python3-vcstool \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# bootstrap rosdep +RUN rosdep init && \ + rosdep update --rosdistro $ROS_DISTRO + +# setup colcon mixin and metadata +RUN colcon mixin add default \ + https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ + colcon mixin update && \ + colcon metadata add default \ + https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ + colcon metadata update + +# install dependencies via apt +ENV DEBCONF_NOWARNINGS yes + +# install and activate ccache, lld, cppcheck +RUN \ + : "install ccache" \ + && apt-get update -y -qq \ + && apt-get -y install --no-install-recommends ccache lld cppcheck \ + && /usr/sbin/update-ccache-symlinks \ + && \ + : "remove cache" && \ + rm -rf /var/lib/apt/lists/* + +# ---- ROS ---- +# clone source, ROS core +ENV ROS2_WS /opt/ros2_ws +RUN mkdir -p $ROS2_WS/src +WORKDIR $ROS2_WS +ADD ros-controls.$ROS_DISTRO.repos . +RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/$ROS_DISTRO/ros2.repos src &&\ + vcs import src < ros-controls.$ROS_DISTRO.repos +# build source, ROS core +RUN colcon \ + build \ + --mixin release build-testing-off \ + --cmake-args --no-warn-unused-cli \ + --packages-up-to robot_state_publisher tf2_ros yaml_cpp_vendor tf2_geometry_msgs image_transport_plugins filters \ + ros2doctor ros2param ros2interface ros2topic ros2action ros2lifecycle ros2launch xacro && \ + rm -rf log +# build source, ROS core +RUN colcon \ + build \ + --mixin release build-testing-off \ + --cmake-args --no-warn-unused-cli \ + --packages-up-to robot_state_publisher tf2_ros yaml_cpp_vendor tf2_geometry_msgs filters \ + ros2param ros2interface ros2topic ros2action ros2lifecycle ros2launch xacro && \ + rm -rf log + +# set up sourcing of ros +COPY ./ros_entrypoint.sh / +ENTRYPOINT [ "/ros_entrypoint.sh" ] +CMD ["bash"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/install_colcon_fix.sh b/install_colcon_fix.sh new file mode 100755 index 0000000..7083ffd --- /dev/null +++ b/install_colcon_fix.sh @@ -0,0 +1,17 @@ +#!/bin/bash +apt-get install --no-install-recommends -y zstd xz-utils binutils +mkdir -p /tmp/colcon_fix/ +cd /tmp/colcon_fix +apt-get download python3-colcon-notification +# Extract files from the archive +ar x python3-colcon-notification* +rm python3-colcon-notification* +# Uncompress zstd files an re-compress them using xz +zstd -d < control.tar.zst | xz > control.tar.xz +zstd -d < data.tar.zst | xz > data.tar.xz +# Re-create the Debian package in /tmp/ +ar -m -c -a sdsd python3-colcon-notification_new.deb debian-binary control.tar.xz data.tar.xz +# Clean up (optional) +rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst +# install +apt-get install --no-install-recommends -y ./python3-colcon-notification_new.deb \ No newline at end of file diff --git a/ros-controls.humble.repos b/ros-controls.humble.repos new file mode 100644 index 0000000..f2eda8e --- /dev/null +++ b/ros-controls.humble.repos @@ -0,0 +1,10 @@ +repositories: + ros/filters: + type: git + url: https://github.com/ros/filters.git + version: ros2 + ros2-gbp/xacro: + type: git + url: https://github.com/ros2-gbp/xacro-release.git + version: debian/humble/bullseye/xacro + \ No newline at end of file diff --git a/ros-controls.iron.repos b/ros-controls.iron.repos new file mode 100644 index 0000000..def0287 --- /dev/null +++ b/ros-controls.iron.repos @@ -0,0 +1,10 @@ +repositories: + ros/filters: + type: git + url: https://github.com/ros/filters.git + version: ros2 + ros2-gbp/xacro: + type: git + url: https://github.com/ros2-gbp/xacro-release.git + version: debian/iron/bullseye/xacro + \ No newline at end of file diff --git a/ros-controls.rolling.repos b/ros-controls.rolling.repos new file mode 100644 index 0000000..c0ff3a1 --- /dev/null +++ b/ros-controls.rolling.repos @@ -0,0 +1,10 @@ +repositories: + ros/filters: + type: git + url: https://github.com/ros/filters.git + version: ros2 + ros2-gbp/xacro: + type: git + url: https://github.com/ros2-gbp/xacro-release.git + version: debian/rolling/bullseye/xacro + \ No newline at end of file diff --git a/ros_entrypoint.sh b/ros_entrypoint.sh new file mode 100755 index 0000000..db72ed3 --- /dev/null +++ b/ros_entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# setup ros2 environment +source "/opt/ros/$ROS_DISTRO/setup.bash" +exec "$@" \ No newline at end of file