diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07b2f50..edcca20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,11 +8,28 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + + env: + DEBIAN_FRONTEND: noninteractive + + container: + image: ${{ matrix.docker_image }} + + strategy: + matrix: + include: + - docker_image: ubuntu:20.04 + - docker_image: ubuntu:22.04 steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + + - name: install sudo + run: | + apt update + apt install -y sudo + + - uses: actions/checkout@v4 - name: setup run: | diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 8050819..bb06f11 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -100,7 +100,7 @@ add_definitions(-DNVIDIA_VARYINGS) CUDA_COMPILE(cuda_objs ${cuda}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -msse -msse2 -msse3 -DSHADER_DIR=${MULTIMOTIONFUSION_SHADER_DIR}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -DSHADER_DIR=${MULTIMOTIONFUSION_SHADER_DIR}") if(CMAKE_BUILD_TYPE MATCHES Debug) message(STATUS "Debug build.") diff --git a/Core/Model/Model.cpp b/Core/Model/Model.cpp index 06ae45c..045876c 100644 --- a/Core/Model/Model.cpp +++ b/Core/Model/Model.cpp @@ -20,6 +20,7 @@ #include "ModelMatching.h" #include +#include #include #include "Utils/RigidRANSAC.h" @@ -1464,7 +1465,7 @@ void Model::exportTracksPLY(const tracker::Tracks &tracks, const std::string &pa ss_hdr << "ply" << std::endl << "format " << fmt << " 1.0" << std::endl; ss_hdr << "element vertex " << vert_id << std::endl; - for(const std::string &c : {"x", "y", "z"}) { + for(const char *c : {"x", "y", "z"}) { ss_hdr << "property float32 " << c << std::endl; } if (with_descriptor) { diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index 5c43949..39ae3e7 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -6,16 +6,20 @@ set(CMAKE_CXX_STANDARD 17) message(STATUS "Evaluating GUI/CMAKE") -option(ROSBAG "rosbag reader" ON) +if($ENV{ROS_VERSION} EQUAL 1) + set(HASROS1 ON) +endif() + +option(ROSBAG "rosbag reader" ${HASROS1}) -option(ROSNODE "read images live as ROS node" ON) +option(ROSNODE "read images live as ROS node" ${HASROS1}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}") find_package(ZLIB REQUIRED) find_package(CUDA REQUIRED) find_package(OpenNI2 REQUIRED) find_package(OpenCV REQUIRED ) -find_package(Boost REQUIRED) +find_package(Boost REQUIRED filesystem) find_package(JPEG REQUIRED) # TODO: Why do we have to do this here again? @@ -58,7 +62,7 @@ message(STATUS "CMAKE_CURRENT_SOURCE_DIR/../Core: ${${CMAKE_CURRENT_SOURCE_DIR}/ file(GLOB srcs *.cpp) file(GLOB tools_srcs Tools/*.cpp) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -msse -msse2 -msse3") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3") if(CMAKE_BUILD_TYPE MATCHES Debug) message(STATUS "Debug build.") @@ -89,8 +93,7 @@ target_link_libraries(MultiMotionFusionTools ${CUDA_LIBRARIES} ${OPENNI2_LIBRARY} ${OpenCV_LIBRARIES} - boost_filesystem - boost_system + Boost::filesystem pthread ) @@ -104,6 +107,8 @@ target_include_directories(MultiMotionFusionTools PUBLIC ${BOOST_INCLUDE_DIRS} ) +set_property(TARGET MultiMotionFusionTools PROPERTY CXX_STANDARD 17) + if(ROSBAG) target_include_directories(MultiMotionFusionTools PUBLIC ${rosbag_INCLUDE_DIRS} diff --git a/doc/install.sh b/doc/install.sh index f59332b..b035583 100755 --- a/doc/install.sh +++ b/doc/install.sh @@ -1,19 +1,37 @@ #!/usr/bin/env bash +set -e + +source /etc/lsb-release + +if [ "$DISTRIB_RELEASE" = "20.04" ]; then + ROS_DIST="noetic" +elif [ "$DISTRIB_RELEASE" = "22.04" ]; then + ROS_DIST="humble" +else + echo "unsupported Ubuntu distribution" + exit 1 +fi + +source /opt/ros/${ROS_DIST}/setup.bash + +# determine repo from environment variables inside CI or use defaults +MMF_REPO_URL="${GITHUB_SERVER_URL:-https://github.com}/${GITHUB_REPOSITORY:-christian-rauch/MultiMotionFusion}" +MMF_BRANCH="${GITHUB_HEAD_REF:-master}" + echo "setup workspace" -source /opt/ros/noetic/setup.bash -mkdir ~/mmf_ws/ +mkdir -p ~/mmf_ws/ cd ~/mmf_ws/ vcs import << EOF repositories: src/MultiMotionFusion: type: git - url: https://github.com/christian-rauch/MultiMotionFusion.git - version: master + url: ${MMF_REPO_URL}.git + version: ${MMF_BRANCH} src/Pangolin: type: git url: https://github.com/stevenlovegrove/Pangolin.git - version: master + version: v0.8 src/densecrf: type: git url: https://github.com/christian-rauch/densecrf.git @@ -34,7 +52,5 @@ EOF rosdep install --from-paths src --ignore-src -y echo "build workspace" -source /opt/ros/noetic/setup.bash -export CUDACXX=/usr/local/cuda-11.3/bin/nvcc cd ~/mmf_ws/ -colcon build --cmake-args "-DCMAKE_BUILD_TYPE=Release" +colcon build --cmake-args -D CMAKE_BUILD_TYPE=Release -D CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc diff --git a/doc/setup.sh b/doc/setup.sh index a20f8dd..22e824c 100755 --- a/doc/setup.sh +++ b/doc/setup.sh @@ -1,20 +1,42 @@ #!/usr/bin/env bash +set -e + +sudo apt update +sudo -E apt install -y software-properties-common +sudo add-apt-repository -y universe +sudo apt update +sudo -E apt install -y curl wget + +source /etc/lsb-release + +if [ "$DISTRIB_RELEASE" = "20.04" ]; then + CUDA_REPO_VER="ubuntu2004" + ROS_VER="" + ROS_DIST="noetic" +elif [ "$DISTRIB_RELEASE" = "22.04" ]; then + CUDA_REPO_VER="ubuntu2204" + ROS_VER="2" + ROS_DIST="humble" +else + echo "unsupported Ubuntu distribution" + exit 1 +fi + echo "install CUDA" -wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin -sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 -sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub -sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" -sudo apt install --no-install-recommends -y cuda-libraries-dev-11-3 cuda-compiler-11-3 cuda-nvtx-11-3 libcudnn8-dev +wget https://developer.download.nvidia.com/compute/cuda/repos/${CUDA_REPO_VER}/x86_64/cuda-keyring_1.1-1_all.deb +sudo dpkg -i cuda-keyring_1.1-1_all.deb +rm cuda-keyring_1.1-1_all.deb +sudo apt update +sudo apt install --no-install-recommends -y cuda-libraries-dev-11-8 cuda-compiler-11-8 cuda-nvtx-11-8 libcudnn8-dev -echo "install ROS" -sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' -curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +echo "install ROS ${ROS_VER}" +sudo 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/ros${ROS_VER}/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros${ROS_VER}.list > /dev/null sudo apt update -sudo apt install --no-install-recommends -y ros-noetic-ros-base -echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +sudo -E apt install --no-install-recommends -y ros-${ROS_DIST}-ros-base ros-dev-tools +echo "source /opt/ros/${ROS_DIST}/setup.bash" >> ~/.bashrc -echo "install vcstool, rosdep, colcon" -sudo pip3 install -U vcstool rosdep colcon-common-extensions +echo "initialise rosdep" sudo rosdep init rosdep update diff --git a/package.xml b/package.xml index e0c4cd6..e95165a 100644 --- a/package.xml +++ b/package.xml @@ -1,5 +1,5 @@ - + mmf 0.0.0 The MultiMotionFusion package @@ -43,28 +43,16 @@ cmake - eigen - gslicr - densecrf - libboost-dev - pangolin - suitesparse - libopenni2-dev - eigen - gslicr - libboost-dev - pangolin - suitesparse - libopenni2-dev - eigen - gslicr - densecrf - libboost-dev - pangolin - suitesparse - libopenni2-dev + eigen + gslicr + densecrf + libboost-dev + libboost-filesystem-dev + pangolin + suitesparse + libopenni2-dev - rosbag + rosbag tf2 tf2_msgs tf2_eigen @@ -73,7 +61,7 @@ cv_bridge image_geometry super_point_inference - eigen_conversions + eigen_conversions cob_srvs