Gal3.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
3  * Atlanta, Georgia 30332-0415
4 
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 * See LICENSE for the license information
8 * -------------------------------------------------------------------------- */
9 
17 #pragma once
18 
19 #include <gtsam/geometry/Pose3.h> // Includes Rot3, Point3
20 #include <gtsam/geometry/Event.h>
21 #include <gtsam/base/Lie.h> // For LieGroup base class and traits
22 #include <gtsam/base/Manifold.h> // For Manifold traits
23 
24 #include <cmath> // For std::sqrt, std::cos, std::sin
25 #include <functional> // For std::function used in numerical derivatives
26 
27 namespace gtsam {
28 
29 // Forward declaration
30 class Gal3;
31 
32 // Use Vector3 for velocity for consistency with NavState
34 // Define Vector10 for tangent space
36 // Define Matrix5 for Lie Algebra matrix representation
38 // Define Matrix10 for Jacobians
40 
45 class GTSAM_EXPORT Gal3 : public LieGroup<Gal3, 10> {
46  private:
47  Rot3 R_;
50  double t_;
51 
52  public:
53 
55  inline static constexpr size_t dimension = 10;
56 
59 
61  Gal3() : R_(Rot3::Identity()), r_(Point3::Zero()), v_(Velocity3::Zero()), t_(0.0) {}
62 
64  Gal3(const Rot3& R, const Point3& r, const Velocity3& v, double t) :
65  R_(R), r_(r), v_(v), t_(t) {}
66 
68  explicit Gal3(const Matrix5& M);
69 
71  static Gal3 Create(const Rot3& R, const Point3& r, const Velocity3& v, double t,
73  OptionalJacobian<10, 3> H2 = {},
74  OptionalJacobian<10, 3> H3 = {},
75  OptionalJacobian<10, 1> H4 = {});
76 
78  static Gal3 FromPoseVelocityTime(const Pose3& pose, const Velocity3& v, double t,
79  OptionalJacobian<10, 6> H1 = {},
80  OptionalJacobian<10, 3> H2 = {},
81  OptionalJacobian<10, 1> H3 = {});
82 
86 
88  const Rot3& rotation(OptionalJacobian<3, 10> H = {}) const;
89 
91  const Point3& translation(OptionalJacobian<3, 10> H = {}) const;
92 
94  const Velocity3& velocity(OptionalJacobian<3, 10> H = {}) const;
95 
97  const double& time(OptionalJacobian<1, 10> H = {}) const;
98 
99  // Convenience accessors matching NavState names
100  const Rot3& attitude(OptionalJacobian<3, 10> H = {}) const { return rotation(H); }
101  const Point3& position(OptionalJacobian<3, 10> H = {}) const { return translation(H); }
102 
106 
108  Matrix3 R() const { return R_.matrix(); }
109 
111  Vector3 r() const { return Vector3(r_); } // Conversion from Point3
112 
114  const Vector3& v() const { return v_; }
115 
117  const double& t() const { return t_; }
118 
120  Matrix5 matrix() const;
121 
125 
127  GTSAM_EXPORT
128  friend std::ostream &operator<<(std::ostream &os, const Gal3& state);
129 
131  void print(const std::string& s = "") const;
132 
134  bool equals(const Gal3& other, double tol = 1e-9) const;
135 
139 
141  static Gal3 Identity() { return Gal3(); }
142 
144  Gal3 inverse() const;
145 
146  // Bring LieGroup::inverse() into scope (version with derivative)
148 
150  Gal3 operator*(const Gal3& other) const;
151 
155 
163  Event act(const Event& e, OptionalJacobian<4, 10> Hself = {},
164  OptionalJacobian<4, 4> He = {}) const;
165 
169 
171  static Gal3 Expmap(const Vector10& xi, OptionalJacobian<10, 10> Hxi = {});
172 
174  static Vector10 Logmap(const Gal3& g, OptionalJacobian<10, 10> Hg = {});
175 
177  Matrix10 AdjointMap() const;
178 
180  Vector10 Adjoint(const Vector10& xi_base, OptionalJacobian<10, 10> H_g = {},
181  OptionalJacobian<10, 10> H_xi = {}) const;
182 
184  static Vector10 adjoint(const Vector10& xi, const Vector10& y,
185  OptionalJacobian<10, 10> Hxi = {},
186  OptionalJacobian<10, 10> Hy = {});
187 
189  static Matrix10 adjointMap(const Vector10& xi);
190 
192  static Matrix10 ExpmapDerivative(const Vector10& xi);
193 
195  static Matrix10 LogmapDerivative(const Gal3& g);
196 
198  struct ChartAtOrigin {
199  static Gal3 Retract(const Vector10& xi, ChartJacobian Hxi = {});
200  static Vector10 Local(const Gal3& g, ChartJacobian Hg = {});
201  };
202 
204  static Matrix5 Hat(const Vector10& xi);
205 
207  static Vector10 Vee(const Matrix5& X);
208 
210 
211  private:
214 #if GTSAM_ENABLE_BOOST_SERIALIZATION
215  friend class boost::serialization::access;
216  template <class ARCHIVE>
217  void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
218  ar & BOOST_SERIALIZATION_NVP(R_);
219  ar & BOOST_SERIALIZATION_NVP(r_);
220  ar & BOOST_SERIALIZATION_NVP(v_);
221  ar & BOOST_SERIALIZATION_NVP(t_);
222  }
223 #endif
224 
226 }; // class Gal3
227 
229 template <>
230 struct traits<Gal3> : public internal::LieGroup<Gal3> {};
231 
232 template <>
233 struct traits<const Gal3> : public internal::LieGroup<Gal3> {};
234 
235 } // namespace gtsam
H
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Definition: gnuplot_common_settings.hh:74
gtsam::translation
Point3_ translation(const Pose3_ &pose)
Definition: slam/expressions.h:97
pose
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
inverse
const EIGEN_DEVICE_FUNC InverseReturnType inverse() const
Definition: ArrayCwiseUnaryOps.h:411
gtsam::Gal3::R
Matrix3 R() const
Return rotation matrix (Matrix3)
Definition: Gal3.h:108
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::operator<<
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
screwPose2::xi
Vector xi
Definition: testPose2.cpp:169
gtsam::Velocity3
Vector3 Velocity3
Velocity is currently typedef'd to Vector3.
Definition: Gal3.h:33
gtsam::Gal3::ChartAtOrigin
Chart at origin, uses Expmap/Logmap for Retract/Local.
Definition: Gal3.h:198
gtsam::Gal3::r
Vector3 r() const
Return position as Vector3.
Definition: Gal3.h:111
X
#define X
Definition: icosphere.cpp:20
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:44
os
ofstream os("timeSchurFactors.csv")
gtsam::Vector10
Eigen::Matrix< double, 10, 1 > Vector10
Definition: Gal3.h:35
gtsam::operator*
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:52
gtsam::Matrix10
Eigen::Matrix< double, 10, 10 > Matrix10
Definition: Gal3.h:39
Expmap
Pose2_ Expmap(const Vector3_ &xi)
Definition: InverseKinematicsExampleExpressions.cpp:47
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:145
gtsam::Gal3::position
const Point3 & position(OptionalJacobian< 3, 10 > H={}) const
Definition: Gal3.h:101
gtsam::Gal3::t_
double t_
Time component.
Definition: Gal3.h:50
gtsam::internal::LieGroup
Both LieGroupTraits and Testable.
Definition: Lie.h:239
gtsam::Rot3
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
gtsam::Gal3::v
const Vector3 & v() const
Return velocity as Vector3.
Definition: Gal3.h:114
gtsam::Gal3::v_
Velocity3 v_
Velocity in world frame, n_v_b.
Definition: Gal3.h:49
Manifold.h
Base class and basic functions for Manifold types.
Event.h
Space-time event.
gtsam::Gal3
Definition: Gal3.h:45
gtsam::Event
Definition: Event.h:37
time
#define time
Definition: timeAdaptAutoDiff.cpp:31
gtsam::Gal3::Identity
static Gal3 Identity()
Return the identity element.
Definition: Gal3.h:141
g
void g(const string &key, int i)
Definition: testBTree.cpp:41
gtsam::Gal3::Gal3
Gal3()
Default constructor: Identity element.
Definition: Gal3.h:61
gtsam::equals
Definition: Testable.h:112
y
Scalar * y
Definition: level1_cplx_impl.h:124
matrix
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: gtsam/3rdparty/Eigen/blas/common.h:110
Lie.h
Base class and basic functions for Lie types.
gtsam
traits
Definition: ABC.h:17
gtsam::rotation
Rot3_ rotation(const Pose3_ &pose)
Definition: slam/expressions.h:93
gtsam::traits
Definition: Group.h:36
gtsam::OptionalJacobian
Definition: OptionalJacobian.h:38
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
gtsam::Rot3::matrix
Matrix3 matrix() const
Definition: Rot3M.cpp:222
gtsam::LieGroup
Definition: Lie.h:37
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
gtsam::Gal3::r_
Point3 r_
Position in world frame, n_r_b.
Definition: Gal3.h:48
gtsam::Gal3::Gal3
Gal3(const Rot3 &R, const Point3 &r, const Velocity3 &v, double t)
Construct from attitude, position, velocity, time.
Definition: Gal3.h:64
M
abc_eqf_lib::State< N > M
Definition: ABC_EQF_Demo.cpp:17
align_3::t
Point2 t(10, 10)
Pose3
Definition: testDependencies.h:3
adjoint
void adjoint(const MatrixType &m)
Definition: adjoint.cpp:67
gtsam::Gal3::attitude
const Rot3 & attitude(OptionalJacobian< 3, 10 > H={}) const
Definition: Gal3.h:100
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42
gtsam::Gal3::R_
Rot3 R_
Rotation world R body.
Definition: Gal3.h:47
R
Rot2 R(Rot2::fromAngle(0.1))
Pose3.h
3D Pose manifold SO(3) x R^3 and group SE(3)
gtsam::Gal3::t
const double & t() const
Return time scalar.
Definition: Gal3.h:117
make_changelog.state
state
Definition: make_changelog.py:29
gtsam::velocity
Velocity3_ velocity(const NavState_ &X)
Definition: navigation/expressions.h:40


gtsam
Author(s):
autogenerated on Wed May 28 2025 03:01:18