25#include <gtsam/base/concepts.h>
53template <
typename T>
struct traits;
58template <
class C,
class ChartJacobian>
60 std::declval<const C&>().localCoordinates(
61 std::declval<const C&>(), std::declval<ChartJacobian>(),
62 std::declval<ChartJacobian>()));
65template <
class C,
class TangentVector,
class ChartJacobian>
67 std::declval<const TangentVector&>(), std::declval<ChartJacobian>(),
68 std::declval<ChartJacobian>()));
74 inline constexpr static auto dim = Class::dimension;
77 Eigen::Matrix<double, dim, 1> v;
81 v = p.localCoordinates(q);
87template<
class Class,
int N>
91 static size_t GetDimension(
const Class& m) {
92 if constexpr (N == Eigen::Dynamic) {
95 return static_cast<size_t>(N);
110 inline constexpr static auto dimension = Class::dimension;
113 typedef Class ManifoldType;
115 typedef Eigen::Matrix<double, dimension, 1> TangentVector;
119 static TangentVector Local(
const Class& origin,
const Class& other) {
120 return origin.localCoordinates(other);
123 template <
class C = Class,
125 static TangentVector Local(
const Class& origin,
const Class& other,
126 ChartJacobian H1, ChartJacobian H2 = {}) {
127 return origin.localCoordinates(other, H1, H2);
131 static Class Retract(
const Class& origin,
const TangentVector& v) {
132 return origin.retract(v);
135 template <
class C = Class,
137 static Class Retract(
const Class& origin,
const TangentVector& v,
138 ChartJacobian H1, ChartJacobian H2 = {}) {
139 return origin.retract(v, H1, H2);
144template <
class T,
class =
void>
149 T,
std::void_t<decltype(traits<T>::Local(
150 std::declval<const T&>(), std::declval<const T&>(),
151 std::declval<typename traits<T>::ChartJacobian>(),
152 std::declval<typename traits<T>::ChartJacobian>()))>>
181 static constexpr bool value =
182 std::is_base_of_v<manifold_tag, structure_category_tag>;
187 "This type's structure_category trait does not assert it as a manifold (or derived)");
188 if constexpr (dim != Eigen::Dynamic) {
189 static_assert(TangentVector::SizeAtCompileTime == dim);
206 using value_type =
const int;
208 static_assert(value != Eigen::Dynamic,
209 "FixedDimension instantiated for dynamically-sized type.");
221#define GTSAM_CONCEPT_MANIFOLD_INST(T) template class gtsam::IsManifold<T>;
222#define GTSAM_CONCEPT_MANIFOLD_TYPE(T) using _gtsam_IsManifold_##T = gtsam::IsManifold<T>;
typedef and functions to augment Eigen's MatrixXd
Special class for optional Jacobian arguments.
Concept check for values that can be used in unit tests.
decltype(std::declval< const C & >().retract( std::declval< const TangentVector & >(), std::declval< ChartJacobian >(), std::declval< ChartJacobian >())) RetractWithJacobians
Probe for a class member retract implementation with Jacobians.
Definition Manifold.h:66
decltype( std::declval< const C & >().localCoordinates( std::declval< const C & >(), std::declval< ChartJacobian >(), std::declval< ChartJacobian >())) LocalCoordinatesWithJacobians
Probe for a class member localCoordinates implementation with Jacobians.
Definition Manifold.h:59
Global functions in a separate testing namespace.
Definition chartTesting.h:28
check_manifold_invariants(const T &a, const T &b, double tol=1e-9)
Check invariants for Manifold type.
Definition Manifold.h:163
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
tag to assert a type is a manifold
Definition Manifold.h:33
Requirements on type to pass it to Manifold template below.
Definition Manifold.h:72
Traits to get dimension, supporting both fixed and dynamic.
Definition Manifold.h:88
A helper that implements the traits interface for GTSAM manifolds.
Definition Manifold.h:104
Detect whether a traits type provides Local with Jacobians.
Definition Manifold.h:145
Both ManifoldTraits and Testable.
Definition Manifold.h:156
Manifold concept.
Definition Manifold.h:172
Give fixed size dimension of a type, fails at compile time if dynamic.
Definition Manifold.h:205
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A testable concept check that should be placed in applicable unit tests and in generic algorithms.
Definition Testable.h:59
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152