smooth
A C++ library for Lie theory
|
In robotics it is often convenient to work in non-Euclidean manifolds. Lie groups are a class of manifolds that are easy to work with due to their symmetries, and that are also good models for many robotic systems. This header-only C++20 library facilitates leveraging Lie theory in robotics software, by enabling:
examples/bspline.cpp
)examples/odeint.cpp
)The following common Lie groups are implemented:
Clone the repository and install it
Alternatively, if using ROS or ROS2 just clone smooth
into a catkin/colcon workspace source folder and build the workspace with a compiler that supports C++20. Example with colcon:
To utilize smooth
in your own project, include something along these lines in your CMakeLists.txt
Check out the Documentation and the examples
.
These C++20 concepts are implemented in concepts.hpp
.
Manifold
: type for which rplus
(geodesic addition) and rminus
(geodesic subtraction) are defined. Examples:LieGroup
typesstd::vector<Manifold>
is a Manifold defined in manifold_vector.hpp
—it facilitates e.g. optimization and differentiation w.r.t. a dynamic number of Manifold
sstd::variant<Manifold ...>
is a Manifold defined in manifold_variant.hpp
. Using std::vector<std::variant<Manifold...>>
can be convenient when optimizing over variables with different parameterizations.LieGroup
: type for which Lie group operations (exp
, log
, Ad
, etc...) are defined. Examples:NativeLieGroup
typesEigen::Vector3d
)Eigen::VectorXd
)double
)NativeLieGroup
: type that implements the Lie group operations as class methods. Examples:smooth::SO3<float>
smooth::C1<double>
smooth::Bundle<NativeLieGroup | Eigen::Matrix<Scalar, N, 1> ...>
Both Manifold
and LieGroup
are defined via external type traits (traits::man
and traits::lie
) that can be specialized in order to define Manifold
or LieGroup
interfaces for third-party types.
Available for Manifold
types, see diff.hpp.
Supported techniques (see smooth::diff::Type):
autodiff
(must #include <smooth/compat/autodiff.hpp>)Example: calculate for i=1, 2
Available for Manifold
types, see optim.hpp.
The minimize() function implements a Levenberg-Marquardt trust-region procedure to find a local minimum. All derivatives and computations are done in the tangent space as opposed to e.g. Ceres which uses derivatives w.r.t. the parameterization.
A sparse solver is implemented, but it is currently only available when analytical derivatives are provided.
Example: Calculate
Available for LieGroup
types, see spline/spline.hpp.
These splines are piecewise defined via Bernstein polynomials and pass through the control points. See examples/spline_fit.cpp for usage.
Available for LieGroup
types, see spline/bspline.hpp.
The B-spline basis functions have local support, A B-spline generally does not pass through its control points. See examples/spline_fit.cpp and examples/bspline.cpp for usage.
Utility headers for interfacing with adjacent software are included.
boost::odeint
smooth
for control and estimation on Lie groups.Two projects that have served as inspiration for smooth
are manif
—which also has an accompanying paper that is a great practical introduction to Lie theory—and Sophus
. Certain design decisions are different in smooth
: derivatives are with respect to tangent elements as in manif
, but the tangent types are Eigen vectors like in Sophus
. This library also includes the Bundle type which facilitates control and estimation tasks, as well as utilities such as differentiation, optimization, and splines. Finally smooth
is written in C++20 and leverages modern features such as concepts and ranges.