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 
25  // constructors
26 
28  BearingS2() {}
29 
31  BearingS2(double azimuth, double elevation)
32  : azimuth_(Rot2::fromAngle(azimuth)), elevation_(Rot2::fromAngle(elevation)) {}
33 
34  BearingS2(const Rot2& azimuth, const Rot2& elevation)
35  : azimuth_(azimuth), elevation_(elevation) {}
36 
37  // access
38  const Rot2& azimuth() const { return azimuth_; }
39  const Rot2& elevation() const { return elevation_; }
40 
44 
48  // FIXME: will not work for TARGET = Point3
49  template<class POSE, class TARGET>
50  static BearingS2 fromDownwardsObservation(const POSE& A, const TARGET& B) {
51  return fromDownwardsObservation(A.pose(), B.translation());
52  }
53 
54  static BearingS2 fromDownwardsObservation(const Pose3& A, const Point3& B);
55 
57  static BearingS2 fromForwardObservation(const Pose3& A, const Point3& B);
58 
62 
64  void print(const std::string& s = "") const;
65 
67  bool equals(const BearingS2& x, double tol = 1e-9) const;
68 
72 
74  inline static size_t Dim() { return dimension; }
75 
77  inline size_t dim() const { return dimension; }
78 
81  BearingS2 retract(const Vector& v) const;
82 
84  Vector localCoordinates(const BearingS2& p2) const;
85 
86 private:
87 
91 
92  // Serialization function
93  friend class boost::serialization::access;
94  template<class Archive>
95  void serialize(Archive & ar, const unsigned int /*version*/) {
96  ar & BOOST_SERIALIZATION_NVP(azimuth_);
97  ar & BOOST_SERIALIZATION_NVP(elevation_);
98  }
99 
100 };
101 
103 template<> struct traits<BearingS2> : public Testable<BearingS2> {};
104 
105 } // \namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
void serialize(Archive &ar, const unsigned int)
Definition: BearingS2.h:95
BearingS2(const Rot2 &azimuth, const Rot2 &elevation)
Definition: BearingS2.h:34
ArrayXcf v
Definition: Cwise_arg.cpp:1
const Rot2 & azimuth() const
Definition: BearingS2.h:38
static size_t Dim()
Dimensionality of tangent space = 2 DOF - used to autodetect sizes.
Definition: BearingS2.h:74
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: BearingS2.h:77
static BearingS2 fromDownwardsObservation(const POSE &A, const TARGET &B)
Definition: BearingS2.h:50
Eigen::VectorXd Vector
Definition: Vector.h:38
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
traits
Definition: chartTesting.h:28
const Rot2 & elevation() const
Definition: BearingS2.h:39
static Point3 p2
const G double tol
Definition: Group.h:83
Vector3 Point3
Definition: Point3.h:35
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:31
2D rotation


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:41