21#include <gtsam/nonlinear/ExpressionFactor.h>
26template <
typename A1,
typename A2>
35template <
typename A1,
typename A2,
36 typename T =
typename Bearing<A1, A2>::result_type>
51 Expression<T> expression(
const typename Base::ArrayNKeys &
keys)
const override {
52 Expression<A1> a1_(
keys[0]);
53 Expression<A2> a2_(
keys[1]);
54 return Expression<T>(Bearing<A1, A2>(), a1_, a2_);
58 void print(
const std::string& s =
"",
59 const KeyFormatter& kf = DefaultKeyFormatter)
const override {
60 std::cout << s <<
"BearingFactor" << std::endl;
64 Vector evaluateError(
const A1& a1,
const A2& a2,
65 boost::optional<Matrix&> H1 = boost::none,
66 boost::optional<Matrix&> H2 = boost::none)
const
68 std::vector<Matrix> Hs(2);
80 friend class boost::serialization::access;
81 template <
class ARCHIVE>
82 void serialize(ARCHIVE& ar,
const unsigned int ) {
83 ar& boost::serialization::make_nvp(
84 "Base", boost::serialization::base_object<Base>(*
this));
89template <
typename A1,
typename A2,
typename T>
91 :
public Testable<BearingFactor<A1, A2, T> > {};
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:736
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
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
GenericValue< T > genericValue(const T &v)
Functional constructor of GenericValue<T> so T can be automatically deduced.
Definition: GenericValue.h:212
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:151
This is the base class for all factor types.
Definition: Factor.h:56
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition: Factor.h:125
Vector unwhitenedError(const Values &x, boost::optional< std::vector< Matrix > & > H=boost::none) const override
Error function without the NoiseModel, .
Definition: ExpressionFactor.h:99
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print relies on Testable traits being defined for T
Definition: ExpressionFactor.h:80
const typename Bearing< A1, A2 >::result_type & measured() const
return the measurement
Definition: ExpressionFactor.h:77
void initialize(const Expression< typename Bearing< A1, A2 >::result_type > &expression)
Initialize with constructor arguments.
Definition: ExpressionFactor.h:167
N-ary variadic template for ExpressionFactor meant as a base class for N-ary factors.
Definition: ExpressionFactor.h:242
double error(const Values &c) const override
Calculate the error of the factor.
Definition: NonlinearFactor.cpp:127
Definition: BearingFactor.h:37
void print(const std::string &s="", const KeyFormatter &kf=DefaultKeyFormatter) const override
print
Definition: BearingFactor.h:58
BearingFactor(Key key1, Key key2, const T &measured, const SharedNoiseModel &model)
primary constructor
Definition: BearingFactor.h:44
BearingFactor()
default constructor
Definition: BearingFactor.h:41