Skip to main content

~ Please see our QuadricSLAM repository for examples of full SLAM systems~

GTSAM Quadrics: quadric landmarks for GTSAM

QUT Centre for Robotics Open Source Best of ACRV Repository Primary language PyPI package License

This repository contains an extension to the popular Georgia Tech Smoothing and Mapping (GTSAM) factor graph optimisation library. We introduce constrained dual quadrics as GTSAM variables, and support the estimation of the quadric parameters using 2-D bounding box measurements. These tools are available in both C++ and Python, and are designed to be used in conjunction with GTSAM. The extensions power our QuadricSLAM library, where we use quadrics for simultaneous localisation and mapping (SLAM) problems.

Demonstrations of GTSAM Quadrics in action

We expect this repository to be active and continually improved upon. If you have any feature requests or experience any bugs, don't hesitate to let us know. Our code is free to use, and licensed under BSD-3. We simply ask that you cite our work if you use QuadricSLAM in your own research.

Installation

Pre-build wheels of this library are available on PyPI for most Linux systems, as well as source distributions. Install the library with:

pip install gtsam_quadrics

The Python library is built from a custom setup.py, which uses CMake to build a custom C++ extension bound using both PyBind11 and Georgia Tech's wrap meta-library.

Building from source

You can build from source if you want closer access to the C++ libraries, or are having trouble finding a pre-compiled wheel for your system. There are two levels you can build the package from source: the Python level using pip, and C++ level using CMake.

All building from source methods expect the following system dependencies to be available:

  • A C++ compiler
  • CMake >= 3.0
  • Boost C++ libraries >= 1.65
  • METIS matrix library

Instructions for installing these dependencies vary across Linux systems, but the following should be sufficient on a relatively recent Ubuntu version:

sudo apt install build-essential cmake libboost-all-dev libmetis-dev

Building the Python package from source

Installing from source is very similar to the pip method above, accept installation is from a local copy:

  1. Clone the repository, and initialise the gtsam submodule:

    git clone --recurse-submodules https://github.com/best-of-acrv/gtsam-quadrics
    
  2. Enter the gtsam_quadrics directory, and simply install via pip (the build process will take a while):

    pip install .
    

Building the C++ package with CMake

  1. Clone the repository, and initialise the gtsam submodule:

    git clone --recurse-submodules https://github.com/best-of-acrv/gtsam-quadrics
    
  2. Create an out-of-source build directory:

    cd gtsam_quadrics
    mkdir build
    cd build
    
  3. Run the configuration and generation CMake steps, optionally building the Python wrapper using the BUILD_PYTHON_WRAP variable:

    cmake -DBUILD_PYTHON_WRAP=ON ..
    
  4. Run the build step:

    cmake --build . -j$(nproc)
    

Then optionally run any of the other supported targets as described below:

Target name Description
check compile and run optional unit tests
examples compiles the c++ examples
doc generates the doxygen documentation
doc_clean removes the doxygen documentation
install installs the gtsam_quadrics c++/python library

Note: documentation requires Doxygen (sudo apt install doxygen) and epstopdf (sudo apt install texlive-font-utils)

Using the GTSAM Quadrics and GTSAM Python APIs

GTSAM Quadrics and GTSAM can be used like native Python packages. Below are some examples to help get you started with using GTSAM Quadrics:

import gtsam
import gtsam_quadrics
import numpy as np

# setup constants
pose_key = int(gtsam.symbol(ord('x'), 0))
quadric_key = int(gtsam.symbol(ord('q'), 5))

# create calibration
calibration = gtsam.Cal3_S2(525.0, 525.0, 0.0, 160.0, 120.0)

# create graph/values
graph = gtsam.NonlinearFactorGraph()
values = gtsam.Values()

# create noise model (SD=10)
bbox_noise = gtsam.noiseModel_Diagonal.Sigmas(np.array([10]*4, dtype=np.float))

# create quadric landmark (pose=eye(4), radii=[1,2,3])
initial_quadric = gtsam_quadrics.ConstrainedDualQuadric(gtsam.Pose3(), np.array([1.,2.,3.]))

# create bounding-box measurement (xmin,ymin,xmax,ymax)
bounds = gtsam_quadrics.AlignedBox2(15,12,25,50)

# create bounding-box factor
bbf = gtsam_quadrics.BoundingBoxFactor(bounds, calibration, pose_key, quadric_key, bbox_noise)

# add landmark to values
initial_quadric.addToValues(values, quadric_key)

# add bbf to graph
graph.add(bbf)


# get quadric estimate from values (assuming the values have changed)
quadric_estimate = gtsam_quadrics.ConstrainedDualQuadric.getFromValues(values, quadric_key)

Citing our work

If you are using this library in academic work, please cite the publication:

L. Nicholson, M. Milford and N. Sünderhauf, "QuadricSLAM: Dual Quadrics From Object Detections as Landmarks in Object-Oriented SLAM," in IEEE Robotics and Automation Letters, vol. 4, no. 1, pp. 1-8, Jan. 2019, doi: 10.1109/LRA.2018.2866205. PDF.

@article{nicholson2019,
  title={QuadricSLAM: Dual Quadrics From Object Detections as Landmarks in Object-Oriented SLAM},
  author={Nicholson, Lachlan and Milford, Michael and Sünderhauf, Niko},
  journal={IEEE Robotics and Automation Letters},
  year={2019},
}

Metadata

Release files for gtsam-quadrics 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gtsam-quadrics 0.3.0
File Size Uploaded
gtsam_quadrics-0.3.0.tar.gz 28.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for gtsam-quadrics 0.3.0
File
gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 129.1 MB

Release files / gtsam_quadrics-0.3.0.tar.gz

Download URL gtsam_quadrics-0.3.0.tar.gz
Size 28.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d6a3d0dc0d2d23dd7059b753977c70a64ce6782eede5a3de4d0d8f110842f3e9
BLAKE2b-256 checksum
How to use checksums
56531303e5781b93853853a9217c9e3c1d55bf659cd755f9e5529c7b6ec3ac47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 20.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
552244ee355d2a620dc9d214af9c6b45c39b253d010b8f80304c61f40b7331b6
BLAKE2b-256 checksum
How to use checksums
d1d4b4c0170696dbf9e82e3b4c4fb4d9186e6a70da42503fa671583005f12dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 20.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
88c8778ab564259b931e5b099512872ad290d5f5ad283942323dcb763175bf23
BLAKE2b-256 checksum
How to use checksums
316e37d1adba9df9083ced98314ac61ed4ce3c66de87e7bcf37dbe150863a57c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 20.1 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b913dad06261a0c13ac1cc0000f626968bb28287bd5b0f7f856188126e324f39
BLAKE2b-256 checksum
How to use checksums
4d4e740ad577507a8d03f9a3f5e7d6e267a395d50c40a42cecf85f6680249cf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 20.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9a752e4c6709588142d2409bb5f8e2c8e047c15948b8b097a664d88439a9a1c9
BLAKE2b-256 checksum
How to use checksums
cff15ed4eaa99e73fb8f22c18442a04b9c5350ea6c9a149dd5b045e6921ac719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 20.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7d2a1fca1aff63fa704193da208c0491c497e9925aeca6ae5f383ab9f9f4c42e
BLAKE2b-256 checksum
How to use checksums
037bfffdac1a396ab3ac42e7858156ec3833cb47ffd31b3208b6b922334d957f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.3.0 This release

6 release files

0.2.2

6 release files

0.2.1

6 release files

0.2.0

6 release files

0.1.3

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page