Skip to main content

g2o: A General Framework for Graph Optimization

Project description

g2o - General Graph Optimization

Linux/Mac: CI Windows: win64 Codacy Badge pre-commit

g2o logo

g2o is an open-source C++ framework for optimizing graph-based nonlinear error functions. g2o has been designed to be easily extensible to a wide range of problems and a new problem typically can be specified in a few lines of code. The current implementation provides solutions to several variants of SLAM and BA.

A wide range of problems in robotics as well as in computer-vision involve the minimization of a non-linear error function that can be represented as a graph. Typical instances are simultaneous localization and mapping (SLAM) or bundle adjustment (BA). The overall goal in these problems is to find the configuration of parameters or state variables that maximally explain a set of measurements affected by Gaussian noise. g2o is an open-source C++ framework for such nonlinear least squares problems. g2o has been designed to be easily extensible to a wide range of problems and a new problem typically can be specified in a few lines of code. The current implementation provides solutions to several variants of SLAM and BA. g2o offers a performance comparable to implementations of state-of-the-art approaches for the specific problems (02/2011).

Python and updated memory management

The branch pymem contains a python wrapper and switches to smart pointer instead of RAW pointers. It is currently experimental but PRs and improvements are welcome - as always.

See g2o-python for the pypi release of g2o's python bindings. See below for how to install the python bindings from this repository directly.

Papers Describing the Approach

Rainer Kuemmerle, Giorgio Grisetti, Hauke Strasdat, Kurt Konolige, and Wolfram Burgard g2o: A General Framework for Graph Optimization IEEE International Conference on Robotics and Automation (ICRA), 2011

Documentation

A detailed description of how the library is structured and how to use and extend it can be found in /doc/g2o.pdf The API documentation can be generated as described in doc/doxygen/readme.txt

License

g2o is licensed under the BSD License. However, some libraries are available under different license terms. See below.

The following parts are licensed under LGPL v2.1+:

  • csparse_extension

The following parts are licensed under GPL3+:

  • g2o_viewer
  • g2o_incremental
  • slam2d_g2o (example for 2D SLAM with a QGLviewer GUI)

Please note that some features of CHOLMOD (which may be used by g2o, see libsuitesparse below) are licensed under the GPL. To avoid the GPL, you may have to re-compile CHOLMOD without including its GPL features. The CHOLMOD library distributed with, for example, Ubuntu or Debian includes the GPL features. For example, the supernodal factorization that is licensed under GPL is considered by g2o if it is available.

Within sub-folders we include software not written by us to guarantee easy compilation and integration into g2o itself.

  • ceres: BSD (see g2o/autodiff/LICENSE) Extracted headers to perform Automatic Differentiation.

  • freeglut: X-Consortium (see g2o/EXTERNAL/freeglut/COPYING) Copyright (c) 1999-2000 Pawel W. Olszta We use a stripped down version for drawing text in OpenGL.

See the doc folder for the full text of the licenses.

g2o is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the licenses for more details.

Requirements

On Ubuntu / Debian these dependencies are resolved by installing the following packages.

  • cmake
  • libeigen3-dev

Optional requirements

On Ubuntu / Debian these dependencies are resolved by installing the following packages.

  • libspdlog-dev
  • libsuitesparse-dev
  • libcereal-dev
  • qtdeclarative5-dev
  • qt5-qmake
  • libqglviewer-dev-qt5

You can install those packages with the following command

sudo apt install libeigen3-dev libspdlog-dev libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5

Mac OS X

If using Homebrew, then

brew install g2o

will install g2o together with its required dependencies. In this case no manual compilation is necessary.

Windows

If using vcpkg, then

script\install-deps-windows.bat

or for full dependencies installation

script\install-additional-deps-windows.bat

will build and install the dependencies. The location of vcpkg and required triplet can be passed as cli arguments respectively. Note that usually vcpkg will auto detect the triplet. Set it only if your are not using the default build for your OS.

Compilation

Our primary development platform is Linux. Experimental support for Mac OS X, Android and Windows (MinGW or MSVC). We recommend a so-called out of source build which can be achieved by the following command sequence.

mkdir build
cd build
cmake ../
make

The binaries will be placed in bin and the libraries in lib which are both located underneath cmake's build folder.

On Windows with vcpkg the following commands will generate build scripts (please change the Visual Studio version number in accordance with your system):

mkdir build
cd build
cmake -DG2O_BUILD_APPS=ON -DG2O_BUILD_EXAMPLES=ON-DVCPKG_TARGET_TRIPLET="%VCPKG_DEFAULT_TRIPLET%" -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT_DIR%\scripts\buildsystems\vcpkg.cmake" ..`
cmake --build . --target ALL_BUILD

If you are compiling on Windows and you are for some reasons not using vcpkg please download Eigen3 and extract it. Within cmake-gui set the variable EIGEN3_INCLUDE_DIR to that directory.

mkdir build
cd build
cmake .. -DG2O_BUILD_APPS=ON -DG2O_BUILD_EXAMPLES=ON -DEIGEN3_INCLUDE_DIR="<THE_PATH_WHERE_YOU_PLACED_EIGEN3_AND_THE_EIGEN3_CMakeLists.txt>"

