47 std::vector<boost::shared_ptr<Cal3_S2Stereo>>
K_all_;
56 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
70 typedef Eigen::Matrix<double, ZDim, DimBlock> MatrixZD;
71 typedef std::vector<MatrixZD, Eigen::aligned_allocator<MatrixZD> > FBlocks;
79 const SmartStereoProjectionParams& params =
80 SmartStereoProjectionParams());
94 const Key& body_P_cam_key,
95 const boost::shared_ptr<Cal3_S2Stereo>& K);
106 void add(
const std::vector<StereoPoint2>& measurements,
108 const std::vector<boost::shared_ptr<Cal3_S2Stereo>>& Ks);
120 void add(
const std::vector<StereoPoint2>& measurements,
122 const boost::shared_ptr<Cal3_S2Stereo>& K);
130 DefaultKeyFormatter)
const override;
143 double error(
const Values& values)
const override;
146 inline std::vector<boost::shared_ptr<Cal3_S2Stereo>>
calibration()
const {
157 Base::Cameras cameras(
const Values& values)
const override;
168 FBlocks& Fs, Matrix& E, Vector& b,
const Values& values)
const {
170 throw(
"computeJacobiansWithTriangulatedPoint");
173 E = Matrix::Zero(3 * numViews, 3);
174 b = Vector::Zero(3 * numViews);
175 Matrix dPoseCam_dPoseBody_i, dPoseCam_dPoseExt_i, dProject_dPoseCam_i, Ei;
177 for (
size_t i = 0; i < numViews; i++) {
181 w_P_body.compose(body_P_cam, dPoseCam_dPoseBody_i, dPoseCam_dPoseExt_i),
186 Eigen::Matrix<double, ZDim, DimBlock> J;
187 J.block<
ZDim, 6>(0, 0) = dProject_dPoseCam_i * dPoseCam_dPoseBody_i;
188 J.block<
ZDim, 6>(0, 6) = dProject_dPoseCam_i * dPoseCam_dPoseExt_i;
192 J.block<1, 12>(1, 0) = Matrix::Zero(1, 12);
193 Ei.block<1, 3>(1, 0) = Matrix::Zero(1, 3);
195 reprojectionError_i.
v());
201 E.block<3, 3>(
row, 0) = Ei;
208 const Values& values,
const double lambda = 0.0,
bool diagonalDamping =
214 size_t nrUniqueKeys =
keys_.size();
218 std::vector < Matrix > Gs(nrUniqueKeys * (nrUniqueKeys + 1) / 2);
219 std::vector<Vector> gs(nrUniqueKeys);
222 throw std::runtime_error(
"SmartStereoProjectionHessianFactor: this->"
223 "measured_.size() inconsistent with input");
233 return boost::make_shared < RegularHessianFactor<DimPose>
234 > (
keys_, Gs, gs, 0.0);
245 for (
size_t i = 0; i < Fs.size(); i++)
250 Cameras::ComputePointCovariance <3> (P, E, lambda, diagonalDamping);
261 nonuniqueKeys,
keys_);
263 return boost::make_shared < RegularHessianFactor<DimPose>
264 > (
keys_, augmentedHessianUniqueKeys);
273 const Values& values,
const double lambda = 0.0)
const {
275 switch (params_.linearizationMode) {
279 throw std::runtime_error(
280 "SmartStereoProjectionFactorPP: unknown linearization mode");
292 friend class boost::serialization::access;
293 template<
class ARCHIVE>
294 void serialize(ARCHIVE& ar,
const unsigned int ) {
295 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
296 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
const MATRIX::ConstRowXpr row(const MATRIX &A, size_t j)
Extracts a row view from a matrix that avoids a copy.
Definition Matrix.h:222
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:86
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:724
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:100
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
This class stores a dense matrix and allows it to be accessed as a collection of blocks.
Definition SymmetricBlockMatrix.h:52
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
static SymmetricBlockMatrix SchurComplementAndRearrangeBlocks(const std::vector< Eigen::Matrix< double, ZDim, ND >, Eigen::aligned_allocator< Eigen::Matrix< double, ZDim, ND > > > &Fs, const Matrix &E, const Eigen::Matrix< double, N, N > &P, const Vector &b, const KeyVector &jacobianKeys, const KeyVector &hessianKeys)
Definition CameraSet.h:218
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:37
A stereo camera class, parameterize by left camera pose and stereo calibration.
Definition StereoCamera.h:47
StereoPoint2 project(const Point3 &point) const
Project 3D point to StereoPoint2 (uL,uR,v).
Definition StereoCamera.cpp:32
A 2D stereo point, v will be same for rectified images.
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
KeyVector keys_
The keys involved in this factor.
Definition Factor.h:85
size_t size() const
Definition Factor.h:157
Nonlinear factor base class.
Definition NonlinearFactor.h:42
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65
const ValueType at(Key j) const
Retrieve a variable by key j.
Definition Values-inl.h:361
SharedIsotropic noiseModel_
Definition SmartFactorBase.h:72
ZVector measured_
Definition SmartFactorBase.h:79
const ZVector & measured() const
Definition SmartFactorBase.h:159
TriangulationResult triangulateSafe(const Cameras &cameras) const
triangulateSafe
Definition SmartStereoProjectionFactor.h:164
TriangulationResult result_
result from triangulateSafe
Definition SmartStereoProjectionFactor.h:67
SmartStereoProjectionFactor(const SharedNoiseModel &sharedNoiseModel, const SmartStereoProjectionParams ¶ms=SmartStereoProjectionParams(), const boost::optional< Pose3 > body_P_sensor=boost::none)
Constructor.
Definition SmartStereoProjectionFactor.h:88
If you are using the factor, please cite: L.
Definition SmartStereoProjectionFactorPP.h:44
static const int DimBlock
Camera dimension: 6 for body pose, 6 for extrinsic pose.
Definition SmartStereoProjectionFactorPP.h:67
SmartStereoProjectionFactorPP This
shorthand for this class
Definition SmartStereoProjectionFactorPP.h:62
static const int ZDim
Measurement dimension (for a StereoPoint2 measurement).
Definition SmartStereoProjectionFactorPP.h:69
boost::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition SmartStereoProjectionFactorPP.h:65
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition SmartStereoProjectionFactorPP.cpp:94
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:207
const KeyVector & getExtrinsicPoseKeys() const
equals
Definition SmartStereoProjectionFactorPP.h:136
~SmartStereoProjectionFactorPP() override=default
Virtual destructor.
std::vector< boost::shared_ptr< Cal3_S2Stereo > > calibration() const
return the calibration object
Definition SmartStereoProjectionFactorPP.h:146
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:50
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:167
KeyVector body_P_cam_keys_
The keys corresponding to the extrinsic pose calibration for each view (pose that transform from came...
Definition SmartStereoProjectionFactorPP.h:53
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:59
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:272
boost::shared_ptr< GaussianFactor > linearize(const Values &values) const override
linearize
Definition SmartStereoProjectionFactorPP.h:285
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
static const int DimPose
Pose3 dimension.
Definition SmartStereoProjectionFactorPP.h:68
std::vector< boost::shared_ptr< Cal3_S2Stereo > > K_all_
shared pointer to calibration object (one for each camera)
Definition SmartStereoProjectionFactorPP.h:47