32template <
typename A1,
typename A2,
37 typename traits<BearingRange<A1, A2, B, R>>::TangentVector, A1, A2> {
45 typedef std::shared_ptr<This> shared_ptr;
58 : Base(model, key1, key2), measured_(bearingRange) {}
64 : Base(model, key1, key2), measured_(measuredBearing, measuredRange) {}
70 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
71 return std::static_pointer_cast<gtsam::NonlinearFactor>(
72 gtsam::NonlinearFactor::shared_ptr(
new This(*
this)));
76 const T&
measured()
const {
return measured_; }
80 const This* p =
dynamic_cast<const This*
>(&f);
94 typename MakeJacobian<B, A1>::type HB1;
95 typename MakeJacobian<B, A2>::type HB2;
96 typename MakeJacobian<R, A1>::type HR1;
97 typename MakeJacobian<R, A2>::type HR2;
99 const B predictedBearing =
101 const R predictedRange =
102 Range<A1, A2>()(a1, a2, H1 ? &HR1 :
nullptr, H2 ? &HR2 :
nullptr);
109 H1->resize(dimB + dimR, dim1);
110 H1->topRows(dimB) = HB1;
111 H1->bottomRows(dimR) = HR1;
114 H2->resize(dimB + dimR, dim2);
115 H2->topRows(dimB) = HB2;
116 H2->bottomRows(dimR) = HR2;
122 void print(
const std::string& s =
"",
124 std::cout << s <<
"BearingRangeFactor" << std::endl;
130#if GTSAM_ENABLE_BOOST_SERIALIZATION
131 friend class boost::serialization::access;
133 template <
class ARCHIVE>
134 void serialize(ARCHIVE& ar,
const unsigned int ) {
135 ar& boost::serialization::make_nvp(
136 "NoiseModelFactor2", boost::serialization::base_object<Base>(*
this));
137 ar& BOOST_SERIALIZATION_NVP(measured_);
143template <
typename A1,
typename A2,
typename B,
typename R>
145 :
public Testable<BearingRangeFactor<A1, A2, B, R> > {};
Arbitrary-arity Jacobian factor with compile-time block dimensions.
Base class for noise model factors with N variables.
#define OptionalNone
These typedefs and aliases will help with making the evaluateError interface independent of boost TOD...
Definition NonlinearFactor.h:51
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
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
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
virtual void print(const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
print
Definition Factor.cpp:29
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
NoiseModelFactorT()
Default Constructor for I/O.
Definition NoiseModelFactorN.h:257
Nonlinear factor base class.
Definition NonlinearFactor.h:70
double error(const Values &c) const override
Calculate the error of the factor.
Definition NonlinearFactor.cpp:146
Binary factor for a bearing/range measurement.
Definition BearingRangeFactor.h:37
BearingRangeFactor(Key key1, Key key2, const B &measuredBearing, const R &measuredRange, const SharedNoiseModel &model)
Construct from keys, separate bearing/range measurements, and a noise model.
Definition BearingRangeFactor.h:62
bool equals(const NonlinearFactor &f, double tol=1e-9) const override
Check equality up to a tolerance.
Definition BearingRangeFactor.h:79
BearingRangeFactor(Key key1, Key key2, const T &bearingRange, const SharedNoiseModel &model)
Construct from keys, a combined bearing-range measurement, and a noise model.
Definition BearingRangeFactor.h:56
~BearingRangeFactor() override
Destroy this factor.
Definition BearingRangeFactor.h:67
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition BearingRangeFactor.h:70
void print(const std::string &s="", const KeyFormatter &kf=DefaultKeyFormatter) const override
print
Definition BearingRangeFactor.h:122
ErrorVector evaluateError(const A1 &a1, const A2 &a2, OptionalMatrixType H1=OptionalNone, OptionalMatrixType H2=OptionalNone) const override
Evaluate the unwhitened bearing-range error and optional Jacobians.
Definition BearingRangeFactor.h:86
const T & measured() const
Definition BearingRangeFactor.h:76
BearingRangeFactor()=default
Default constructor.