25#if GTSAM_ENABLE_BOOST_SERIALIZATION
26#include <boost/serialization/nvp.hpp>
35template <
typename A1,
typename A2>
41template <
typename A1,
typename A2>
50template <
typename A1,
typename A2,
61 constexpr static const size_t dimension = dimB + dimR;
62 using OptionalJacobian1 =
64 using OptionalJacobian2 =
71 BearingRange(
const B& b,
const R& r) : bearing_(b), range_(r) {}
78 const B&
bearing()
const {
return bearing_; }
81 const R&
range()
const {
return range_; }
84 static BearingRange
Measure(
const A1& a1,
const A2& a2,
85 OptionalJacobian1 H1 = {},
86 OptionalJacobian2 H2 = {}) {
87 typename MakeJacobian<B, A1>::type HB1;
88 typename MakeJacobian<B, A2>::type HB2;
89 typename MakeJacobian<R, A1>::type HR1;
90 typename MakeJacobian<R, A2>::type HR2;
92 B b = Bearing<A1, A2>()(a1, a2, H1 ? &HB1 : 0, H2 ? &HB2 : 0);
93 R r = Range<A1, A2>()(a1, a2, H1 ? &HR1 : 0, H2 ? &HR2 : 0);
95 if (H1) *H1 << HB1, HR1;
96 if (H2) *H2 << HB2, HR2;
97 return BearingRange(b, r);
114 void print(
const std::string& str =
"")
const {
119 bool equals(
const BearingRange<A1, A2>& m2,
double tol = 1e-8)
const {
120 return traits<B>::Equals(bearing_, m2.bearing_, tol) &&
121 traits<R>::Equals(range_, m2.range_, tol);
128 inline static size_t Dim() {
return dimension; }
129 inline size_t dim()
const {
return dimension; }
131 typedef Eigen::Matrix<double, dimension, 1> TangentVector;
132 typedef OptionalJacobian<dimension, dimension> ChartJacobian;
135 BearingRange
retract(
const TangentVector& xi)
const {
138 return BearingRange(m1, m2);
147 v.template head<dimB>() = v1;
148 v.template tail<dimR>() = v2;
157#if GTSAM_ENABLE_BOOST_SERIALIZATION
159 template <
class ARCHIVE>
160 void serialize(ARCHIVE& ar,
const unsigned int ) {
161 ar& boost::serialization::make_nvp(
"bearing", bearing_);
162 ar& boost::serialization::make_nvp(
"range", range_);
165 friend class boost::serialization::access;
172template <
typename A1,
typename A2>
181template <
class A1,
typename A2,
class RT>
183 typedef RT result_type;
185 const A1& a1,
const A2& a2,
188 return a1.bearing(a2, H1, H2);
195template <
class A1,
typename A2,
class RT>
197 typedef RT result_type;
199 const A1& a1,
const A2& a2,
202 return a1.range(a2, H1, H2);
Typedefs for easier changing of types.
Special class for optional Jacobian arguments.
Concept check for values that can be used in unit tests.
Base class and basic functions for Manifold types.
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 manifolds.
Definition Manifold.h:104
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
Definition BearingRange.h:36
Definition BearingRange.h:42
Bearing-Range product for a particular A1,A2 combination will use the functors above to create a simi...
Definition BearingRange.h:53
static R MeasureRange(const A1 &a1, const A2 &a2)
Predict range.
Definition BearingRange.h:106
BearingRange retract(const TangentVector &xi) const
Retract delta to manifold.
Definition BearingRange.h:135
const B & bearing() const
Return bearing measurement.
Definition BearingRange.h:78
static BearingRange Measure(const A1 &a1, const A2 &a2, OptionalJacobian1 H1={}, OptionalJacobian2 H2={})
Prediction function that stacks measurements.
Definition BearingRange.h:84
TangentVector localCoordinates(const BearingRange &other) const
Compute the coordinates in the tangent space.
Definition BearingRange.h:142
const R & range() const
Return range measurement.
Definition BearingRange.h:81
static B MeasureBearing(const A1 &a1, const A2 &a2)
Predict bearing.
Definition BearingRange.h:101
Definition BearingRange.h:182
Definition BearingRange.h:196