From b166985a82242fea6fe4b6748669c73f758dc2fa Mon Sep 17 00:00:00 2001 From: David Wisth Date: Mon, 3 Jan 2022 16:40:48 +1100 Subject: [PATCH 1/3] remove unnessecary constructor - use default arguments instead --- gtsam_unstable/slam/ProjectionFactorPPPC.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/gtsam_unstable/slam/ProjectionFactorPPPC.h b/gtsam_unstable/slam/ProjectionFactorPPPC.h index 53860efdc1..2084e99f71 100644 --- a/gtsam_unstable/slam/ProjectionFactorPPPC.h +++ b/gtsam_unstable/slam/ProjectionFactorPPPC.h @@ -57,19 +57,6 @@ class GTSAM_UNSTABLE_EXPORT ProjectionFactorPPPC measured_(0.0, 0.0), throwCheirality_(false), verboseCheirality_(false) { } - /** - * Constructor - * TODO: Mark argument order standard (keys, measurement, parameters) - * @param measured is the 2 dimensional location of point in image (the measurement) - * @param model is the standard deviation - * @param poseKey is the index of the camera - * @param pointKey is the index of the landmark - * @param K shared pointer to the constant calibration - */ - ProjectionFactorPPPC(const Point2& measured, const SharedNoiseModel& model, - Key poseKey, Key transformKey, Key pointKey, Key calibKey) : - Base(model, poseKey, transformKey, pointKey, calibKey), measured_(measured), - throwCheirality_(false), verboseCheirality_(false) {} /** * Constructor with exception-handling flags @@ -84,7 +71,7 @@ class GTSAM_UNSTABLE_EXPORT ProjectionFactorPPPC */ ProjectionFactorPPPC(const Point2& measured, const SharedNoiseModel& model, Key poseKey, Key transformKey, Key pointKey, Key calibKey, - bool throwCheirality, bool verboseCheirality) : + bool throwCheirality = false, bool verboseCheirality = false) : Base(model, poseKey, transformKey, pointKey, calibKey), measured_(measured), throwCheirality_(throwCheirality), verboseCheirality_(verboseCheirality) {} From c86e42e8a17088f014d98af92412ec09540556f7 Mon Sep 17 00:00:00 2001 From: David Wisth Date: Mon, 3 Jan 2022 16:41:04 +1100 Subject: [PATCH 2/3] fix constructor documentation --- gtsam_unstable/slam/ProjectionFactorPPPC.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gtsam_unstable/slam/ProjectionFactorPPPC.h b/gtsam_unstable/slam/ProjectionFactorPPPC.h index 2084e99f71..35940b2014 100644 --- a/gtsam_unstable/slam/ProjectionFactorPPPC.h +++ b/gtsam_unstable/slam/ProjectionFactorPPPC.h @@ -61,13 +61,17 @@ class GTSAM_UNSTABLE_EXPORT ProjectionFactorPPPC /** * Constructor with exception-handling flags * TODO: Mark argument order standard (keys, measurement, parameters) - * @param measured is the 2 dimensional location of point in image (the measurement) + * @param measured is the 2 dimensional location of point in image (the + * measurement) * @param model is the standard deviation * @param poseKey is the index of the camera + * @param transformKey is the index of the extrinsic calibration * @param pointKey is the index of the landmark - * @param K shared pointer to the constant calibration - * @param throwCheirality determines whether Cheirality exceptions are rethrown - * @param verboseCheirality determines whether exceptions are printed for Cheirality + * @param calibKey is the index of the intrinsic calibration + * @param throwCheirality determines whether Cheirality exceptions are + * rethrown + * @param verboseCheirality determines whether exceptions are printed for + * Cheirality */ ProjectionFactorPPPC(const Point2& measured, const SharedNoiseModel& model, Key poseKey, Key transformKey, Key pointKey, Key calibKey, From 25c82c98784c5654ab437c2a0831f4227f9090d0 Mon Sep 17 00:00:00 2001 From: David Wisth Date: Mon, 3 Jan 2022 16:41:21 +1100 Subject: [PATCH 3/3] change a couple of variables to const --- gtsam_unstable/slam/ProjectionFactorPPPC.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam_unstable/slam/ProjectionFactorPPPC.h b/gtsam_unstable/slam/ProjectionFactorPPPC.h index 35940b2014..18ee13b9a9 100644 --- a/gtsam_unstable/slam/ProjectionFactorPPPC.h +++ b/gtsam_unstable/slam/ProjectionFactorPPPC.h @@ -115,8 +115,8 @@ class GTSAM_UNSTABLE_EXPORT ProjectionFactorPPPC try { if(H1 || H2 || H3 || H4) { Matrix H0, H02; - PinholeCamera camera(pose.compose(transform, H0, H02), K); - Point2 reprojectionError(camera.project(point, H1, H3, H4) - measured_); + const PinholeCamera camera(pose.compose(transform, H0, H02), K); + const Point2 reprojectionError(camera.project(point, H1, H3, H4) - measured_); *H2 = *H1 * H02; *H1 = *H1 * H0; return reprojectionError;