31 #define DISABLE_TIMING 33 using namespace gtsam;
38 static const double sigma = 0.1;
88 std::shared_ptr<Cameras> cameraRig(
new Cameras());
97 std::shared_ptr<Cameras> cameraRig(
new Cameras());
106 std::shared_ptr<Cameras> cameraRig(
new Cameras());
123 std::vector<std::pair<Key, Key>> key_pairs;
124 key_pairs.push_back(std::make_pair(
x1,
x2));
125 key_pairs.push_back(std::make_pair(
x2,
x3));
126 key_pairs.push_back(std::make_pair(
x3,
x4));
128 std::vector<double> interp_factors;
129 interp_factors.push_back(interp_factor1);
130 interp_factors.push_back(interp_factor2);
131 interp_factors.push_back(interp_factor3);
135 std::shared_ptr<Cameras> cameraRig(
new Cameras());
141 factor2->add(measurements, key_pairs, interp_factors, cameraIds);
146 factor3->add(measurements, key_pairs, interp_factors, cameraIds);
155 EXPECT(factor1->equals(*factor2));
156 EXPECT(factor1->equals(*factor3));
165 EXPECT(factor1->equals(*factor2));
166 EXPECT(factor1->equals(*factor3));
171 factor1->add(measurements, key_pairs, interp_factors);
173 EXPECT(factor1->equals(*factor2));
174 EXPECT(factor1->equals(*factor3));
185 EXPECT(!factor1->equals(*factor2));
186 EXPECT(!factor1->equals(*factor3));
190 std::shared_ptr<Cameras> cameraRig2(
new Cameras());
191 cameraRig2->push_back(
Camera(body_P_sensor * body_P_sensor,
sharedK));
199 EXPECT(!factor1->equals(*factor2));
200 EXPECT(!factor1->equals(*factor3));
211 EXPECT(!factor1->equals(*factor2));
212 EXPECT(!factor1->equals(*factor3));
217 static const int ZDim = 2;
221 typedef std::vector<MatrixZD, Eigen::aligned_allocator<MatrixZD>>
233 std::shared_ptr<Cameras> cameraRig(
new Cameras());
237 factor.
add(level_uv,
x1,
x2, interp_factor1);
238 factor.
add(level_uv_right,
x2,
x3, interp_factor2);
245 double actualError = factor.
error(values);
246 double expectedError = 0.0;
264 EXPECT(actualE.rows() == 4);
265 EXPECT(actualE.cols() == 3);
266 EXPECT(actualb.rows() == 4);
267 EXPECT(actualb.cols() == 1);
268 EXPECT(actualFs.size() == 2);
273 Matrix expectedF11, expectedF12, expectedE1;
274 Vector expectedb1 = factor1.evaluateError(
287 Matrix expectedF21, expectedF22, expectedE2;
289 pose_right, pose_above,
landmark1, expectedF21, expectedF22, expectedE2);
306 Point2 pixelError(0.5, 1.0);
311 std::shared_ptr<Cameras> cameraRig(
new Cameras());
315 factor.
add(level_uv,
x1,
x2, interp_factor1);
316 factor.
add(level_uv_right,
x2,
x3, interp_factor2);
336 EXPECT(actualE.rows() == 4);
337 EXPECT(actualE.cols() == 3);
338 EXPECT(actualb.rows() == 4);
339 EXPECT(actualb.cols() == 1);
340 EXPECT(actualFs.size() == 2);
345 Matrix expectedF11, expectedF12, expectedE1;
347 factor1.evaluateError(
level_pose, pose_right, landmarkNoisy, expectedF11,
348 expectedF12, expectedE1);
361 Matrix expectedF21, expectedF22, expectedE2;
363 factor2.
evaluateError(pose_right, pose_above, landmarkNoisy, expectedF21,
364 expectedF22, expectedE2);
375 double actualError = factor.
error(values);
380 double expectedError = nfg.
error(values);
387 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
395 std::vector<std::pair<Key, Key>> key_pairs;
396 key_pairs.push_back(std::make_pair(
x1,
x2));
397 key_pairs.push_back(std::make_pair(
x2,
x3));
398 key_pairs.push_back(std::make_pair(
x3,
x1));
400 std::vector<double> interp_factors;
401 interp_factors.push_back(interp_factor1);
402 interp_factors.push_back(interp_factor2);
403 interp_factors.push_back(interp_factor3);
405 std::shared_ptr<Cameras> cameraRig(
new Cameras());
410 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors);
414 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors);
418 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors);
444 values.
insert(
x3, pose_above * noise_pose);
447 -0.0313952598, -0.000986635786, 0.0314107591,
448 -0.999013364, -0.0313952598),
461 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
469 std::vector<std::pair<Key, Key>> key_pairs;
470 key_pairs.push_back(std::make_pair(
x1,
x2));
471 key_pairs.push_back(std::make_pair(
x2,
x3));
472 key_pairs.push_back(std::make_pair(
x3,
x1));
474 std::vector<double> interp_factors;
475 interp_factors.push_back(interp_factor1);
476 interp_factors.push_back(interp_factor2);
477 interp_factors.push_back(interp_factor3);
479 std::shared_ptr<Cameras> cameraRig(
new Cameras());
485 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors, {1, 1, 1});
489 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors, {1, 1, 1});
493 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors, {1, 1, 1});
519 values.
insert(
x3, pose_above * noise_pose);
522 -0.0313952598, -0.000986635786, 0.0314107591,
523 -0.999013364, -0.0313952598),
537 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
557 std::vector<std::pair<Key, Key>> key_pairs;
558 key_pairs.push_back(std::make_pair(
x1,
x2));
559 key_pairs.push_back(std::make_pair(
x2,
x3));
560 key_pairs.push_back(std::make_pair(
x3,
x1));
562 std::vector<double> interp_factors;
563 interp_factors.push_back(interp_factor1);
564 interp_factors.push_back(interp_factor2);
565 interp_factors.push_back(interp_factor3);
567 std::shared_ptr<Cameras> cameraRig(
new Cameras());
574 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors, {0, 1, 2});
578 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors, {0, 1, 2});
582 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors, {0, 1, 2});
608 values.
insert(
x3, pose_above * noise_pose);
611 -0.0313952598, -0.000986635786, 0.0314107591,
612 -0.999013364, -0.0313952598),
637 Camera
cam1(pose1, sharedKSimple),
cam2(pose2, sharedKSimple);
646 measurements_lmk1.push_back(
cam1.project(landmark1));
647 measurements_lmk1.push_back(cam2.project(landmark1));
649 std::shared_ptr<Cameras> cameraRig(
new Cameras());
650 cameraRig->push_back(
Camera(body_P_sensorId, sharedKSimple));
654 double interp_factor = 0;
655 smartFactor1->add(measurements_lmk1[0],
x1,
x2, interp_factor);
657 smartFactor1->add(measurements_lmk1[1],
x1,
x2, interp_factor);
660 cameras.push_back(
cam1);
661 cameras.push_back(cam2);
664 EXPECT(smartFactor1->triangulateSafe(cameras));
665 EXPECT(!smartFactor1->isDegenerate());
666 EXPECT(!smartFactor1->isPointBehindCamera());
667 std::optional<Point3>
p = smartFactor1->point();
681 double expectedError = 2500;
686 A1 << -10, 0, 0, 0, 1, 0;
687 A2 << 10, 0, 1, 0, -1, 0;
690 Matrix expectedInformation;
693 Matrix66 G11 = 0.5 * A1.transpose() *
A1;
694 Matrix66 G12 = 0.5 * A1.transpose() * A2;
695 Matrix66 G22 = 0.5 * A2.transpose() * A2;
710 std::shared_ptr<RegularHessianFactor<6>> actual =
711 smartFactor1->createHessianFactor(values);
721 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
729 std::vector<std::pair<Key, Key>> key_pairs;
730 key_pairs.push_back(std::make_pair(
x1,
x2));
731 key_pairs.push_back(std::make_pair(
x2,
x3));
732 key_pairs.push_back(std::make_pair(
x3,
x1));
734 std::vector<double> interp_factors;
735 interp_factors.push_back(interp_factor1);
736 interp_factors.push_back(interp_factor2);
737 interp_factors.push_back(interp_factor3);
739 double excludeLandmarksFutherThanDist = 1e10;
747 std::shared_ptr<Cameras> cameraRig(
new Cameras());
751 smartFactor1.
add(measurements_lmk1, key_pairs, interp_factors);
754 smartFactor2.
add(measurements_lmk2, key_pairs, interp_factors);
757 smartFactor3.
add(measurements_lmk3, key_pairs, interp_factors);
775 values.
insert(
x3, pose_above * noise_pose);
786 optimization_3poses_landmarkDistance) {
788 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
796 std::vector<std::pair<Key, Key>> key_pairs;
797 key_pairs.push_back(std::make_pair(
x1,
x2));
798 key_pairs.push_back(std::make_pair(
x2,
x3));
799 key_pairs.push_back(std::make_pair(
x3,
x1));
801 std::vector<double> interp_factors;
802 interp_factors.push_back(interp_factor1);
803 interp_factors.push_back(interp_factor2);
804 interp_factors.push_back(interp_factor3);
806 double excludeLandmarksFutherThanDist = 2;
816 std::shared_ptr<Cameras> cameraRig(
new Cameras());
820 smartFactor1.
add(measurements_lmk1, key_pairs, interp_factors);
823 smartFactor2.
add(measurements_lmk2, key_pairs, interp_factors);
826 smartFactor3.
add(measurements_lmk3, key_pairs, interp_factors);
844 values.
insert(
x3, pose_above * noise_pose);
856 optimization_3poses_dynamicOutlierRejection) {
859 Point3 landmark4(5, -0.5, 1);
861 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3,
868 measurements_lmk4.at(0) =
869 measurements_lmk4.at(0) +
Point2(10, 10);
872 std::vector<std::pair<Key, Key>> key_pairs;
873 key_pairs.push_back(std::make_pair(
x1,
x2));
874 key_pairs.push_back(std::make_pair(
x2,
x3));
875 key_pairs.push_back(std::make_pair(
x3,
x1));
877 std::vector<double> interp_factors;
878 interp_factors.push_back(interp_factor1);
879 interp_factors.push_back(interp_factor2);
880 interp_factors.push_back(interp_factor3);
882 double excludeLandmarksFutherThanDist = 1e10;
883 double dynamicOutlierRejectionThreshold =
894 std::shared_ptr<Cameras> cameraRig(
new Cameras());
899 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors);
903 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors);
907 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors);
911 smartFactor4->add(measurements_lmk4, key_pairs, interp_factors);
932 values.
insert(
x3, pose_above * noise_pose);
943 hessianComparedToProjFactorsRollingShutter) {
951 std::vector<std::pair<Key, Key>> key_pairs;
952 key_pairs.push_back(std::make_pair(
x1,
x2));
953 key_pairs.push_back(std::make_pair(
x2,
x3));
954 key_pairs.push_back(std::make_pair(
x3,
x1));
956 std::vector<double> interp_factors;
957 interp_factors.push_back(interp_factor1);
958 interp_factors.push_back(interp_factor2);
959 interp_factors.push_back(interp_factor3);
961 std::shared_ptr<Cameras> cameraRig(
new Cameras());
966 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors);
975 values.
insert(
x3, pose_above * noise_pose);
978 -0.0313952598, -0.000986635786, 0.0314107591,
979 -0.999013364, -0.0313952598),
990 std::shared_ptr<GaussianFactor> linearfactor1 =
991 smartFactor1->linearize(values);
992 Matrix actualHessian = linearfactor1->information();
996 smartFactor1->triangulateSafe(smartFactor1->cameras(values));
1001 Matrix F = Matrix::Zero(2 * 3, 6 * 3);
1002 Matrix E = Matrix::Zero(2 * 3, 3);
1008 Matrix H1Actual, H2Actual, H3Actual;
1011 b.segment<2>(0) = -factor11.
evaluateError(pose1, pose2, *point, H1Actual,
1012 H2Actual, H3Actual);
1013 F.block<2, 6>(0, 0) = H1Actual;
1014 F.block<2, 6>(0, 6) = H2Actual;
1015 E.block<2, 3>(0, 0) = H3Actual;
1019 b.segment<2>(2) = -factor12.
evaluateError(pose2, pose3, *point, H1Actual,
1020 H2Actual, H3Actual);
1021 F.block<2, 6>(2, 6) = H1Actual;
1022 F.block<2, 6>(2, 12) = H2Actual;
1023 E.block<2, 3>(2, 0) = H3Actual;
1027 b.segment<2>(4) = -factor13.
evaluateError(pose3, pose1, *point, H1Actual,
1028 H2Actual, H3Actual);
1029 F.block<2, 6>(4, 12) = H1Actual;
1030 F.block<2, 6>(4, 0) = H2Actual;
1031 E.block<2, 3>(4, 0) = H3Actual;
1034 F = (1 /
sigma) * F;
1035 E = (1 /
sigma) * E;
1036 b = (1 /
sigma) * b;
1040 F.transpose() * F - (F.transpose() * E * P * E.transpose() *
F);
1045 gfg.
add(linearfactor1);
1056 Vector expectedInfoVector = F.transpose() * (b - E * P * E.transpose() *
b);
1061 nfg_projFactorsRS.
add(factor11);
1062 nfg_projFactorsRS.
add(factor12);
1063 nfg_projFactorsRS.
add(factor13);
1066 double actualError = smartFactor1->error(values);
1067 double expectedError = nfg_projFactorsRS.
error(values);
1073 hessianComparedToProjFactorsRollingShutter_measurementsFromSamePose) {
1086 measurements_lmk1_redundant.push_back(
1087 measurements_lmk1.at(0));
1090 std::vector<std::pair<Key, Key>> key_pairs;
1091 key_pairs.push_back(std::make_pair(
x1,
x2));
1092 key_pairs.push_back(std::make_pair(
x2,
x3));
1093 key_pairs.push_back(std::make_pair(
x3,
x1));
1094 key_pairs.push_back(std::make_pair(
x1,
x2));
1096 std::vector<double> interp_factors;
1097 interp_factors.push_back(interp_factor1);
1098 interp_factors.push_back(interp_factor2);
1099 interp_factors.push_back(interp_factor3);
1100 interp_factors.push_back(interp_factor1);
1102 std::shared_ptr<Cameras> cameraRig(
new Cameras());
1107 smartFactor1->add(measurements_lmk1_redundant, key_pairs, interp_factors);
1116 values.
insert(
x3, pose_above * noise_pose);
1119 -0.0313952598, -0.000986635786, 0.0314107591,
1120 -0.999013364, -0.0313952598),
1131 std::shared_ptr<GaussianFactor> linearfactor1 =
1132 smartFactor1->linearize(values);
1133 Matrix actualHessian = linearfactor1->information();
1137 smartFactor1->triangulateSafe(smartFactor1->cameras(values));
1143 Matrix F = Matrix::Zero(2 * 4, 6 * 3);
1144 Matrix E = Matrix::Zero(2 * 4, 3);
1151 Matrix H1Actual, H2Actual, H3Actual;
1154 b.segment<2>(0) = -factor11.
evaluateError(pose1, pose2, *point, H1Actual,
1155 H2Actual, H3Actual);
1156 F.block<2, 6>(0, 0) = H1Actual;
1157 F.block<2, 6>(0, 6) = H2Actual;
1158 E.block<2, 3>(0, 0) = H3Actual;
1163 b.segment<2>(2) = -factor12.
evaluateError(pose2, pose3, *point, H1Actual,
1164 H2Actual, H3Actual);
1165 F.block<2, 6>(2, 6) = H1Actual;
1166 F.block<2, 6>(2, 12) = H2Actual;
1167 E.block<2, 3>(2, 0) = H3Actual;
1172 b.segment<2>(4) = -factor13.
evaluateError(pose3, pose1, *point, H1Actual,
1173 H2Actual, H3Actual);
1174 F.block<2, 6>(4, 12) = H1Actual;
1175 F.block<2, 6>(4, 0) = H2Actual;
1176 E.block<2, 3>(4, 0) = H3Actual;
1181 b.segment<2>(6) = -factor11.
evaluateError(pose1, pose2, *point, H1Actual,
1182 H2Actual, H3Actual);
1183 F.block<2, 6>(6, 0) = H1Actual;
1184 F.block<2, 6>(6, 6) = H2Actual;
1185 E.block<2, 3>(6, 0) = H3Actual;
1188 F = (1 /
sigma) * F;
1189 E = (1 /
sigma) * E;
1190 b = (1 /
sigma) * b;
1194 F.transpose() * F - (F.transpose() * E * P * E.transpose() *
F);
1199 gfg.
add(linearfactor1);
1210 Vector expectedInfoVector = F.transpose() * (b - E * P * E.transpose() *
b);
1215 nfg_projFactorsRS.
add(factor11);
1216 nfg_projFactorsRS.
add(factor12);
1217 nfg_projFactorsRS.
add(factor13);
1218 nfg_projFactorsRS.
add(factor14);
1221 double actualError = smartFactor1->error(values);
1222 double expectedError = nfg_projFactorsRS.
error(values);
1228 optimization_3poses_measurementsFromSamePose) {
1230 Point2Vector measurements_lmk1, measurements_lmk2, measurements_lmk3;
1238 std::vector<std::pair<Key, Key>> key_pairs;
1239 key_pairs.push_back(std::make_pair(
x1,
x2));
1240 key_pairs.push_back(std::make_pair(
x2,
x3));
1241 key_pairs.push_back(std::make_pair(
x3,
x1));
1243 std::vector<double> interp_factors;
1244 interp_factors.push_back(interp_factor1);
1245 interp_factors.push_back(interp_factor2);
1246 interp_factors.push_back(interp_factor3);
1252 measurements_lmk1_redundant.push_back(
1253 measurements_lmk1.at(0));
1254 std::vector<std::pair<Key, Key>> key_pairs_redundant = key_pairs;
1255 key_pairs_redundant.push_back(
1257 std::vector<double> interp_factors_redundant = interp_factors;
1258 interp_factors_redundant.push_back(
1259 interp_factors.at(0));
1261 std::shared_ptr<Cameras> cameraRig(
new Cameras());
1266 smartFactor1->add(measurements_lmk1_redundant, key_pairs_redundant,
1267 interp_factors_redundant);
1271 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors);
1275 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors);
1288 groundTruth.
insert(
x2, pose_right);
1289 groundTruth.
insert(
x3, pose_above);
1301 values.
insert(
x3, pose_above * noise_pose);
1304 -0.0313952598, -0.000986635786, 0.0314107591,
1305 -0.999013364, -0.0313952598),
1315 #ifndef DISABLE_TIMING 1335 Camera
cam1(pose1, sharedKSimple),
cam2(pose2, sharedKSimple);
1344 measurements_lmk1.push_back(
cam1.project(landmark1));
1345 measurements_lmk1.push_back(cam2.project(landmark1));
1347 size_t nrTests = 10000;
1349 for (
size_t i = 0;
i < nrTests;
i++) {
1350 std::shared_ptr<Cameras> cameraRig(
new Cameras());
1351 cameraRig->push_back(
Camera(body_P_sensorId, sharedKSimple));
1354 model, cameraRig, params));
1355 double interp_factor = 0;
1356 smartFactorRS->add(measurements_lmk1[0],
x1,
x2, interp_factor);
1358 smartFactorRS->add(measurements_lmk1[1],
x1,
x2, interp_factor);
1364 smartFactorRS->linearize(values);
1368 for (
size_t i = 0;
i < nrTests;
i++) {
1371 smartFactor->add(measurements_lmk1[0],
x1);
1372 smartFactor->add(measurements_lmk1[1],
x2);
1378 smartFactor->linearize(values);
1403 optimization_3poses_sphericalCameras) {
1405 std::vector<Unit3> measurements_lmk1, measurements_lmk2, measurements_lmk3;
1412 projectToMultipleCameras<Camera>(
cam1,
cam2,
cam3, landmark3,
1416 std::vector<std::pair<Key, Key>> key_pairs;
1417 key_pairs.push_back(std::make_pair(
x1,
x2));
1418 key_pairs.push_back(std::make_pair(
x2,
x3));
1419 key_pairs.push_back(std::make_pair(
x3,
x1));
1421 std::vector<double> interp_factors;
1422 interp_factors.push_back(interp_factor1);
1423 interp_factors.push_back(interp_factor2);
1424 interp_factors.push_back(interp_factor3);
1431 std::shared_ptr<Cameras> cameraRig(
new Cameras());
1436 smartFactor1->add(measurements_lmk1, key_pairs, interp_factors);
1440 smartFactor2->add(measurements_lmk2, key_pairs, interp_factors);
1444 smartFactor3->add(measurements_lmk3, key_pairs, interp_factors);
1456 groundTruth.
insert(
x1, level_pose);
1457 groundTruth.
insert(
x2, pose_right);
1458 groundTruth.
insert(
x3, pose_above);
1470 values.
insert(
x3, pose_above * noise_pose);
1473 -0.0313952598, -0.000986635786, 0.0314107591,
1474 -0.999013364, -0.0313952598),
static double interp_factor
static const int ZDim
Measurement dimension (Point2)
static Rot3 Ypr(double y, double p, double r, OptionalJacobian< 3, 1 > Hy={}, OptionalJacobian< 3, 1 > Hp={}, OptionalJacobian< 3, 1 > Hr={})
static PinholeCamera< Cal3_S2 > cam1(pose3, cal1)
virtual const Values & optimize()
m m block(1, 0, 2, 2)<< 4
static int runAllTests(TestResult &result)
const ValueType at(Key j) const
static StereoCamera cam2(pose3, cal4ptr)
#define DOUBLES_EQUAL(expected, actual, threshold)
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
void setEnableEPI(bool enableEPI)
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
PinholeCamera< Cal3Bundler0 > Camera
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Rot2 R(Rot2::fromAngle(0.1))
static Rot3 Identity()
identity rotation for group operation
CameraSet< Camera > Cameras
static Point2 measurement3(320.0, 10.0)
static Pose3 Identity()
identity for group operation
Camera cam3(interp_pose3, emptyK)
noiseModel::Isotropic::shared_ptr SharedIsotropic
Calibrated camera with spherical projection.
Some functions to compute numerical derivatives.
iterator insert(const std::pair< Key, Vector > &key_value)
void computeJacobiansWithTriangulatedPoint(FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
static Point2 measurement2(200.0, 220.0)
NonlinearFactorGraph graph
A set of cameras, all with their own calibration.
Point2 landmark1(5.0, 1.5)
static const int DimBlock
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
static Pose3 body_P_sensor
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
Basic projection factor for rolling shutter cameras.
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
static const CalibratedCamera camera3(pose1)
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
void setRankTolerance(double rankTol)
Implements a prior on the translation component of a pose.
void add(const GaussianFactor &factor)
Point2 landmark2(7.0, 1.5)
void add(const MEASUREMENT &measured, const Key &world_P_body_key1, const Key &world_P_body_key2, const double &alpha, const size_t &cameraId=0)
std::shared_ptr< Cal3_S2 > shared_ptr
TriangulationResult triangulateSafe(const Cameras &cameras) const
Call gtsam::triangulateSafe iff we need to re-triangulate.
SmartProjectionPoseFactor< Cal3_S2 > SmartFactor
#define EXPECT(condition)
static Pose3 pose3(rt3, pt3)
static const Camera2 camera2(pose1, K2)
Eigen::Matrix< double, ZDim, DimBlock > MatrixZD
SmartProjectionPoseFactorRollingShutter< Camera > SmartFactorRS_spherical
SmartProjectionParams params(gtsam::HESSIAN, gtsam::ZERO_ON_DEGENERACY)
Matrix information() const override
static double interp_factor2
void projectToMultipleCameras(const CAMERA &cam1, const CAMERA &cam2, const CAMERA &cam3, Point3 landmark, typename CAMERA::MeasurementVector &measurements_cam)
void setLandmarkDistanceThreshold(double landmarkDistanceThreshold)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const double sigma
The most common 5DOF 3D->2D calibration.
static Cal3_S2::shared_ptr sharedK(new Cal3_S2(fov, w, h))
StereoPoint2 project(const Point3 &point) const
Project 3D point to StereoPoint2 (uL,uR,v)
double error(const Values &values) const
Reprojection of a LANDMARK to a 2D point.
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
SmartProjectionPoseFactorRollingShutter< PinholePose< Cal3_S2 > > SmartFactorRS
std::pair< Matrix, Vector > hessian(const Ordering &ordering) const
noiseModel::Diagonal::shared_ptr SharedDiagonal
Base::Cameras cameras(const Values &values) const override
std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
static double interp_factor3
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
TriangulationResult point() const
void setDegeneracyMode(DegeneracyMode degMode)
double error(const Values &values) const override
static const double rankTol
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Pose3 g1(Rot3(), Point3(100.0, 0.0, 300.0))
static const Point2 level_uv_right
static double interp_factor1
graph add(PriorFactor< Pose2 >(1, priorMean, priorNoise))
void insert(Key j, const Value &val)
void setLinearizationMode(LinearizationMode linMode)
Vector evaluateError(const Pose3 &pose_a, const Pose3 &pose_b, const Point3 &point, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
Evaluate error h(x)-z and optionally derivatives.
std::shared_ptr< EmptyCal > shared_ptr
static EmptyCal::shared_ptr emptyK(new EmptyCal())
TEST(SmartFactorBase, Pinhole)
The matrix class, also used for vectors and row-vectors.
Point2Vector MeasurementVector
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Pose3 g2(g1.expmap(h *V1_g1))
Smart projection factor on poses modeling rolling shutter effect with given readout time...
PinholeCamera< Cal3_S2 > camera1(pose1, *sharedCal)
void setDynamicOutlierRejectionThreshold(double dynOutRejectionThreshold)
static const Point2 level_uv
LevenbergMarquardtParams lmParams
static Point2 measurement1(323.0, 240.0)
static SharedIsotropic model(noiseModel::Isotropic::Sigma(2, sigma))
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)