gtsam
Loading...
Searching...
No Matches
BearingS2.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <gtsam/config.h>
13
14#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
15
16#include <gtsam_unstable/dllexport.h>
17#include <gtsam/geometry/Rot2.h>
19
20namespace gtsam {
21
26class GTSAM_UNSTABLE_EXPORT BearingS2 {
27protected:
28 Rot2 azimuth_, elevation_;
29
30public:
31 static const size_t dimension = 2;
32
35
37 BearingS2() {}
38
40 BearingS2(double azimuth, double elevation)
41 : azimuth_(Rot2::fromAngle(azimuth)), elevation_(Rot2::fromAngle(elevation)) {}
42
43 BearingS2(const Rot2& azimuth, const Rot2& elevation)
44 : azimuth_(azimuth), elevation_(elevation) {}
45
46 // access
47 const Rot2& azimuth() const { return azimuth_; }
48 const Rot2& elevation() const { return elevation_; }
49
53
57 // FIXME: will not work for TARGET = Point3
58 template<class POSE, class TARGET>
59 static BearingS2 fromDownwardsObservation(const POSE& A, const TARGET& B) {
60 return fromDownwardsObservation(A.pose(), B.translation());
61 }
62
63 static BearingS2 fromDownwardsObservation(const Pose3& A, const Point3& B);
64
66 static BearingS2 fromForwardObservation(const Pose3& A, const Point3& B);
67
71
73 void print(const std::string& s = "") const;
74
76 bool equals(const BearingS2& x, double tol = 1e-9) const;
77
81
83 inline static size_t Dim() { return dimension; }
84
86 inline size_t dim() const { return dimension; }
87
90 BearingS2 retract(const Vector& v) const;
91
93 Vector localCoordinates(const BearingS2& p2) const;
94
95private:
96
100
101#if GTSAM_ENABLE_BOOST_SERIALIZATION //
102 // Serialization function
103 friend class boost::serialization::access;
104 template<class Archive>
105 void serialize(Archive & ar, const unsigned int /*version*/) {
106 ar & BOOST_SERIALIZATION_NVP(azimuth_);
107 ar & BOOST_SERIALIZATION_NVP(elevation_);
108 }
109#endif
110
111};
112
114template<> struct traits<BearingS2> : public Testable<BearingS2> {};
115
116} // \namespace gtsam
117
118#endif // GTSAM_ALLOW_DEPRECATED_SINCE_V43
2D rotation
3D Pose manifold SO(3) x R^3 and group SE(3)
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152