gtsam 4.2
gtsam
Loading...
Searching...
No Matches
BearingS2.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <gtsam_unstable/dllexport.h>
13#include <gtsam/geometry/Rot2.h>
15
16namespace gtsam {
17
18class GTSAM_UNSTABLE_EXPORT BearingS2 {
19protected:
20 Rot2 azimuth_, elevation_;
21
22public:
23 static const size_t dimension = 2;
24
27
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
87private:
88
92
93 // Serialization function
94 friend class boost::serialization::access;
95 template<class Archive>
96 void serialize(Archive & ar, const unsigned int /*version*/) {
97 ar & BOOST_SERIALIZATION_NVP(azimuth_);
98 ar & BOOST_SERIALIZATION_NVP(elevation_);
99 }
100
101};
102
104template<> struct traits<BearingS2> : public Testable<BearingS2> {};
105
106} // \namespace gtsam
2D rotation
3D Pose
Global functions in a separate testing namespace.
Definition chartTesting.h:28
std::string serialize(const T &input)
serializes to a string
Definition serialization.h:113
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:156
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:36
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
Template to create a binary predicate.
Definition Testable.h:111
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:37
Rotation matrix NOTE: the angle theta is in radians unless explicitly stated.
Definition Rot2.h:36
Definition BearingS2.h:18
static size_t Dim()
Dimensionality of tangent space = 2 DOF - used to autodetect sizes.
Definition BearingS2.h:75
BearingS2()
Default constructor - straight ahead.
Definition BearingS2.h:29
BearingS2(double azimuth, double elevation)
Build from components.
Definition BearingS2.h:32
static BearingS2 fromDownwardsObservation(const POSE &A, const TARGET &B)
Observation function for downwards-facing camera.
Definition BearingS2.h:51
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition BearingS2.h:78