From 6662008511db744a4dacf94673d5e83bcdd8160d Mon Sep 17 00:00:00 2001 From: Mitchell Cohen Date: Sun, 31 Aug 2025 20:42:35 -0400 Subject: [PATCH] Add automated build and tests pipeline --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ README.md | 12 ++++++++++-- scripts/install_dependencies.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100755 scripts/install_dependencies.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..322dfbb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [ main, develop, setup-ci] + pull_request: + branches: [ main, develop ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + chmod +x scripts/install_dependencies.sh + ./scripts/install_dependencies.sh + + - name: Configure CMake + run: cmake -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: cmake --build build --config Release + + - name: Run tests + run: | + cd build + ctest --output-on-failure --verbose \ No newline at end of file diff --git a/README.md b/README.md index 375558b..2d027b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # Robotic Navigation in Ceres +![CI](https://github.com/mitchellcohen3/ceres_nav/workflows/CI/badge.svg) + This repo contains a set of tools to help implement batch estimators and sliding-window filters for robotic state estimation using Ceres. It contains a set of common factors (such as odometry, vision, and preintegrated IMU factors) used in state estimation, along with common Lie group state definitions such as poses and extended poses. Additionally, both "left" and "right" state definitions are provided for Lie group states, allowing for the user to pick the error definition for Lie group states that best suits the problem at hand. ## Prerequisites @@ -28,9 +30,15 @@ This repo has been tested on Ubuntu 20.04 and has the following requirements: $ cmake -B build -S . -DBUILD_TESTING=OFF $ sudo cmake --build build/ --target install ``` + - **Boost** - for filesystem and program options. Can be installed using + ```bash + $ sudo apt install libboost-all-dev + ``` + +The dependencies can be also installed using the provided `scripts/install_dependencies.sh` script. ## Build -After installing the dependancies, the `ceres_nav` library, tests, and examples can be built using +After installing the dependencies, the `ceres_nav` library, tests, and examples can be built using ``` git clone https://github.com/mitchellcohen3/ceres_nav/ cd ceres_nav @@ -85,7 +93,7 @@ $ cd navlie $ pip install -e . ``` -In this example, the state to be estimated is the IMU state, consisting of orientation $\mathbf{C}_{ab} \in SO(3)$, velocity $\mathbf{v}_a$, position $\mathbf{r}_a, gyroscope bias, and accelerometer bias. This example showcases how the library allows for easily changing the state representation. For example, the user can either represent the state as an element of +In this example, the state to be estimated is the IMU state, consisting of orientation $\mathbf{C}_{ab} \in SO(3)$, velocity $\mathbf{v}_a$, position $\mathbf{r}_a$, gyroscope bias, and accelerometer bias. This example showcases how the library allows for easily changing the state representation. For example, the user can either represent the state as an element of ## Acknowledgements This repo is inspired partially by [libRSF](https://github.com/TUC-ProAut/libRSF), another great library for robust estimation using Ceres. `libRSF` only supports autodiff cost functions, while this repo supports traditional Ceres cost functions with analytic differentiation and provides tools to additionally check Jacobians numerically. The use of analytical derivatives becomes important when implementing sliding window filters for specific problems, such as visual-inertial odometry where the evaluation point of the Jacobians must be artificially modified to ensure consistency. diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh new file mode 100755 index 0000000..483b415 --- /dev/null +++ b/scripts/install_dependencies.sh @@ -0,0 +1,32 @@ +#!/bin/bash +echo "Installing system dependencies..." +sudo apt-get update +sudo apt-get install -y \ + cmake \ + build-essential \ + libeigen3-dev \ + libgoogle-glog-dev \ + libboost-all-dev + +if [ ! -d "/usr/local/include/ceres" ]; then + echo "Installing Ceres..." + git clone https://github.com/ceres-solver/ceres-solver.git + cd ceres-solver + git checkout 2.0.0 + mkdir build && cd build + cmake .. + make + sudo make install + cd ../.. +else + echo "Ceres Solver already installed" +fi + +if [ ! -d "/usr/local/include/catch2" ]; then + git clone https://github.com/catchorg/Catch2.git + cd Catch2 + cmake -B build -S . -DBUILD_TESTING=OFF + sudo cmake --build build/ --target install +else + echo "Catch2 already installed" +fi \ No newline at end of file