BearingS2.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <gtsam_unstable/dllexport.h>
13 #include <gtsam/geometry/Rot2.h>
14 #include <gtsam/geometry/Pose3.h>
15 
16 namespace gtsam {
17 
18 class GTSAM_UNSTABLE_EXPORT BearingS2 {
19 protected:
20  Rot2 azimuth_, elevation_;
21 
22 public:
23  static const size_t dimension = 2;
24 
27 
29  BearingS2() {}
30 
32  BearingS2(double azimuth, double elevation)
33  : azimuth_(Rot2::fromAngle(azimuth)), elevation_(Rot2::fromAngle(elevation)) {}
34 
35  BearingS2(const Rot2& azimuth, const Rot2& elevation)
36  : azimuth_(azimuth), elevation_(elevation) {}
37 
38  // access
39  const Rot2& azimuth() const { return azimuth_; }
40  const Rot2& elevation() const { return elevation_; }
41 
45 
49  // FIXME: will not work for TARGET = Point3
50  template<class POSE, class TARGET>
51  static BearingS2 fromDownwardsObservation(const POSE& A, const TARGET& B) {
52  return fromDownwardsObservation(A.pose(), B.translation());
53  }
54 
55  static BearingS2 fromDownwardsObservation(const Pose3& A, const Point3& B);
56 
58  static BearingS2 fromForwardObservation(const Pose3& A, const Point3& B);
59 
63 
65  void print(const std::string& s = "") const;
66 
68  bool equals(const BearingS2& x, double tol = 1e-9) const;
69 
73 
75  inline static size_t Dim() { return dimension; }
76 
78  inline size_t dim() const { return dimension; }
79 
82  BearingS2 retract(const Vector& v) const;
83 
85  Vector localCoordinates(const BearingS2& p2) const;
86 
87 private:
88 
92 
93 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION //
94  // Serialization function
95  friend class boost::serialization::access;
96  template<class Archive>
97  void serialize(Archive & ar, const unsigned int /*version*/) {
98  ar & BOOST_SERIALIZATION_NVP(azimuth_);
99  ar & BOOST_SERIALIZATION_NVP(elevation_);
100  }
101 #endif
102 
103 };
104 
106 template<> struct traits<BearingS2> : public Testable<BearingS2> {};
107 
108 } // \namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
std::string serialize(const T &input)
serializes to a string
BearingS2(const Rot2 &azimuth, const Rot2 &elevation)
Definition: BearingS2.h:35
static size_t Dim()
Dimensionality of tangent space = 2 DOF - used to autodetect sizes.
Definition: BearingS2.h:75
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: BearingS2.h:78
static BearingS2 fromDownwardsObservation(const POSE &A, const TARGET &B)
Definition: BearingS2.h:51
Eigen::VectorXd Vector
Definition: Vector.h:38
const Rot2 & elevation() const
Definition: BearingS2.h:40
const Rot2 & azimuth() const
Definition: BearingS2.h:39
Array< int, Dynamic, 1 > v
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
traits
Definition: chartTesting.h:28
static Point3 p2
const G double tol
Definition: Group.h:86
Vector3 Point3
Definition: Point3.h:38
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 x
3D Pose
BearingS2(double azimuth, double elevation)
Definition: BearingS2.h:32
2D rotation


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:57