From ae0276f74c3f6261ec3b85ff7db8182f4b4572a3 Mon Sep 17 00:00:00 2001 From: Patrick Geneva Date: Mon, 13 Dec 2021 13:49:05 -0500 Subject: [PATCH] more workflows and fix ros-free build --- .github/workflows/build.yml | 20 +++++++++++++ .github/workflows/build_ros1.yml | 9 ++++++ .github/workflows/build_ros2.yml | 50 ++++++++++++++++++++++++++++++++ ov_msckf/cmake/ROS1.cmake | 27 ++++++++++++++--- ov_msckf/src/run_simulation.cpp | 4 +++ 5 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/build_ros2.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..05697007e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: ROS Free Workflow + +on: + push: + branches: [ master] + pull_request: + +jobs: + build: + name: "Ubuntu Latest" + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v2 + - name: Configure and Build + run: | + apt-get update && apt-get install -y libeigen3-dev && + mkdir build && cd build && + cmake ../ov_msckf/ && make + diff --git a/.github/workflows/build_ros1.yml b/.github/workflows/build_ros1.yml index a9bd836c6..9564f9a00 100644 --- a/.github/workflows/build_ros1.yml +++ b/.github/workflows/build_ros1.yml @@ -18,6 +18,9 @@ jobs: cd $GITHUB_WORKSPACE/.. && mkdir src/ && mv $REPO/ src/ && mkdir $REPO/ && mv src/ $REPO/ && cd $REPO/ && docker build -t openvins -f $GITHUB_WORKSPACE/src/$REPO/Dockerfile_ros1_16_04 . + - name: Echo Enviroment + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "echo $ROS_DISTRO && echo $ROS_VERSION" - name: Run Build in Docker run: | docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && catkin build" @@ -36,6 +39,9 @@ jobs: cd $GITHUB_WORKSPACE/.. && mkdir src/ && mv $REPO/ src/ && mkdir $REPO/ && mv src/ $REPO/ && cd $REPO/ && docker build -t openvins -f $GITHUB_WORKSPACE/src/$REPO/Dockerfile_ros1_18_04 . + - name: Echo Enviroment + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "echo $ROS_DISTRO && echo $ROS_VERSION" - name: Run Build in Docker run: | docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && catkin build" @@ -54,6 +60,9 @@ jobs: cd $GITHUB_WORKSPACE/.. && mkdir src/ && mv $REPO/ src/ && mkdir $REPO/ && mv src/ $REPO/ && cd $REPO/ && docker build -t openvins -f $GITHUB_WORKSPACE/src/$REPO/Dockerfile_ros1_20_04 . + - name: Echo Enviroment + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "echo $ROS_DISTRO && echo $ROS_VERSION" - name: Run Build in Docker run: | docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && catkin build" diff --git a/.github/workflows/build_ros2.yml b/.github/workflows/build_ros2.yml new file mode 100644 index 000000000..751567a92 --- /dev/null +++ b/.github/workflows/build_ros2.yml @@ -0,0 +1,50 @@ +name: ROS 2 Workflow + +on: + push: + branches: [ master ] + pull_request: + +jobs: + build_1804: + name: "ROS2 Ubuntu 18.04" + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v2 + - name: Create Workspace and Docker Image + run: | + export REPO=$(basename $GITHUB_REPOSITORY) && + cd $GITHUB_WORKSPACE/.. && mkdir src/ && + mv $REPO/ src/ && mkdir $REPO/ && mv src/ $REPO/ && cd $REPO/ && + docker build -t openvins -f $GITHUB_WORKSPACE/src/$REPO/Dockerfile_ros2_18_04 . + - name: Echo Enviroment + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "echo $ROS_DISTRO && echo $ROS_VERSION" + - name: Run Build in Docker + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && colcon build" + - name: Run OpenVINS Simulation! + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && source install/setup.bash && ros2 run ov_msckf run_simulation src/open_vins/config/rpng_sim/estimator_config.yaml" + build_2004: + name: "ROS2 Ubuntu 20.04" + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v2 + - name: Create Workspace and Docker Image + run: | + export REPO=$(basename $GITHUB_REPOSITORY) && + cd $GITHUB_WORKSPACE/.. && mkdir src/ && + mv $REPO/ src/ && mkdir $REPO/ && mv src/ $REPO/ && cd $REPO/ && + docker build -t openvins -f $GITHUB_WORKSPACE/src/$REPO/Dockerfile_ros2_20_04 . + - name: Echo Enviroment + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "echo $ROS_DISTRO && echo $ROS_VERSION" + - name: Run Build in Docker + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && colcon build" + - name: Run OpenVINS Simulation! + run: | + docker run -t --mount type=bind,source=$GITHUB_WORKSPACE,target=/catkin_ws openvins /bin/bash -c "cd /catkin_ws && source install/setup.bash && ros2 run ov_msckf run_simulation src/open_vins/config/rpng_sim/estimator_config.yaml" diff --git a/ov_msckf/cmake/ROS1.cmake b/ov_msckf/cmake/ROS1.cmake index 12ffbc85e..6aaebfb19 100644 --- a/ov_msckf/cmake/ROS1.cmake +++ b/ov_msckf/cmake/ROS1.cmake @@ -35,15 +35,34 @@ list(APPEND thirdparty_libraries # If we are not building with ROS then we need to manually link to its headers # This isn't that elegant of a way, but this at least allows for building without ROS -# See this stackoverflow answer: https://stackoverflow.com/a/11217008/7718197 +# If we had a root cmake we could do this: https://stackoverflow.com/a/11217008/7718197 +# But since we don't we need to basically build all the cpp / h files explicitly :( if (NOT catkin_FOUND OR NOT ENABLE_ROS) + message(WARNING "MANUALLY LINKING TO OV_CORE LIBRARY....") - message(WARNING ${ov_core_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/../ov_core/src/) - list(APPEND thirdparty_libraries ov_core_lib) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/cam/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/cpi/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/feat/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/plot/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/sim/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/track/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/types/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + file(GLOB_RECURSE ov_core_files "${CMAKE_SOURCE_DIR}/../ov_core/src/utils/*.cpp") + list(APPEND library_source_files ${ov_core_files}) + message(WARNING "MANUALLY LINKING TO OV_INIT LIBRARY....") include_directories(${CMAKE_SOURCE_DIR}/../ov_init/src/) - list(APPEND thirdparty_libraries ov_init_lib) + file(GLOB_RECURSE ov_init_files "${CMAKE_SOURCE_DIR}/../ov_init/src/*.[hc]pp") + list(APPEND library_source_files ${ov_init_files}) + endif () ################################################## diff --git a/ov_msckf/src/run_simulation.cpp b/ov_msckf/src/run_simulation.cpp index 081b3bea2..fa5951668 100644 --- a/ov_msckf/src/run_simulation.cpp +++ b/ov_msckf/src/run_simulation.cpp @@ -177,6 +177,10 @@ int main(int argc, char **argv) { viz->visualize_final(); #endif +#if ROS_AVAILABLE == 2 + rclcpp::shutdown(); +#endif + // Done! return EXIT_SUCCESS; }