19#include <unsupported/Eigen/MatrixFunctions>
28 this->second + Ad * other.second};
40 ChartJacobian H2)
const {
44 if (H1) *H1 = delta.inverse().AdjointMap();
50typename TangentLieGroup<G>::TangentVector TangentLieGroup<G>::localCoordinates(
51 const TangentLieGroup& other, ChartJacobian H1, ChartJacobian H2)
const {
54 const TangentVector xi =
55 Logmap(relative, H1 || H2 ? ChartJacobian(&Dlog) : ChartJacobian());
56 if (H1) *H1 = -Dlog * relative.inverse().AdjointMap();
64 const auto [u, v] =
split(xi);
67 Expmap(u, v, H ? SplitJacobian(D1) : SplitJacobian(),
68 H ? SplitJacobian(D2) : SplitJacobian());
78 const Eigen::Ref<const BaseTangent>& u,
79 const Eigen::Ref<const BaseTangent>& v, SplitJacobian H1,
81 if constexpr (internal::TangentLieGroupJacobian<G>::expmapAvailable) {
84 u, v, H1 || H2 ? &derivative :
nullptr);
85 if (H1) *H1 = derivative.leftCols(n);
86 if (H2) *H2 = derivative.rightCols(n);
87 return {g, transported};
94 const Jacobian derivative = rightJacobian(join(u, v));
95 *H1 = derivative.leftCols(n);
96 if (H2) *H2 = derivative.rightCols(n);
98 *H2 = Matrix::Zero(dimension, n);
99 H2->bottomRows(n) = Dg;
101 return {g, transported};
105typename TangentLieGroup<G>::TangentVector TangentLieGroup<G>::Logmap(
109 const BaseJacobian AdInverse =
111 const BaseTangent v = Dg * AdInverse * p.second;
112 const TangentVector xi = join(u, v);
114 const Jacobian derivative = rightJacobian(xi);
115 const BaseJacobian Q = derivative.template bottomLeftCorner<n, n>();
117 H->template topLeftCorner<n, n>() = Dg;
118 H->template bottomRightCorner<n, n>() = Dg;
119 H->template bottomLeftCorner<n, n>() = -Dg * Q * Dg;
125typename TangentLieGroup<G>::Jacobian TangentLieGroup<G>::rightJacobian(
126 const TangentVector& xi) {
127 const auto [u, v] =
split(xi);
128 if constexpr (internal::TangentLieGroupJacobian<G>::available) {
132 const BaseJacobian A = -G::adjointMap(u);
133 const BaseJacobian B = -G::adjointMap(v);
134 using Augmented = Eigen::Matrix<double, 3 * n, 3 * n>;
135 Augmented M = Augmented::Zero();
136 M.template block<n, n>(0, n).setIdentity();
137 M.template block<n, n>(n, n) = A;
138 M.template block<n, n>(n, 2 * n) = B;
139 M.template block<n, n>(2 * n, 2 * n) = A;
140 const Augmented expM = M.exp();
141 const BaseJacobian J = expM.template block<n, n>(0, n);
142 const BaseJacobian Q = expM.template block<n, n>(0, 2 * n);
143 Jacobian result = Jacobian::Zero();
144 result.template topLeftCorner<n, n>() = J;
145 result.template bottomRightCorner<n, n>() = J;
146 result.template bottomLeftCorner<n, n>() = Q;
151typename TangentLieGroup<G>::Jacobian TangentLieGroup<G>::AdjointMap()
const {
153 const BaseJacobian adV = G::adjointMap(this->second);
154 Jacobian result = Jacobian::Zero();
155 result.template topLeftCorner<n, n>() = Ad;
156 result.template bottomRightCorner<n, n>() = Ad;
157 result.template bottomLeftCorner<n, n>() = adV * Ad;
162typename TangentLieGroup<G>::Jacobian TangentLieGroup<G>::adjointMap(
163 const TangentVector& xi) {
164 const auto [u, v] =
split(xi);
165 const BaseJacobian adU = G::adjointMap(u);
166 Jacobian result = Jacobian::Zero();
167 result.template topLeftCorner<n, n>() = adU;
168 result.template bottomRightCorner<n, n>() = adU;
169 result.template bottomLeftCorner<n, n>() = G::adjointMap(v);
174std::pair<typename TangentLieGroup<G>::BaseTangent,
175 typename TangentLieGroup<G>::BaseTangent>
176TangentLieGroup<G>::split(
const TangentVector& xi) {
177 return {xi.template head<n>(), xi.template tail<n>()};
181typename TangentLieGroup<G>::TangentVector TangentLieGroup<G>::join(
182 const BaseTangent& u,
const BaseTangent& v) {
189void TangentLieGroup<G>::print(
const std::string& s)
const {
190 std::cout << s <<
"TangentLieGroup" << std::endl;
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void split(const G &g, const PredecessorMap< KEY > &tree, G &Ab1, G &Ab2)
Split the graph into two parts: one corresponds to the given spanning tree, and the other corresponds...
Definition graph-inl.h:245
@ Logmap
Use the SE_2(3) NavState Logmap for every backend.
Definition PreintegrationParams.h:32
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Optional closed-form kernels used by TangentLieGroup::Expmap() and its private rightJacobian() helper...
Definition TangentLieGroup.h:51
Tangent Lie group TG = G ⋉ 𝔤, with dimension 2 dim(G).
Definition TangentLieGroup.h:97