gtsam
Loading...
Searching...
No Matches
LeftLinearEKF.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
23
24#pragma once
25
26#include <gtsam/base/Lie.h> // For traits (needed for AdjointMap, Expmap)
27#include <gtsam/navigation/LieGroupEKF.h> // Include the base class
28
29#include <type_traits> // For std::conjunction, std::is_invocable_r, std::is_same
30
31namespace gtsam {
32
42template <typename G>
43class LeftLinearEKF : public LieGroupEKF<G> {
44 public:
45 using Base = LieGroupEKF<G>;
46 static constexpr int Dim = Base::Dim;
47 using TangentVector = typename Base::TangentVector;
48 using Jacobian = typename Base::Jacobian;
49 using Covariance = typename Base::Covariance;
50
51 LeftLinearEKF(const G& X0, const Covariance& P0) : Base(X0, P0) {}
52
59 template <typename Phi>
61 : std::conjunction<
62 std::is_invocable_r<G, Phi, const G&>,
63 std::is_same<decltype(std::declval<Phi>().dIdentity()), Jacobian>> {
64 };
65
70 template <class Phi, typename = std::enable_if_t<is_automorphism<Phi>::value>>
71 static G Dynamics(const G& W, const Phi& phi, const G& X, const G& U,
73 return traits<G>::Compose(W, Dynamics<Phi>(phi, X, U, A));
74 }
75
80 template <class Phi, typename = std::enable_if_t<is_automorphism<Phi>::value>>
81 static G Dynamics(const Phi& phi, const G& X, const G& U,
83 if (A) {
84 const G U_inv = traits<G>::Inverse(U);
85 *A = traits<G>::AdjointMap(U_inv) * phi.dIdentity();
86 }
87 return traits<G>::Compose(phi(X), U);
88 }
89
95 template <class Phi, typename = std::enable_if_t<is_automorphism<Phi>::value>>
96 void predict(const G& W, const Phi& phi, const G& U, const Covariance& Q) {
97 Jacobian A;
98 this->X_ = this->Dynamics(W, phi, this->X_, U, A);
99 this->P_ = A * this->P_ * A.transpose() + Q;
100 }
101
107 template <class Phi, typename = std::enable_if_t<is_automorphism<Phi>::value>>
108 void predict(const Phi& phi, const G& U, const Covariance& Q) {
109 Jacobian A;
110 this->X_ = this->Dynamics(phi, this->X_, U, A);
111 this->P_ = A * this->P_ * A.transpose() + Q;
112 }
113};
114
115} // namespace gtsam
Base class and basic functions for Lie types.
Extended Kalman Filter derived class for Lie groups G.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
void predict(const G &W, const Phi &phi, const G &U, const Covariance &Q)
General left–linear prediction, updates filter state as follows: X⁺ = W · φ(X) · U P⁺ = A P Aᵀ + Q wi...
Definition LeftLinearEKF.h:96
void predict(const Phi &phi, const G &U, const Covariance &Q)
Special case of predict with W=I, updates filter state as follows: Update: X⁺ = φ(X) · U Covariance: ...
Definition LeftLinearEKF.h:108
static G Dynamics(const G &W, const Phi &phi, const G &X, const G &U, OptionalJacobian< Dim, Dim > A={})
General left–linear dynamics.
Definition LeftLinearEKF.h:71
static constexpr int Dim
Definition LeftLinearEKF.h:46
static G Dynamics(const Phi &phi, const G &X, const G &U, OptionalJacobian< Dim, Dim > A={})
Left–linear dynamics with W=I.
Definition LeftLinearEKF.h:81
SFINAE template to check if a type satisfies the automorphism concept.
Definition LeftLinearEKF.h:63
typename Base::TangentVector TangentVector
Tangent vector type.
Definition LieGroupEKF.h:68
typename Base::Jacobian Jacobian
Dim x Dim.
Definition LieGroupEKF.h:66
static constexpr int Dim
Compile-time dimension of G.
Definition LieGroupEKF.h:64
typename Base::Covariance Covariance
Dim x Dim.
Definition LieGroupEKF.h:67
LieGroupEKF(const G &X0, const Covariance &P0)
Constructor: initialize with state and covariance.
Definition LieGroupEKF.h:105
G X_
Definition ManifoldEKF.h:284
Covariance P_
Definition ManifoldEKF.h:285