From 72e2c94e4a0a8a4f3da3e0f981c92f8b70e0423e Mon Sep 17 00:00:00 2001 From: "Ilya A. Kriveshko" Date: Fri, 23 Aug 2024 15:46:36 +0000 Subject: [PATCH 1/2] Add G2O_REGISTER_TYPE_NAME macro The new macro takes name as a char literal (or any other string_view-compatible type), and verifies that no white space characters are present in the name. This prevents clang-format from introducing white space into the type names. --- g2o/core/factory.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/g2o/core/factory.h b/g2o/core/factory.h index d7b48f22c..bdf7bd2e0 100644 --- a/g2o/core/factory.h +++ b/g2o/core/factory.h @@ -145,9 +145,17 @@ class RegisterTypeProxy { #endif // These macros are used to automate registering types and forcing linkage -#define G2O_REGISTER_TYPE(name, classname) \ - extern "C" void G2O_FACTORY_EXPORT g2o_type_##classname(void) {} \ - static g2o::RegisterTypeProxy g_type_proxy_##classname(#name); +#define G2O_REGISTER_TYPE_NAME(name, classname) \ + static_assert(std::string_view(name).find_first_of(" \f\n\r\t\v") == \ + std::string_view::npos, \ + "name contains whitespace"); \ + extern "C" void G2O_FACTORY_EXPORT g2o_type_##classname(void) {} \ + static g2o::RegisterTypeProxy g_type_proxy_##classname(name); + +// This form is deprecated, because it lets clang-format introduce whitespace +// into the type name. Kept for backward compatibility. +#define G2O_REGISTER_TYPE(name, classname) \ + G2O_REGISTER_TYPE_NAME(#name, classname) #define G2O_USE_TYPE_BY_CLASS_NAME(classname) \ extern "C" void G2O_FACTORY_IMPORT g2o_type_##classname(void); \ From 18d9a72d59f273c95460800ec88ae99918791015 Mon Sep 17 00:00:00 2001 From: "Ilya A. Kriveshko" Date: Mon, 26 Aug 2024 16:24:51 +0000 Subject: [PATCH 2/2] Switch to using G2O_REGISTER_TYPE_NAME macro Use G2O_REGISTER_TYPE_NAME throughout g2o code, replacing the use of the deprecated G2O_REGISTER_TYPE macro. Remove // clang-format off annotations that were guarding type declarations. Apply clang-format to affected sources to wrap long lines at 80 columns. --- doc/g2o.tex | 4 +- .../g2o_interactive/types_online.cpp | 11 ++---- .../tutorial_slam2d/types_tutorial_slam2d.cpp | 12 +++--- g2o/types/data/types_data.cpp | 6 +-- g2o/types/icp/types_icp.cpp | 2 +- g2o/types/sba/types_sba.cpp | 12 +++--- g2o/types/sba/types_six_dof_expmap.cpp | 23 ++++++------ g2o/types/sclam2d/types_sclam2d.cpp | 9 +++-- g2o/types/sim3/types_seven_dof_expmap.cpp | 11 +++--- g2o/types/slam2d/types_slam2d.cpp | 32 ++++++++-------- .../slam2d_addons/types_slam2d_addons.cpp | 19 +++++----- g2o/types/slam3d/types_slam3d.cpp | 37 +++++++++---------- .../slam3d_addons/types_slam3d_addons.cpp | 16 ++++---- 13 files changed, 95 insertions(+), 99 deletions(-) diff --git a/doc/g2o.tex b/doc/g2o.tex index 0f43121b3..5cb40a104 100644 --- a/doc/g2o.tex +++ b/doc/g2o.tex @@ -646,8 +646,8 @@ \section{Library Overview} namespace g2o { G2O_REGISTER_TYPE_GROUP(slam2d); - G2O_REGISTER_TYPE(VERTEX_SE2, VertexSE2); - G2O_REGISTER_TYPE(VERTEX_XY, VertexPointXY); + G2O_REGISTER_TYPE_NAME("VERTEX_SE2", VertexSE2); + G2O_REGISTER_TYPE_NAME("VERTEX_XY", VertexPointXY); // ... } diff --git a/g2o/examples/interactive_slam/g2o_interactive/types_online.cpp b/g2o/examples/interactive_slam/g2o_interactive/types_online.cpp index 472846fc1..62bbdcb28 100644 --- a/g2o/examples/interactive_slam/g2o_interactive/types_online.cpp +++ b/g2o/examples/interactive_slam/g2o_interactive/types_online.cpp @@ -32,13 +32,10 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(online); -G2O_REGISTER_TYPE(ONLINE_EDGE_SE2, OnlineEdgeSE2); -G2O_REGISTER_TYPE(ONLINE_VERTEX_SE2, OnlineVertexSE2); +G2O_REGISTER_TYPE_NAME("ONLINE_EDGE_SE2", OnlineEdgeSE2); +G2O_REGISTER_TYPE_NAME("ONLINE_VERTEX_SE2", OnlineVertexSE2); -// clang-format off -// otherwise it will result in non-working "ONLINE_VERTEX_SE3 : QUAT" -G2O_REGISTER_TYPE(ONLINE_VERTEX_SE3:QUAT, OnlineVertexSE3); -G2O_REGISTER_TYPE(ONLINE_EDGE_SE3:QUAT, OnlineEdgeSE3); -// clang-format on +G2O_REGISTER_TYPE_NAME("ONLINE_VERTEX_SE3:QUAT", OnlineVertexSE3); +G2O_REGISTER_TYPE_NAME("ONLINE_EDGE_SE3:QUAT", OnlineEdgeSE3); } // namespace g2o diff --git a/g2o/examples/tutorial_slam2d/types_tutorial_slam2d.cpp b/g2o/examples/tutorial_slam2d/types_tutorial_slam2d.cpp index 51abf4a24..75f6c3fb8 100644 --- a/g2o/examples/tutorial_slam2d/types_tutorial_slam2d.cpp +++ b/g2o/examples/tutorial_slam2d/types_tutorial_slam2d.cpp @@ -36,14 +36,14 @@ namespace tutorial { G2O_REGISTER_TYPE_GROUP(tutorial_slam2d); -G2O_REGISTER_TYPE(TUTORIAL_VERTEX_SE2, VertexSE2); -G2O_REGISTER_TYPE(TUTORIAL_VERTEX_POINT_XY, VertexPointXY); +G2O_REGISTER_TYPE_NAME("TUTORIAL_VERTEX_SE2", VertexSE2); +G2O_REGISTER_TYPE_NAME("TUTORIAL_VERTEX_POINT_XY", VertexPointXY); -G2O_REGISTER_TYPE(TUTORIAL_PARAMS_SE2_OFFSET, ParameterSE2Offset); +G2O_REGISTER_TYPE_NAME("TUTORIAL_PARAMS_SE2_OFFSET", ParameterSE2Offset); -G2O_REGISTER_TYPE(TUTORIAL_CACHE_SE2_OFFSET, CacheSE2Offset); +G2O_REGISTER_TYPE_NAME("TUTORIAL_CACHE_SE2_OFFSET", CacheSE2Offset); -G2O_REGISTER_TYPE(TUTORIAL_EDGE_SE2, EdgeSE2); -G2O_REGISTER_TYPE(TUTORIAL_EDGE_SE2_POINT_XY, EdgeSE2PointXY); +G2O_REGISTER_TYPE_NAME("TUTORIAL_EDGE_SE2", EdgeSE2); +G2O_REGISTER_TYPE_NAME("TUTORIAL_EDGE_SE2_POINT_XY", EdgeSE2PointXY); } // namespace tutorial } // namespace g2o diff --git a/g2o/types/data/types_data.cpp b/g2o/types/data/types_data.cpp index f3e908ee5..918e40b8a 100644 --- a/g2o/types/data/types_data.cpp +++ b/g2o/types/data/types_data.cpp @@ -36,9 +36,9 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(data); -G2O_REGISTER_TYPE(VERTEX_TAG, VertexTag); -G2O_REGISTER_TYPE(ROBOTLASER1, RobotLaser); -G2O_REGISTER_TYPE(VERTEX_ELLIPSE, VertexEllipse); +G2O_REGISTER_TYPE_NAME("VERTEX_TAG", VertexTag); +G2O_REGISTER_TYPE_NAME("ROBOTLASER1", RobotLaser); +G2O_REGISTER_TYPE_NAME("VERTEX_ELLIPSE", VertexEllipse); #ifdef G2O_HAVE_OPENGL G2O_REGISTER_ACTION(RobotLaserDrawAction); diff --git a/g2o/types/icp/types_icp.cpp b/g2o/types/icp/types_icp.cpp index c84ac1632..f0424b24f 100644 --- a/g2o/types/icp/types_icp.cpp +++ b/g2o/types/icp/types_icp.cpp @@ -36,7 +36,7 @@ using namespace Eigen; namespace g2o { G2O_REGISTER_TYPE_GROUP(icp); -G2O_REGISTER_TYPE(EDGE_V_V_GICP, Edge_V_V_GICP); +G2O_REGISTER_TYPE_NAME("EDGE_V_V_GICP", Edge_V_V_GICP); namespace types_icp { int initialized = 0; diff --git a/g2o/types/sba/types_sba.cpp b/g2o/types/sba/types_sba.cpp index cf69371ae..4582bfb3a 100644 --- a/g2o/types/sba/types_sba.cpp +++ b/g2o/types/sba/types_sba.cpp @@ -37,12 +37,12 @@ using namespace std; G2O_REGISTER_TYPE_GROUP(sba); -G2O_REGISTER_TYPE(VERTEX_CAM, VertexCam); -G2O_REGISTER_TYPE(VERTEX_INTRINSICS, VertexIntrinsics); +G2O_REGISTER_TYPE_NAME("VERTEX_CAM", VertexCam); +G2O_REGISTER_TYPE_NAME("VERTEX_INTRINSICS", VertexIntrinsics); -G2O_REGISTER_TYPE(EDGE_PROJECT_P2MC, EdgeProjectP2MC); -G2O_REGISTER_TYPE(EDGE_PROJECT_P2SC, EdgeProjectP2SC); -G2O_REGISTER_TYPE(EDGE_CAM, EdgeSBACam); -G2O_REGISTER_TYPE(EDGE_SCALE, EdgeSBAScale); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_P2MC", EdgeProjectP2MC); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_P2SC", EdgeProjectP2SC); +G2O_REGISTER_TYPE_NAME("EDGE_CAM", EdgeSBACam); +G2O_REGISTER_TYPE_NAME("EDGE_SCALE", EdgeSBAScale); } // namespace g2o diff --git a/g2o/types/sba/types_six_dof_expmap.cpp b/g2o/types/sba/types_six_dof_expmap.cpp index 476f8334c..859f50a8f 100644 --- a/g2o/types/sba/types_six_dof_expmap.cpp +++ b/g2o/types/sba/types_six_dof_expmap.cpp @@ -30,17 +30,18 @@ namespace g2o { -// clang-format off G2O_REGISTER_TYPE_GROUP(expmap); -G2O_REGISTER_TYPE(VERTEX_SE3:EXPMAP, VertexSE3Expmap); -G2O_REGISTER_TYPE(EDGE_SE3:EXPMAP, EdgeSE3Expmap); -G2O_REGISTER_TYPE(EDGE_PROJECT_XYZ2UV:EXPMAP, EdgeProjectXYZ2UV); -G2O_REGISTER_TYPE(EDGE_PROJECT_XYZ2UVU:EXPMAP, EdgeProjectXYZ2UVU); -G2O_REGISTER_TYPE(EDGE_SE3_PROJECT_XYZ:EXPMAP, EdgeSE3ProjectXYZ); -G2O_REGISTER_TYPE(EDGE_SE3_PROJECT_XYZONLYPOSE:EXPMAP, EdgeSE3ProjectXYZOnlyPose); -G2O_REGISTER_TYPE(EDGE_STEREO_SE3_PROJECT_XYZ:EXPMAP, EdgeStereoSE3ProjectXYZ); -G2O_REGISTER_TYPE(EDGE_STEREO_SE3_PROJECT_XYZONLYPOSE:EXPMAP, EdgeStereoSE3ProjectXYZOnlyPose); -G2O_REGISTER_TYPE(PARAMS_CAMERAPARAMETERS, CameraParameters); -// clang-format on +G2O_REGISTER_TYPE_NAME("VERTEX_SE3:EXPMAP", VertexSE3Expmap); +G2O_REGISTER_TYPE_NAME("EDGE_SE3:EXPMAP", EdgeSE3Expmap); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_XYZ2UV:EXPMAP", EdgeProjectXYZ2UV); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_XYZ2UVU:EXPMAP", EdgeProjectXYZ2UVU); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_PROJECT_XYZ:EXPMAP", EdgeSE3ProjectXYZ); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_PROJECT_XYZONLYPOSE:EXPMAP", + EdgeSE3ProjectXYZOnlyPose); +G2O_REGISTER_TYPE_NAME("EDGE_STEREO_SE3_PROJECT_XYZ:EXPMAP", + EdgeStereoSE3ProjectXYZ); +G2O_REGISTER_TYPE_NAME("EDGE_STEREO_SE3_PROJECT_XYZONLYPOSE:EXPMAP", + EdgeStereoSE3ProjectXYZOnlyPose); +G2O_REGISTER_TYPE_NAME("PARAMS_CAMERAPARAMETERS", CameraParameters); } // namespace g2o diff --git a/g2o/types/sclam2d/types_sclam2d.cpp b/g2o/types/sclam2d/types_sclam2d.cpp index e0527e2d8..2c791e34c 100644 --- a/g2o/types/sclam2d/types_sclam2d.cpp +++ b/g2o/types/sclam2d/types_sclam2d.cpp @@ -36,10 +36,11 @@ namespace g2o { G2O_USE_TYPE_GROUP(slam2d); G2O_REGISTER_TYPE_GROUP(sclam); -G2O_REGISTER_TYPE(VERTEX_ODOM_DIFFERENTIAL, VertexOdomDifferentialParams); -G2O_REGISTER_TYPE(EDGE_SE2_CALIB, EdgeSE2SensorCalib); -G2O_REGISTER_TYPE(EDGE_SE2_ODOM_DIFFERENTIAL_CALIB, - EdgeSE2OdomDifferentialCalib); +G2O_REGISTER_TYPE_NAME("VERTEX_ODOM_DIFFERENTIAL", + VertexOdomDifferentialParams); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_CALIB", EdgeSE2SensorCalib); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_ODOM_DIFFERENTIAL_CALIB", + EdgeSE2OdomDifferentialCalib); #ifdef G2O_HAVE_OPENGL G2O_REGISTER_ACTION(EdgeSE2SensorCalibDrawAction); diff --git a/g2o/types/sim3/types_seven_dof_expmap.cpp b/g2o/types/sim3/types_seven_dof_expmap.cpp index 621958fef..ad2ef8e90 100644 --- a/g2o/types/sim3/types_seven_dof_expmap.cpp +++ b/g2o/types/sim3/types_seven_dof_expmap.cpp @@ -34,12 +34,11 @@ namespace g2o { G2O_USE_TYPE_GROUP(sba); G2O_REGISTER_TYPE_GROUP(sim3); -// clang-format off -G2O_REGISTER_TYPE(VERTEX_SIM3:EXPMAP, VertexSim3Expmap); -G2O_REGISTER_TYPE(EDGE_SIM3:EXPMAP, EdgeSim3); -G2O_REGISTER_TYPE(EDGE_PROJECT_SIM3_XYZ:EXPMAP, EdgeSim3ProjectXYZ); -G2O_REGISTER_TYPE(EDGE_PROJECT_INVERSE_SIM3_XYZ:EXPMAP, EdgeInverseSim3ProjectXYZ); -// clang-format on +G2O_REGISTER_TYPE_NAME("VERTEX_SIM3:EXPMAP", VertexSim3Expmap); +G2O_REGISTER_TYPE_NAME("EDGE_SIM3:EXPMAP", EdgeSim3); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_SIM3_XYZ:EXPMAP", EdgeSim3ProjectXYZ); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_INVERSE_SIM3_XYZ:EXPMAP", + EdgeInverseSim3ProjectXYZ); VertexSim3Expmap::VertexSim3Expmap() : BaseVertex<7, Sim3>() { _marginalized = false; diff --git a/g2o/types/slam2d/types_slam2d.cpp b/g2o/types/slam2d/types_slam2d.cpp index 532f5bd42..b09c64dfd 100644 --- a/g2o/types/slam2d/types_slam2d.cpp +++ b/g2o/types/slam2d/types_slam2d.cpp @@ -35,22 +35,22 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(slam2d); -G2O_REGISTER_TYPE(VERTEX_SE2, VertexSE2); -G2O_REGISTER_TYPE(VERTEX_XY, VertexPointXY); -G2O_REGISTER_TYPE(PARAMS_SE2OFFSET, ParameterSE2Offset); -G2O_REGISTER_TYPE(CACHE_SE2_OFFSET, CacheSE2Offset); -G2O_REGISTER_TYPE(EDGE_PRIOR_SE2, EdgeSE2Prior); -G2O_REGISTER_TYPE(EDGE_PRIOR_SE2_XY, EdgeSE2XYPrior); -G2O_REGISTER_TYPE(EDGE_SE2, EdgeSE2); -G2O_REGISTER_TYPE(EDGE_SE2_XY, EdgeSE2PointXY); -G2O_REGISTER_TYPE(EDGE_BEARING_SE2_XY, EdgeSE2PointXYBearing); -G2O_REGISTER_TYPE(EDGE_SE2_XY_CALIB, EdgeSE2PointXYCalib); -G2O_REGISTER_TYPE(EDGE_SE2_OFFSET, EdgeSE2Offset); -G2O_REGISTER_TYPE(EDGE_SE2_POINTXY_OFFSET, EdgeSE2PointXYOffset); -G2O_REGISTER_TYPE(EDGE_POINTXY, EdgePointXY); -G2O_REGISTER_TYPE(EDGE_SE2_TWOPOINTSXY, EdgeSE2TwoPointsXY); -G2O_REGISTER_TYPE(EDGE_SE2_LOTSOFXY, EdgeSE2LotsOfXY); -G2O_REGISTER_TYPE(EDGE_PRIOR_XY, EdgeXYPrior); +G2O_REGISTER_TYPE_NAME("VERTEX_SE2", VertexSE2); +G2O_REGISTER_TYPE_NAME("VERTEX_XY", VertexPointXY); +G2O_REGISTER_TYPE_NAME("PARAMS_SE2OFFSET", ParameterSE2Offset); +G2O_REGISTER_TYPE_NAME("CACHE_SE2_OFFSET", CacheSE2Offset); +G2O_REGISTER_TYPE_NAME("EDGE_PRIOR_SE2", EdgeSE2Prior); +G2O_REGISTER_TYPE_NAME("EDGE_PRIOR_SE2_XY", EdgeSE2XYPrior); +G2O_REGISTER_TYPE_NAME("EDGE_SE2", EdgeSE2); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_XY", EdgeSE2PointXY); +G2O_REGISTER_TYPE_NAME("EDGE_BEARING_SE2_XY", EdgeSE2PointXYBearing); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_XY_CALIB", EdgeSE2PointXYCalib); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_OFFSET", EdgeSE2Offset); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_POINTXY_OFFSET", EdgeSE2PointXYOffset); +G2O_REGISTER_TYPE_NAME("EDGE_POINTXY", EdgePointXY); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_TWOPOINTSXY", EdgeSE2TwoPointsXY); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_LOTSOFXY", EdgeSE2LotsOfXY); +G2O_REGISTER_TYPE_NAME("EDGE_PRIOR_XY", EdgeXYPrior); G2O_REGISTER_ACTION(VertexSE2WriteGnuplotAction); G2O_REGISTER_ACTION(VertexPointXYWriteGnuplotAction); diff --git a/g2o/types/slam2d_addons/types_slam2d_addons.cpp b/g2o/types/slam2d_addons/types_slam2d_addons.cpp index 293181b1d..571f7e3f3 100644 --- a/g2o/types/slam2d_addons/types_slam2d_addons.cpp +++ b/g2o/types/slam2d_addons/types_slam2d_addons.cpp @@ -35,15 +35,16 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(slam2d_segment); -G2O_REGISTER_TYPE(VERTEX_SEGMENT2D, VertexSegment2D); -G2O_REGISTER_TYPE(VERTEX_LINE2D, VertexLine2D); - -G2O_REGISTER_TYPE(EDGE_SE2_SEGMENT2D, EdgeSE2Segment2D); -G2O_REGISTER_TYPE(EDGE_SE2_SEGMENT2D_LINE, EdgeSE2Segment2DLine); -G2O_REGISTER_TYPE(EDGE_SE2_SEGMENT2D_POINTLINE, EdgeSE2Segment2DPointLine); -G2O_REGISTER_TYPE(EDGE_SE2_LINE2D, EdgeSE2Line2D); -G2O_REGISTER_TYPE(EDGE_LINE2D, EdgeLine2D); -G2O_REGISTER_TYPE(EDGE_LINE2D_POINTXY, EdgeLine2DPointXY); +G2O_REGISTER_TYPE_NAME("VERTEX_SEGMENT2D", VertexSegment2D); +G2O_REGISTER_TYPE_NAME("VERTEX_LINE2D", VertexLine2D); + +G2O_REGISTER_TYPE_NAME("EDGE_SE2_SEGMENT2D", EdgeSE2Segment2D); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_SEGMENT2D_LINE", EdgeSE2Segment2DLine); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_SEGMENT2D_POINTLINE", + EdgeSE2Segment2DPointLine); +G2O_REGISTER_TYPE_NAME("EDGE_SE2_LINE2D", EdgeSE2Line2D); +G2O_REGISTER_TYPE_NAME("EDGE_LINE2D", EdgeLine2D); +G2O_REGISTER_TYPE_NAME("EDGE_LINE2D_POINTXY", EdgeLine2DPointXY); #ifdef G2O_HAVE_OPENGL G2O_REGISTER_ACTION(VertexSegment2DDrawAction); diff --git a/g2o/types/slam3d/types_slam3d.cpp b/g2o/types/slam3d/types_slam3d.cpp index 246c0f756..d1a387faa 100644 --- a/g2o/types/slam3d/types_slam3d.cpp +++ b/g2o/types/slam3d/types_slam3d.cpp @@ -35,30 +35,27 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(slam3d); -// clang-format off -// otherwise it will result in non-working "VERTEX_SE3 : QUAT" -G2O_REGISTER_TYPE(VERTEX_SE3:QUAT, VertexSE3); -G2O_REGISTER_TYPE(EDGE_SE3:QUAT, EdgeSE3); -// clang-format on -G2O_REGISTER_TYPE(VERTEX_TRACKXYZ, VertexPointXYZ); +G2O_REGISTER_TYPE_NAME("VERTEX_SE3:QUAT", VertexSE3); +G2O_REGISTER_TYPE_NAME("EDGE_SE3:QUAT", EdgeSE3); +G2O_REGISTER_TYPE_NAME("VERTEX_TRACKXYZ", VertexPointXYZ); -G2O_REGISTER_TYPE(PARAMS_SE3OFFSET, ParameterSE3Offset); -G2O_REGISTER_TYPE(EDGE_SE3_TRACKXYZ, EdgeSE3PointXYZ); -G2O_REGISTER_TYPE(EDGE_SE3_PRIOR, EdgeSE3Prior); -G2O_REGISTER_TYPE(EDGE_SE3_XYZ_PRIOR, EdgeSE3XYZPrior); -G2O_REGISTER_TYPE(CACHE_SE3_OFFSET, CacheSE3Offset); -G2O_REGISTER_TYPE(EDGE_SE3_OFFSET, EdgeSE3Offset); +G2O_REGISTER_TYPE_NAME("PARAMS_SE3OFFSET", ParameterSE3Offset); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_TRACKXYZ", EdgeSE3PointXYZ); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_PRIOR", EdgeSE3Prior); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_XYZ_PRIOR", EdgeSE3XYZPrior); +G2O_REGISTER_TYPE_NAME("CACHE_SE3_OFFSET", CacheSE3Offset); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_OFFSET", EdgeSE3Offset); -G2O_REGISTER_TYPE(PARAMS_CAMERACALIB, ParameterCamera); -G2O_REGISTER_TYPE(PARAMS_STEREOCAMERACALIB, ParameterStereoCamera); -G2O_REGISTER_TYPE(CACHE_CAMERA, CacheCamera); -G2O_REGISTER_TYPE(EDGE_PROJECT_DISPARITY, EdgeSE3PointXYZDisparity); -G2O_REGISTER_TYPE(EDGE_PROJECT_DEPTH, EdgeSE3PointXYZDepth); +G2O_REGISTER_TYPE_NAME("PARAMS_CAMERACALIB", ParameterCamera); +G2O_REGISTER_TYPE_NAME("PARAMS_STEREOCAMERACALIB", ParameterStereoCamera); +G2O_REGISTER_TYPE_NAME("CACHE_CAMERA", CacheCamera); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_DISPARITY", EdgeSE3PointXYZDisparity); +G2O_REGISTER_TYPE_NAME("EDGE_PROJECT_DEPTH", EdgeSE3PointXYZDepth); -G2O_REGISTER_TYPE(EDGE_POINTXYZ, EdgePointXYZ); -G2O_REGISTER_TYPE(EDGE_POINTXYZ_PRIOR, EdgeXYZPrior); +G2O_REGISTER_TYPE_NAME("EDGE_POINTXYZ", EdgePointXYZ); +G2O_REGISTER_TYPE_NAME("EDGE_POINTXYZ_PRIOR", EdgeXYZPrior); -G2O_REGISTER_TYPE(EDGE_SE3_LOTSOF_XYZ, EdgeSE3LotsOfXYZ) +G2O_REGISTER_TYPE_NAME("EDGE_SE3_LOTSOF_XYZ", EdgeSE3LotsOfXYZ) /*********** ACTIONS ************/ G2O_REGISTER_ACTION(VertexSE3WriteGnuplotAction); diff --git a/g2o/types/slam3d_addons/types_slam3d_addons.cpp b/g2o/types/slam3d_addons/types_slam3d_addons.cpp index 3205c4470..ab35ddd48 100644 --- a/g2o/types/slam3d_addons/types_slam3d_addons.cpp +++ b/g2o/types/slam3d_addons/types_slam3d_addons.cpp @@ -36,15 +36,15 @@ namespace g2o { G2O_REGISTER_TYPE_GROUP(slam3d_addons); -G2O_REGISTER_TYPE(VERTEX3, VertexSE3Euler); -G2O_REGISTER_TYPE(EDGE3, EdgeSE3Euler); -G2O_REGISTER_TYPE(VERTEX_PLANE, VertexPlane); -G2O_REGISTER_TYPE(EDGE_SE3_PLANE_CALIB, EdgeSE3PlaneSensorCalib); +G2O_REGISTER_TYPE_NAME("VERTEX3", VertexSE3Euler); +G2O_REGISTER_TYPE_NAME("EDGE3", EdgeSE3Euler); +G2O_REGISTER_TYPE_NAME("VERTEX_PLANE", VertexPlane); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_PLANE_CALIB", EdgeSE3PlaneSensorCalib); -G2O_REGISTER_TYPE(VERTEX_LINE3D, VertexLine3D); -G2O_REGISTER_TYPE(EDGE_SE3_LINE3D, EdgeSE3Line3D); -G2O_REGISTER_TYPE(EDGE_PLANE, EdgePlane); -G2O_REGISTER_TYPE(EDGE_SE3_CALIB, EdgeSE3Calib); +G2O_REGISTER_TYPE_NAME("VERTEX_LINE3D", VertexLine3D); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_LINE3D", EdgeSE3Line3D); +G2O_REGISTER_TYPE_NAME("EDGE_PLANE", EdgePlane); +G2O_REGISTER_TYPE_NAME("EDGE_SE3_CALIB", EdgeSE3Calib); #ifdef G2O_HAVE_OPENGL G2O_REGISTER_ACTION(CacheCameraDrawAction);