46 std::vector<boost::shared_ptr<Cal3_S2Stereo>>
K_all_;
55 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 typedef Eigen::Matrix<double, ZDim, DimBlock> MatrixZD;
70 typedef std::vector<MatrixZD, Eigen::aligned_allocator<MatrixZD> > FBlocks;
93 const Key& body_P_cam_key,
94 const boost::shared_ptr<Cal3_S2Stereo>& K);
105 void add(
const std::vector<StereoPoint2>& measurements,
107 const std::vector<boost::shared_ptr<Cal3_S2Stereo>>& Ks);
119 void add(
const std::vector<StereoPoint2>& measurements,
121 const boost::shared_ptr<Cal3_S2Stereo>& K);
129 DefaultKeyFormatter)
const override;
145 inline std::vector<boost::shared_ptr<Cal3_S2Stereo>>
calibration()
const {
167 FBlocks& Fs, Matrix& E, Vector& b,
const Values& values)
const {
169 throw(
"computeJacobiansWithTriangulatedPoint");
172 E = Matrix::Zero(3 * numViews, 3);
173 b = Vector::Zero(3 * numViews);
174 Matrix dPoseCam_dPoseBody_i, dPoseCam_dPoseExt_i, dProject_dPoseCam_i, Ei;
176 for (
size_t i = 0; i < numViews; i++) {
180 w_P_body.compose(body_P_cam, dPoseCam_dPoseBody_i, dPoseCam_dPoseExt_i),
185 Eigen::Matrix<double, ZDim, DimBlock> J;
186 J.block<
ZDim, 6>(0, 0) = dProject_dPoseCam_i * dPoseCam_dPoseBody_i;
187 J.block<
ZDim, 6>(0, 6) = dProject_dPoseCam_i * dPoseCam_dPoseExt_i;
191 J.block<1, 12>(1, 0) = Matrix::Zero(1, 12);
192 Ei.block<1, 3>(1, 0) = Matrix::Zero(1, 3);
194 reprojectionError_i.
v());
200 E.block<3, 3>(
row, 0) = Ei;
207 const Values& values,
const double lambda = 0.0,
bool diagonalDamping =
213 size_t nrUniqueKeys =
keys_.size();
217 std::vector < Matrix > Gs(nrUniqueKeys * (nrUniqueKeys + 1) / 2);
218 std::vector<Vector> gs(nrUniqueKeys);
221 throw std::runtime_error(
"SmartStereoProjectionHessianFactor: this->"
222 "measured_.size() inconsistent with input");
232 return boost::make_shared < RegularHessianFactor<DimPose>
233 > (
keys_, Gs, gs, 0.0);
244 for (
size_t i = 0; i < Fs.size(); i++)
249 Cameras::ComputePointCovariance <3> (P, E, lambda, diagonalDamping);
259 Cameras::SchurComplementAndRearrangeBlocks<3,DimBlock,DimPose>(Fs,E,P,b,
260 nonuniqueKeys,
keys_);
262 return boost::make_shared < RegularHessianFactor<DimPose>
263 > (
keys_, augmentedHessianUniqueKeys);
272 const Values& values,
const double lambda = 0.0)
const {
278 throw std::runtime_error(
279 "SmartStereoProjectionFactorPP: unknown linearization mode");
292 template<
class ARCHIVE>
293 void serialize(ARCHIVE& ar,
const unsigned int ) {
294 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
295 ar & BOOST_SERIALIZATION_NVP(
K_all_);
304 SmartStereoProjectionFactorPP> {
Smart stereo factor on StereoCameras (pose)
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
const MATRIX::ConstRowXpr row(const MATRIX &A, size_t j)
Extracts a row view from a matrix that avoids a copy.
Definition: Matrix.h:225
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
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Definition: SymmetricBlockMatrix.h:52
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:151
Definition: StereoCamera.h:47
Definition: StereoPoint2.h:32
Vector3 vector() const
convert to vector
Definition: StereoPoint2.h:115
double uL() const
get uL
Definition: StereoPoint2.h:106
double v() const
get v
Definition: StereoPoint2.h:112
This is the base class for all factor types.
Definition: Factor.h:56
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:73
size_t size() const
Definition: Factor.h:136
Nonlinear factor base class.
Definition: NonlinearFactor.h:43
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:63
const ValueType at(Key j) const
Retrieve a variable by key j.
Definition: Values-inl.h:346
SharedIsotropic noiseModel_
As of Feb 22, 2015, the noise model is the same for all measurements and is isotropic.
Definition: SmartFactorBase.h:72
ZVector measured_
Measurements for each of the m views.
Definition: SmartFactorBase.h:79
const ZVector & measured() const
Return the 2D measurements (ZDim, in general).
Definition: SmartFactorBase.h:159
Definition: SmartFactorParams.h:42
LinearizationMode linearizationMode
How to linearize the factor.
Definition: SmartFactorParams.h:44
SmartStereoProjectionFactor: triangulates point and keeps an estimate of it around.
Definition: SmartStereoProjectionFactor.h:52
TriangulationResult triangulateSafe(const Cameras &cameras) const
triangulateSafe
Definition: SmartStereoProjectionFactor.h:163
TriangulationResult result_
result from triangulateSafe
Definition: SmartStereoProjectionFactor.h:66
Definition: SmartStereoProjectionFactorPP.h:43
static const int DimBlock
Camera dimension: 6 for body pose, 6 for extrinsic pose.
Definition: SmartStereoProjectionFactorPP.h:66
SmartStereoProjectionFactorPP This
shorthand for this class
Definition: SmartStereoProjectionFactorPP.h:61
static const int ZDim
Measurement dimension (for a StereoPoint2 measurement)
Definition: SmartStereoProjectionFactorPP.h:68
boost::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition: SmartStereoProjectionFactorPP.h:64
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition: SmartStereoProjectionFactorPP.cpp:94
double error(const Values &values) const override
error calculates the error of the factor.
Definition: SmartStereoProjectionFactorPP.cpp:103
SmartStereoProjectionFactorPP(const SharedNoiseModel &sharedNoiseModel, const SmartStereoProjectionParams ¶ms=SmartStereoProjectionParams())
Constructor.
Definition: SmartStereoProjectionFactorPP.cpp:23
boost::shared_ptr< RegularHessianFactor< DimPose > > createHessianFactor(const Values &values, const double lambda=0.0, bool diagonalDamping=false) const
linearize and return a Hessianfactor that is an approximation of error(p)
Definition: SmartStereoProjectionFactorPP.h:206
const KeyVector & getExtrinsicPoseKeys() const
equals
Definition: SmartStereoProjectionFactorPP.h:135
~SmartStereoProjectionFactorPP() override=default
Virtual destructor.
std::vector< boost::shared_ptr< Cal3_S2Stereo > > calibration() const
return the calibration object
Definition: SmartStereoProjectionFactorPP.h:145
KeyVector world_P_body_keys_
The keys corresponding to the pose of the body (with respect to an external world frame) for each vie...
Definition: SmartStereoProjectionFactorPP.h:49
void computeJacobiansAndCorrectForMissingMeasurements(FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
Compute jacobian F, E and error vector at a given linearization point.
Definition: SmartStereoProjectionFactorPP.h:166
KeyVector body_P_cam_keys_
The keys corresponding to the extrinsic pose calibration for each view (pose that transform from came...
Definition: SmartStereoProjectionFactorPP.h:52
void add(const StereoPoint2 &measured, const Key &world_P_body_key, const Key &body_P_cam_key, const boost::shared_ptr< Cal3_S2Stereo > &K)
add a new measurement, with a pose key, and an extrinsic pose key
Definition: SmartStereoProjectionFactorPP.cpp:28
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef SmartStereoProjectionFactor Base
shorthand for base class type
Definition: SmartStereoProjectionFactorPP.h:58
boost::shared_ptr< GaussianFactor > linearizeDamped(const Values &values, const double lambda=0.0) const
Linearize to Gaussian Factor (possibly adding a damping factor Lambda for LM)
Definition: SmartStereoProjectionFactorPP.h:271
boost::shared_ptr< GaussianFactor > linearize(const Values &values) const override
linearize
Definition: SmartStereoProjectionFactorPP.h:284
Base::Cameras cameras(const Values &values) const override
Collect all cameras involved in this factor.
Definition: SmartStereoProjectionFactorPP.cpp:112
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition: SmartStereoProjectionFactorPP.cpp:84
friend class boost::serialization::access
Serialization function.
Definition: SmartStereoProjectionFactorPP.h:291
static const int DimPose
Pose3 dimension.
Definition: SmartStereoProjectionFactorPP.h:67
std::vector< boost::shared_ptr< Cal3_S2Stereo > > K_all_
shared pointer to calibration object (one for each camera)
Definition: SmartStereoProjectionFactorPP.h:46