2121
2222#include < mp2p_icp/Pairings.h>
2323#include < mrpt/math/CMatrixFixed.h>
24+ #include < mrpt/typemeta/TEnumType.h>
25+
26+ #include < cstdint>
2427
2528namespace mp2p_icp
2629{
2730struct CovarianceParameters
2831{
29- // Finite difference deltas:
32+ /* * Covariance estimation backend. */
33+ enum class Method : uint8_t
34+ {
35+ /* * Inverse of the (whitened) Gauss-Newton Hessian, scaled by the
36+ * a-posteriori unit-weight variance chi^2/(m-n). Cheap but typically
37+ * optimistic, since it ignores correspondence and surface-mismatch
38+ * noise. */
39+ InverseHessian,
40+
41+ /* * Censi-style sandwich H^{-1} M H^{-1}, with H = sum J_i^T J_i and
42+ * M = sum J_i^T Sigma_z_i J_i. For cov2cov pairings the per-pair
43+ * Sigma_z = inv(cov_inv) is used directly; for pt2pt without
44+ * per-pair noise, an isotropic Sigma_z = defaultPointSigma^2 * I
45+ * is assumed. Reference: Censi 2007, Prakhya 2015. */
46+ Censi3D,
47+ };
48+
49+ Method method = Method::InverseHessian;
50+
51+ /* * For pt2pt pairings without per-pair Sigma in Censi3D path:
52+ * isotropic point-noise std-dev [m]. */
53+ double defaultPointSigma = 0.02 ;
54+
55+ /* * Per-axis floor added to the resulting covariance diagonal. Stored as
56+ * std-dev for readability; squared internally. Useful to absorb
57+ * unmodelled errors and keep downstream filters numerically stable. */
58+ double floor_sigma_xyz = 0.0 ; // /< [m]
59+ double floor_sigma_angles = 0.0 ; // /< [rad]
60+
61+ // Finite difference deltas (only used by InverseHessian path):
3062 double finDif_xyz = 1e-7 ;
3163 double finDif_angles = 1e-7 ;
64+
65+ /* * Loads the parameters from a YAML map node. All entries are optional;
66+ * unspecified fields keep their default values. Recognized keys:
67+ *
68+ * method: "InverseHessian" | "Censi3D"
69+ * defaultPointSigma: [m]
70+ * floor_sigma_xyz: [m]
71+ * floor_sigma_angles: [rad] (use floor_sigma_angles_deg for degrees)
72+ * floor_sigma_angles_deg: [deg] (alternative to the radian form)
73+ * finDif_xyz, finDif_angles
74+ */
75+ void load_from (const mrpt::containers::yaml& p);
76+ void save_to (mrpt::containers::yaml& p) const ;
3277};
3378
3479/* * Covariance estimation methods for an ICP result.
@@ -40,3 +85,10 @@ mrpt::math::CMatrixDouble66 covariance(
4085 const CovarianceParameters& p);
4186
4287} // namespace mp2p_icp
88+
89+ MRPT_ENUM_TYPE_BEGIN_NAMESPACE (mp2p_icp, mp2p_icp::CovarianceParameters::Method)
90+ MRPT_FILL_ENUM(CovarianceParameters::Method::InverseHessian);
91+ MRPT_FILL_ENUM_CUSTOM_NAME (CovarianceParameters::Method::InverseHessian, " InverseHessian" );
92+ MRPT_FILL_ENUM (CovarianceParameters::Method::Censi3D);
93+ MRPT_FILL_ENUM_CUSTOM_NAME (CovarianceParameters::Method::Censi3D, " Censi3D" );
94+ MRPT_ENUM_TYPE_END ()
0 commit comments