Cross-Compiling for Android

mkdir build`
cd build`
cmake -DCMAKE_TOOLCHAIN_FILE=../script/android.toolchain.cmake -DANDROID_NDK=<YOUR_PATH_TO_ANDROID_NDK_r10d+> -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" -DEIGEN3_INCLUDE_DIR="<YOUR_PATH_TO_EIGEN>" -DEIGEN3_VERSION_OK=ON ..
cmake --build .

Installing the python wrapper

If you want to install g2opy, i.e., the python bindings for g2o, you can use pip preferably in a virtual env.

Preparing the virtual env

python3 -m venv ~/.venvs/g2opy
source ~/.venvs/g2opy/bin/activate

Installing via pip

pip install -v .

Afterwards you should be able to run the examples. For example, by running python3 python/examples/ba_demo.py.

Acknowledgments

We thank the following contributors for providing patches:

  • Simon J. Julier: patches to achieve compatibility with Mac OS X and others.
  • Michael A. Eriksen for submitting patches to compile with MSVC.
  • Mark Pupilli for submitting patches to compile with MSVC.

Projects using g2o

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g2opy-2.1.0.tar.gz (935.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

g2opy-2.1.0-cp314-cp314-win_amd64.whl (8.0 MB view details)

Uploaded CPython 3.14Windows x86-64

g2opy-2.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

g2opy-2.1.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

g2opy-2.1.0-cp314-cp314-macosx_11_0_arm64.whl (3.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

g2opy-2.1.0-cp314-cp314-macosx_10_15_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

g2opy-2.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

g2opy-2.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

g2opy-2.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

g2opy-2.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file g2opy-2.1.0.tar.gz.

File metadata

  • Download URL: g2opy-2.1.0.tar.gz
  • Upload date:
  • Size: 935.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.10

File hashes

Hashes for g2opy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 36d98561c83fd7ed3ad4cd7bb97a6d0312dee70de627985ea3e5d8f678308faa
MD5 1ee592e2217a8b9ddb56a98717b6d774
BLAKE2b-256 ca92a5574ebfaa5694469d68f23dcf982d47e10b3801bc62ab51eccde2bf5aa5

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: g2opy-2.1.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.12

File hashes

Hashes for g2opy-2.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 885c9d71c98cb13da843aa32172c139d91fcd18b325705580d6dcd0406329a6d
MD5 4d3ca72ec4f710452fba0e29c7a183ba
BLAKE2b-256 26115958656041983d848a66c16e42557ce3cd1001348ebd27a444ff0cf9a802

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65598e8912b29db73be8ff30c6dcaafaa1bbc8ab62e6c5dbe0adee1d642a8bfa
MD5 c83caa41c8e865f2e2c0defb3ac6d422
BLAKE2b-256 313fbc8e24672d0c071db18eb493e042b5e1e7af484a94923bc73db6e2dd0811

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b32911e9b85e7ed93b98b46e8ef050460ab06ace255958f2dc01c561868dbab6
MD5 8940e53005f756f09d12724be46d3eb5
BLAKE2b-256 5f52d799156bcf89f536be35c2ac53e3f36235ef4397e2b1ebf6ea4798af3023

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2f685d7bd3302c023548cfe662a36e60a695ad5b91aa52b32a8c15c3a124802
MD5 d0e7f54a5858e2ba80aca4d2d4475b0f
BLAKE2b-256 d6ab8788dd9f0216035e7708d894c0d455fbcdc6ea25b921217d665ac99d7607

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e7bf78a320dbdfaf28ad97f17baac2d66a4139e15417ce26c4667eb2f78b6fe2
MD5 e218f7003c26d120a9f7b506d64554d8
BLAKE2b-256 734878b5fca01f9473a67fc739bab3e4aea752ea72a9da89f8a7d8edc88a75a4

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d9c3d3c266715032a19a43b519043f888cb6d6cad073ff17336c40ae6bdbe1c0
MD5 32f84ef38daa4accf0da27684fc01a9f
BLAKE2b-256 31570af539fad6881d37f533ddfa5b1e56d2cb261bca71a0b67e9558976d36e4

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14b36bd07c9fa9d497282a57a3c0c7e401e4386be42d7415afa043d84562af6c
MD5 240fa33d35b5c4934b2b3fc706ffab28
BLAKE2b-256 788b2a5ce241b9074d974c4a30cc7130c128320a690dff699c8171729bc2814f

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d28b49ded730fa86b77fd7f673a42db9242061df8bc955f82101652f9b4a21ac
MD5 01ef1e6f27af000ea533b1be12990e20
BLAKE2b-256 d943b4e1e068e50614d36abb215ce54d0183800983c0c837ee4f6ff196c811a5

See more details on using hashes here.

File details

Details for the file g2opy-2.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for g2opy-2.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0ed8960e8a8b265463880439c8672df0f537c7b5869600854cfa7afbc65a9b48
MD5 0d0a6aaa228227b8d3156370d86e7b1e
BLAKE2b-256 63638ca8fe471d525feba8201bb6886b107ef3e416c8fe53dfbc5e210b1d9ad8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page