GTDynamics is a library that allows the user to express the full kinodynamics constraints of an arbitrary robot configuration on a factor graph. These constraints can be used to solve the forward and inverse dynamics problems.
GTDynamics uses the SDFormat parser to parse SDF/URDF files containing robot descriptions.
Using Homebrew is the easiest way to get SDFormat installed and it also makes switching versions straightforward.
$ # Install homebrew.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ # Download sdformat to your preferred location.
$ brew tap osrf/simulation
$ brew install sdformat8
Alternatively, you can install from source if you want more fine-tuned control.
We provide an Ubuntu-based process below. Please reference this tutorial for complete details on installing from source.
# Install basic dependencies
sudo apt-get install ruby-dev build-essential libtinyxml-dev libboost-all-dev cmake pkg-config
# sdformat requires libignition-math
sudo apt-get install libignition-math4-dev
# Specifically download sdformat8
wget http://osrf-distributions.s3.amazonaws.com/sdformat/releases/sdformat-8.6.1.tar.bz2
tar -xvjf sdformat-8.6.1.tar.bz2
cd sdformat-8.6.1
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX ../install ..
make -j4
sudo make install
$ git clone https://github.com/borglab/GTDynamics.git
$ cd GTDynamics
$ mkdir build; cd build
# We can specify the install path with -DCMAKE_INSTALL_PREFIX
$ cmake -DCMAKE_INSTALL_PREFIX ../install ..
$ make
$ sudo make install
$ make check
The /examples
directory contains example projects that demonstrate how to include GTDynamics in your application. To run an example, ensure that the CMAKE_PREFIX_PATH
is set to the GTDynamics install directory.
- Navigate to the example's subdirectory and create a build directory. e.g.
cd GTDynamics/examples/example_forward_dynamics
mkdir build; cd build
- Make the example.
If GTDynamics was installed to ~/JohnDoe/gtdynamics_install
, then run the cmake command with:
cmake -DCMAKE_PREFIX_PATH=~/JohnDoe/gtdynamics_install ..
make
- Run the example!
./exec
GTDynamics now supports a Pybind11-based Python API.
To start, please download and install the GTwrap repository.
To compile and install the GTDynamics python library:
-
In the build directory, run
cmake
with the flagGTDYNAMICS_BUILD_PYTHON=ON
.cmake -DGTDYNAMICS_BUILD_PYTHON=ON ..
-
Build as normal and install the python package.
make && make python-install
-
To run the Python tests, you can simply run:
make python-test
Please cite the following paper if you use this code as part of any published research:
@misc{2011.06194,
Author = {Mandy Xie, Alejandro Escontrela, and Frank Dellaert},
Title = {A Factor-Graph Approach for Optimization Problems with Dynamics Constraints},
Year = {2020},
Eprint = {arXiv:2011.06194},
}