Skip to main content

Quadrics for GTSAM

Project description

~ 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},
}

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

gtsam_quadrics-0.3.0.tar.gz (28.1 MB view details)

Uploaded Source

Built Distributions

gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

File details

Details for the file gtsam_quadrics-0.3.0.tar.gz.

File metadata

  • Download URL: gtsam_quadrics-0.3.0.tar.gz
  • Upload date:
  • Size: 28.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for gtsam_quadrics-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d6a3d0dc0d2d23dd7059b753977c70a64ce6782eede5a3de4d0d8f110842f3e9
MD5 01cb9b47708227089fe944ee29a6aec6
BLAKE2b-256 56531303e5781b93853853a9217c9e3c1d55bf659cd755f9e5529c7b6ec3ac47

See more details on using hashes here.

File details

Details for the file gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtsam_quadrics-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 552244ee355d2a620dc9d214af9c6b45c39b253d010b8f80304c61f40b7331b6
MD5 23499d3451f9eb9e38d245e8e8429255
BLAKE2b-256 d1d4b4c0170696dbf9e82e3b4c4fb4d9186e6a70da42503fa671583005f12dd7

See more details on using hashes here.

File details

Details for the file gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtsam_quadrics-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88c8778ab564259b931e5b099512872ad290d5f5ad283942323dcb763175bf23
MD5 8f1c7511887f6530ccbe008d0dc63e7c
BLAKE2b-256 316e37d1adba9df9083ced98314ac61ed4ce3c66de87e7bcf37dbe150863a57c

See more details on using hashes here.

File details

Details for the file gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtsam_quadrics-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b913dad06261a0c13ac1cc0000f626968bb28287bd5b0f7f856188126e324f39
MD5 95227bec380ef99da7a4842492772c80
BLAKE2b-256 4d4e740ad577507a8d03f9a3f5e7d6e267a395d50c40a42cecf85f6680249cf9

See more details on using hashes here.

File details

Details for the file gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtsam_quadrics-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a752e4c6709588142d2409bb5f8e2c8e047c15948b8b097a664d88439a9a1c9
MD5 5bfcb576ce8964d6a84316701d45d965
BLAKE2b-256 cff15ed4eaa99e73fb8f22c18442a04b9c5350ea6c9a149dd5b045e6921ac719

See more details on using hashes here.

File details

Details for the file gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtsam_quadrics-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d2a1fca1aff63fa704193da208c0491c497e9925aeca6ae5f383ab9f9f4c42e
MD5 72fb10ed86a2e2491f496a673d34c1f6
BLAKE2b-256 037bfffdac1a396ab3ac42e7858156ec3833cb47ffd31b3208b6b922334d957f

See more details on using hashes here.

Supported by

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