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
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::BearingS2::elevation_
Rot2 elevation_
Definition: BearingS2.h:20
x
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
Definition: gnuplot_common_settings.hh:12
B
Definition: test_numpy_dtypes.cpp:299
gtsam::utils.numerical_derivative.retract
def retract(a, np.ndarray xi)
Definition: numerical_derivative.py:44
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
Rot2.h
2D rotation
simple::p2
static Point3 p2
Definition: testInitializePose3.cpp:51
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
A
Definition: test_numpy_dtypes.cpp:298
gtsam::Pose3
Definition: Pose3.h:37
gtsam::BearingS2::fromDownwardsObservation
static BearingS2 fromDownwardsObservation(const POSE &A, const TARGET &B)
Definition: BearingS2.h:51
gtsam::BearingS2::BearingS2
BearingS2()
Definition: BearingS2.h:29
gtsam::BearingS2::Dim
static size_t Dim()
Dimensionality of tangent space = 2 DOF - used to autodetect sizes.
Definition: BearingS2.h:75
gtsam::equals
Definition: Testable.h:112
gtsam::Rot2
Definition: Rot2.h:35
gtsam
traits
Definition: SFMdata.h:40
gtsam::Testable
Definition: Testable.h:152
gtsam::traits
Definition: Group.h:36
gtsam::BearingS2::BearingS2
BearingS2(double azimuth, double elevation)
Definition: BearingS2.h:32
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
gtsam::BearingS2::BearingS2
BearingS2(const Rot2 &azimuth, const Rot2 &elevation)
Definition: BearingS2.h:35
gtsam::BearingS2::dim
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: BearingS2.h:78
gtsam::BearingS2::elevation
const Rot2 & elevation() const
Definition: BearingS2.h:40
gtsam::BearingS2
Definition: BearingS2.h:18
Pose3.h
3D Pose
gtsam::BearingS2::azimuth
const Rot2 & azimuth() const
Definition: BearingS2.h:39


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:54