manif is a Lie theory library for state-estimation targeted at robotics applications. It is developed as a header-only C++11 library with Python 3 wrappers.
At the moment, it provides the groups:
- ℝ(n): Euclidean space with addition.
- SO(2): rotations in the plane.
- SE(2): rigid motion (rotation and translation) in the plane.
- SO(3): rotations in 3D space.
- SE(3): rigid motion (rotation and translation) in 3D space.
- SE_2(3): extended pose (rotation, translation and velocity) in 3D space, introduced (to the best of knowledge) in this paper. NOTE: The implementation here differs slightly from the developments in the paper.
- SGal(3): The Special Galilean group (rotation, translation, velocity and time) in 3D space, described in these papers [1] & [2].
- Bundle<>: allows manipulating a manifold bundle as a single Lie group. Referred to as a composite manifold in Section IV of the reference paper.
Other Lie groups can and will be added, contributions are welcome.
manif is based on the mathematical presentation of the Lie theory available in this paper. We recommend every user of manif to read the paper (17 pages) before starting to use the library. The paper offers a comprehensive yet accessible introduction to Lie theory, tailored specifically for roboticists. By presenting the material in a simplified manner, it lowers the barrier to entry for those interested in developing rigorous and elegant algorithms for state estimation, control, learning, and possibly more. This approach ensures that even readers without an advanced mathematical background can grasp the foundational concepts and apply them effectively in robotics.
You may also find the following video online, 'Lie theory for the roboticist', a lecture given at IRI-UPC.
In a rush? Check out our Lie group cheat sheet.
manif provides analytic computation of Jacobians for all the operations listed below.
- Maintainer status: maintained
- Maintainer: Jeremie Deray
- Authors:
- Jeremie Deray deray.jeremie@gmail.com
- Joan Sola jsola@iri.upc.edu
- License: MIT
- Bug / feature tracker: github.com/artivis/manif/issues
- Source: github.com/artivis/manif.git (branch: devel)
Get quickly started with manif following our 'quick start' guides for both C++ and Python.
Operation | Code | |
---|---|---|
Base Operation | ||
Inverse | X.inverse() |
|
Composition |
X * Y X.compose(Y)
|
|
Hat | w.hat() |
|
Act on vector | X.act(v) |
|
Retract to group element | w.exp() |
|
Lift to tangent space | X.log() |
|
Manifold Adjoint | X.adj() |
|
Tangent adjoint | w.smallAdj() |
|
Composed Operation | ||
Manifold right plus |
X + w X.plus(w) X.rplus(w)
|
|
Manifold left plus |
w + X w.plus(X) w.lplus(X)
|
|
Manifold right minus |
X - Y X.minus(Y) X.rminus(Y)
|
|
Manifold left minus | X.lminus(Y) |
|
Between | X.between(Y) |
|
Inner Product | w.inner(t) |
|
Norm |
w.weightedNorm() w.squaredWeightedNorm()
|
Above, X
& Y
) represent group elements,
w
& t
) represent the same elements of the tangent space
but expressed in Cartesian coordinates in v
) represents any element of
manif favors Cartesian representations of the tangent spaces.
This means that the tangent elements are regular vectors in
The ordering of the elements in such vectors matters to correctly interpret them. It impacts the form of all Jacobian matrices and covariances matrices that will be defined on those tangent spaces.
As a reference, this is the way tangent spaces are defined in manif
group | dimension | group elements | tangent elements (in order) | relation to velocity |
---|---|---|---|---|
Rn | n | |||
SO(2) | 1 | |||
SO(3) | 3 | |||
SE(2) | 3 |
|
|
|
SE(3) | 6 |
|
|
|
SE_2(3) | 9 |
|
|
|
SGal(3) | 10 |
|
|
|
As an example, in SE_2(3) the tangent vector
where
A covariances matrix
All blocks
All operations come with their respective analytical Jacobian matrices. Throughout manif, Jacobians are differentiated with respect to a perturbation on the local tangent space. These Jacobians map tangent spaces, as described in this paper. Please consider the order of elements in the tangent spaces when manipulating Jacobians.
Currently, manif implements the right Jacobian, whose definition reads:
The Jacobians of any of the aforementioned operations can then be evaluated:
in C++,
SE3d X = SE3d::Random();
SE3Tangentd w = SE3Tangentd::Random();
SE3d::Jacobian J_o_x, J_o_w;
auto X_plus_w = X.plus(w, J_o_x, J_o_w);
in Python,
X = SE3.Random()
w = SE3Tangentd.Random()
J_o_x = np.zeros((SE3.DoF, SE3.DoF))
J_o_w = np.zeros((SE3.DoF, SE3.DoF))
X_plus_w = X.plus(w, J_o_x, J_o_w)
While Jacobians in manif are differentiated with respect to a
local perturbation on the tangent space, many non-linear solvers
(e.g. Ceres) expect functions to be differentiated with respect to
the underlying representation vector of the group element
(e.g. with respect to quaternion vector for SO3
).
For this reason, manif is compliant with the auto-differentiation libraries
ceres::Jet
, autodiff::Dual
& autodiff::Real
.
The documentation is available online at the accompanying website. Both the C++ and the Python APIs are documented.
Do you want to build it locally? Find out how on the dedicated page.
Note: throughout the code documentation we refer to 'the paper' which you can find on the dedicated page.
We provide some self-contained and self-explained C++ examples to help you get started.
You prefer Python? The same examples are also available in Python.
Check out our related publications and how to cite them.
Find out who's already using manif.
Want to contribute? Great! Check out our contribution guidelines.