Equality-Constrained g2o – Extending g2o with Equality Constraint Support
ECG2O extends the open-source g2o (General Graph Optimization) framework by introducing equality constraints. This allows for the addition of equality edge factors, enabling constrained optimization within factor graphs. The library also includes an Augmented Lagrangian implementation as a benchmark for constrained optimization techniques.
ecg2o: A Seamless Extension of g2o for Equality-Constrained Factor Graph Optimization
Submitted to IEEE IROS.
git clone https://github.com/snt-arg/ecg2o.git
cd ecg2o
docker build -t ecg2o -f docker/Dockerfile .
docker run -it --rm ecg2o
cd /workspace
cmake ..
make
./example_gn
or
./example_al
or
./example_soft
or
./oc_test
To set up the environment without Docker, follow these steps:
-
Install Dependencies (Ubuntu 22.04)
sudo apt update sudo apt install -y \ git cmake build-essential libeigen3-dev libspdlog-dev \ libsuitesparse-dev qtdeclarative5-dev qt5-qmake \ libqglviewer-dev-qt5 libmetis-dev
-
Clone and Build g2o with Patch
cd /opt git clone https://github.com/RainerKuemmerle/g2o cd g2o git checkout master
-
Apply Required Code Patch
Edit the file
g2o/core/sparse_optimizer.h
:Find the line:
void update(const double* update);
Replace it with:
virtual void update(const double* update);
This change enables overriding the
update
method required by the BIPM extension. -
Build and Install g2o
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DG2O_USE_OPENMP=ON -DCMAKE_CXX_FLAGS="-DEIGEN_USE_THREADS -DEIGEN_USE_OPENMP" .. make -j$(nproc) sudo make install
-
Build Your Application
Assuming you're in your app's build directory:
cmake .. make
-
**Usage
Once the library is successfully built, you can execute the provided functions for equality-constrained optimization.
./example_gn
or
./example_al
or
./example_soft
or
./oc_test
Ensure that all necessary input files or configurations are correctly set up before execution.
This project is open-source and distributed under GPL-3.0 .