20 #include <boost/make_shared.hpp> 21 #include <boost/lexical_cast.hpp> 30 template<
class CAMERA>
82 throw std::invalid_argument(
83 "TriangulationFactor must be created with " 85 +
"-dimensional noise model.");
93 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
94 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
95 gtsam::NonlinearFactor::shared_ptr(
new This(*
this)));
104 DefaultKeyFormatter)
const {
105 std::cout << s <<
"TriangulationFactor,";
113 const This *e = dynamic_cast<const This*>(&p);
114 return e &&
Base::equals(p, tol) && this->camera_.equals(e->camera_, tol)
127 std::cout << e.what() <<
": Landmark " 128 << DefaultKeyFormatter(this->key()) <<
" moved behind camera" 132 return Eigen::Matrix<double,traits<Measurement>::dimension,1>::Constant(2.0 *
camera_.calibration().fx());
149 return boost::shared_ptr<JacobianFactor>();
153 std::vector<size_t> dimensions(1, 3);
163 this->noiseModel_->WhitenSystem(A, b);
168 return boost::make_shared<JacobianFactor>(this->
keys_, Ab);
190 template<
class ARCHIVE>
191 void serialize(ARCHIVE & ar,
const unsigned int ) {
192 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
193 ar & BOOST_SERIALIZATION_NVP(
camera_);
const CAMERA camera_
CAMERA in which this landmark was seen.
Definition: TriangulationFactor.h:50
virtual ~TriangulationFactor()
Virtual destructor.
Definition: TriangulationFactor.h:89
bool verboseCheirality() const
return verbosity
Definition: TriangulationFactor.h:177
This is the base class for all factor types.
Definition: Factor.h:54
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
ValueType at(Key j) const
Retrieve a variable by key j.
Definition: Values-inl.h:342
const bool verboseCheirality_
If true, prints text for Cheirality exceptions (default: false)
Definition: TriangulationFactor.h:55
virtual void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Print.
Definition: NonlinearFactor.cpp:63
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Definition: TriangulationFactor.h:31
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
print
Definition: TriangulationFactor.h:103
boost::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition: TriangulationFactor.h:60
Definition: CalibratedCamera.h:32
Definition: VerticalBlockMatrix.h:41
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
A convenient base class for creating your own NoiseModelFactor with 1 variable.
Definition: NonlinearFactor.h:276
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
Calibrated camera for which only pose is unknown.
TriangulationFactor()
Default constructor.
Definition: TriangulationFactor.h:63
const bool throwCheirality_
If true, rethrows Cheirality exceptions (default: false)
Definition: TriangulationFactor.h:54
CAMERA Camera
CAMERA type.
Definition: TriangulationFactor.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
Non-linear factor base classes.
const Measurement & measured() const
return the measurement
Definition: TriangulationFactor.h:172
bool throwCheirality() const
return flag for throwing cheirality exceptions
Definition: TriangulationFactor.h:182
friend class boost::serialization::access
Serialization function.
Definition: TriangulationFactor.h:189
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: TriangulationFactor.h:93
virtual bool active(const Values &) const
Checks whether a factor should be used based on a set of values.
Definition: NonlinearFactor.h:113
const Measurement measured_
2D measurement
Definition: TriangulationFactor.h:51
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
DenseIndex rows() const
Row size.
Definition: VerticalBlockMatrix.h:114
boost::shared_ptr< GaussianFactor > linearize(const Values &x) const
Linearize to a JacobianFactor, does not support constrained noise model ! Hence .
Definition: TriangulationFactor.h:146
TriangulationFactor< CAMERA > This
shorthand for this class
Definition: TriangulationFactor.h:44
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:1072
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:72
virtual bool equals(const NonlinearFactor &p, double tol=1e-9) const
equals
Definition: TriangulationFactor.h:112
CAMERA::Measurement Measurement
shorthand for measurement type, e.g. Point2 or StereoPoint2
Definition: TriangulationFactor.h:47
VerticalBlockMatrix Ab
thread-safe (?) scratch memory for linearize
Definition: TriangulationFactor.h:137
TriangulationFactor(const CAMERA &camera, const Measurement &measured, const SharedNoiseModel &model, Key pointKey, bool throwCheirality=false, bool verboseCheirality=false)
Constructor with exception-handling flags.
Definition: TriangulationFactor.h:76
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.cpp:71
Vector evaluateError(const Point3 &point, boost::optional< Matrix & > H2=boost::none) const
Evaluate error h(x)-z and optionally derivatives.
Definition: TriangulationFactor.h:119
NoiseModelFactor1< Point3 > Base
shorthand for base class type
Definition: TriangulationFactor.h:41