From 9e84028450e530e4017ace681af0dd922c1820fa Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Wed, 10 Jul 2024 08:47:02 +0900 Subject: [PATCH 1/3] jazzy --- .github/workflows/build.yaml | 2 +- .github/workflows/push.yaml | 2 +- CMakeLists.txt | 7 +++++++ docs/docker.md | 4 ++++ mkdocs.yml | 3 +-- scripts/find_matches_superglue.py | 2 +- src/preprocess_ros2.cpp | 7 +++++++ thirdparty/Sophus | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 776c053..5e138ad 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ROS_DISTRO: [humble, noetic] + ROS_DISTRO: [jazzy, humble, noetic] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index f91a600..d9ee7e4 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ROS_DISTRO: [humble, noetic] + ROS_DISTRO: [jazzy, humble, noetic] steps: - uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4073646..5027f03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,13 @@ find_package(OpenCV REQUIRED) find_package(Boost REQUIRED COMPONENTS filesystem program_options) find_package(Iridescence REQUIRED) +set(OLD_DISTRO "humble;galactic;foxy") +if($ENV{ROS_DISTRO} IN_LIST OLD_DISTRO) + add_definitions(-DCV_BRIDGE_INCLUDE_H) +else() + add_definitions(-DCV_BRIDGE_INCLUDE_HPP) +endif() + find_package(OpenMP) if (OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") diff --git a/docs/docker.md b/docs/docker.md index a3cd56f..aa8d183 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -5,6 +5,10 @@ We provide ROS1/ROS2 docker images on our docker hub repository: - [koide3/direct_visual_lidar_calibration:noetic ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/koide3/direct_visual_lidar_calibration/noetic)](https://hub.docker.com/repository/docker/koide3/direct_visual_lidar_calibration) - [koide3/direct_visual_lidar_calibration:humble ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/koide3/direct_visual_lidar_calibration/humble)](https://hub.docker.com/repository/docker/koide3/direct_visual_lidar_calibration) +!!!warning + We avoided including SuperGlue in our images to avoid contamination of its strict license. + If you need the automatic image matching, you must build a docker image with [Dockerfile_with_superglue](https://github.com/koide3/direct_visual_lidar_calibration/tree/main/docker/humble) at your own risk. + ## Pull image ```bash diff --git a/mkdocs.yml b/mkdocs.yml index e6549fe..f1ba636 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,7 +4,7 @@ repo_url: https://github.com/koide3/direct_visual_lidar_calibration site_url: https://koide3.github.io/direct_visual_lidar_calibration/ site_description: "LiDAR-Camera extrinsic calibration toolbox" -theme: +theme: name: material palette: primary: indigo @@ -23,7 +23,6 @@ markdown_extensions: - pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg - - fontawesome_markdown copyright: Copyright © 2023 Kenji Koide extra: diff --git a/scripts/find_matches_superglue.py b/scripts/find_matches_superglue.py index f03d0ae..10e7b85 100755 --- a/scripts/find_matches_superglue.py +++ b/scripts/find_matches_superglue.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # WARNING: SuperGlue is allowed to be used for non-commercial research purposes!! # : You must carefully check and follow its licensing condition!! # : https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/LICENSE diff --git a/src/preprocess_ros2.cpp b/src/preprocess_ros2.cpp index 6e8bf94..ddd3b07 100644 --- a/src/preprocess_ros2.cpp +++ b/src/preprocess_ros2.cpp @@ -5,7 +5,14 @@ #include #include +#ifdef CV_BRIDGE_INCLUDE_H #include +#elif CV_BRIDGE_INCLUDE_HPP +#include +#else +#error "File extension of cv_bridge is unknown!!" +#endif + #include #include #include diff --git a/thirdparty/Sophus b/thirdparty/Sophus index 0422cad..d0b7315 160000 --- a/thirdparty/Sophus +++ b/thirdparty/Sophus @@ -1 +1 @@ -Subproject commit 0422cad3d65f4cfb27014286e1a630e774c9d218 +Subproject commit d0b7315a0d90fc6143defa54596a3a95d9fa10ec From 8d35fb8a88b04deac0f4ca243f882766b47f6550 Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Wed, 10 Jul 2024 08:59:29 +0900 Subject: [PATCH 2/3] add Dockerfile for jazzy --- docker/jazzy/Dockerfile | 41 +++++++++++++++++++++ docker/jazzy/Dockerfile_with_superglue | 51 ++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 docker/jazzy/Dockerfile create mode 100644 docker/jazzy/Dockerfile_with_superglue diff --git a/docker/jazzy/Dockerfile b/docker/jazzy/Dockerfile new file mode 100644 index 0000000..d960b91 --- /dev/null +++ b/docker/jazzy/Dockerfile @@ -0,0 +1,41 @@ +FROM koide3/gtsam_docker:jazzy + +RUN apt-fast update \ + && apt-fast install -y --no-install-recommends \ + libomp-dev libgoogle-glog-dev libgflags-dev libatlas-base-dev libsuitesparse-dev \ + && apt-fast clean \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /root +RUN git clone https://github.com/ceres-solver/ceres-solver \ + && mkdir ceres-solver/build \ + && cd ceres-solver/build \ + && cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DUSE_CUDA=OFF \ + && make -j$(nproc) \ + && make install \ + && rm -rf /root/ceres-solver + +COPY . /root/ros2_ws/src/direct_visual_lidar_calibration + +WORKDIR /root/ros2_ws + +RUN apt-fast update && \ + rosdep install -i --from-paths src --simulate | \ + sed '1d' | sed 's/apt-get install//' | sed 's/ //g' > /tmp/depends && \ + xargs apt-fast install --no-install-recommends -y < /tmp/depends && \ + apt-fast clean && \ + rm -rf /var/lib/apt/lists/* + +RUN /bin/bash -c ". /opt/ros/jazzy/setup.bash; colcon build" + +RUN echo "#!/bin/bash" >> /ros_entrypoint.sh \ + && echo "set -e" >> /ros_entrypoint.sh \ + && echo "source /opt/ros/jazzy/setup.bash" >> /ros_entrypoint.sh \ + && echo "source /root/ros2_ws/install/setup.bash" >> /ros_entrypoint.sh \ + && echo 'exec "$@"' >> /ros_entrypoint.sh \ + && chmod a+x /ros_entrypoint.sh + +WORKDIR /root/ros2_ws/src/direct_visual_lidar_calibration + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["bash"] diff --git a/docker/jazzy/Dockerfile_with_superglue b/docker/jazzy/Dockerfile_with_superglue new file mode 100644 index 0000000..74dc4f2 --- /dev/null +++ b/docker/jazzy/Dockerfile_with_superglue @@ -0,0 +1,51 @@ +FROM koide3/gtsam_docker:jazzy + +RUN apt-fast update \ + && apt-fast install -y --no-install-recommends \ + libomp-dev libgoogle-glog-dev libgflags-dev libatlas-base-dev libsuitesparse-dev \ + && apt-fast clean \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /root +RUN git clone https://github.com/ceres-solver/ceres-solver \ + && mkdir ceres-solver/build \ + && cd ceres-solver/build \ + && cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DUSE_CUDA=OFF \ + && make -j$(nproc) \ + && make install \ + && rm -rf /root/ceres-solver + +COPY . /root/ros2_ws/src/direct_visual_lidar_calibration + +WORKDIR /root/ros2_ws + +RUN apt-fast update && \ + rosdep install -i --from-paths src --simulate | \ + sed '1d' | sed 's/apt-get install//' | sed 's/ //g' > /tmp/depends && \ + xargs apt-fast install --no-install-recommends -y < /tmp/depends && \ + apt-fast clean && \ + rm -rf /var/lib/apt/lists/* + +RUN /bin/bash -c ". /opt/ros/jazzy/setup.bash; colcon build" + +RUN echo "#!/bin/bash" >> /ros_entrypoint.sh \ + && echo "set -e" >> /ros_entrypoint.sh \ + && echo "source /opt/ros/jazzy/setup.bash" >> /ros_entrypoint.sh \ + && echo "source /root/ros2_ws/install/setup.bash" >> /ros_entrypoint.sh \ + && echo 'exec "$@"' >> /ros_entrypoint.sh \ + && chmod a+x /ros_entrypoint.sh + +WORKDIR /root/ros2_ws/src/direct_visual_lidar_calibration + +RUN apt-fast update \ + && apt-fast install -y --no-install-recommends \ + python3-pip python3-numpy python3-torch python3-torchvision python3-matplotlib python3-opencv \ + && apt-fast clean \ + && rm -rf /var/lib/apt/lists/* + +RUN git clone https://github.com/magicleap/SuperGluePretrainedNetwork /root/SuperGlue +ENV PYTHONPATH=$PYTHONPATH:/root/SuperGlue + + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["bash"] From 946a7757eadff2042420fc0331afd34455e5f69c Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Wed, 10 Jul 2024 09:07:10 +0900 Subject: [PATCH 3/3] add pcl --- docker/jazzy/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/jazzy/Dockerfile b/docker/jazzy/Dockerfile index d960b91..14f5a89 100644 --- a/docker/jazzy/Dockerfile +++ b/docker/jazzy/Dockerfile @@ -6,7 +6,13 @@ RUN apt-fast update \ && apt-fast clean \ && rm -rf /var/lib/apt/lists/* -WORKDIR /root +RUN apt-fast update \ + && apt-fast install -y --no-install-recommends \ + libpcl-dev \ + && apt-fast clean \ + && rm -rf /var/lib/apt/lists/* + + WORKDIR /root RUN git clone https://github.com/ceres-solver/ceres-solver \ && mkdir ceres-solver/build \ && cd ceres-solver/build \