class mrpt::slam::CICP

Python API: mrpt.slam.CICP

Overview

Several implementations of ICP (Iterative closest point) algorithms for aligning two point maps or a point map wrt a grid map.

CICP::AlignPDF() or CICP::Align() are the two main entry points of the algorithm.

To choose among existing ICP algorithms or customizing their parameters, see CICP::TConfigParams and the member options.

There exists an extension of the original ICP algorithm that provides multihypotheses-support for the correspondences, and which generates a Sum-of-Gaussians (SOG) PDF as output. See mrpt::tfest::se2_l2_robust()

For further details on the implemented methods, check the web: https://www.mrpt.org/Iterative_Closest_Point_(ICP)_and_other_matching_algorithms

For a paper explaining some of the basic equations, see for example: J. Martinez, J. Gonzalez, J. Morales, A. Mandow, A. Garcia-Cerezo, “Mobile robot motion estimation by 2D scan matching with genetic and iterative closest point algorithms”, Journal of Field Robotics, vol. 23, no. 1, pp. 21-34, 2006. (http://babel.isa.uma.es/~jlblanco/papers/martinez2006gil.pdf)

3-D ICP : Only the icpClassic variant is implemented for 3-D point-cloud alignment (see Align3DPDF()). For production-quality, feature-rich 3-D ICP with support for different point-to-plane and point-to-line metrics, robust kernels, and multi-layer maps, use the independent mp2p_icp library (https://github.com/MOLAorg/mp2p_icp) which is the recommended replacement for 3-D scan matching in MRPT 3.

See also:

CMetricMapsAlignmentAlgorithm

#include <mrpt/slam/CICP.h>

class CICP: public mrpt::slam::CMetricMapsAlignmentAlgorithm
{
public:
    // structs

    struct TReturnInfo;

    // classes

    class TConfigParams;

    // fields

    TConfigParams options;

    // construction

    CICP();
    CICP(const TConfigParams& icpParams);

    // methods

    virtual mrpt::poses::CPosePDF::Ptr AlignPDF(
        const mrpt::maps::CMetricMap* m1,
        const mrpt::maps::CMetricMap* m2,
        const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
        mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt
        );

    virtual mrpt::poses::CPose3DPDF::Ptr Align3DPDF(
        const mrpt::maps::CMetricMap* m1,
        const mrpt::maps::CMetricMap* m2,
        const mrpt::poses::CPose3DPDFGaussian& initialEstimationPDF,
        mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt
        );
};

Inherited Members

public:
    // structs

    struct TMsg;

    // fields

    bool logging_enable_console_output {true};
    bool logging_enable_keep_record {false};

    // methods

    void logStr(const VerbosityLevel level, std::string_view msg_str) const;
    void logFmt(const VerbosityLevel level, const char* fmt, ...) const;
    void void logCond(const VerbosityLevel level, bool cond, const std::string& msg_str) const;
    void setLoggerName(const std::string& name);
    std::string getLoggerName() const;
    void setVerbosityLevel(const VerbosityLevel level);
    void setVerbosityLevelForCallbacks(const VerbosityLevel level);
    void setMinLoggingLevel(const VerbosityLevel level);
    VerbosityLevel getMinLoggingLevel() const;
    VerbosityLevel getMinLoggingLevelForCallbacks() const;
    bool isLoggingLevelVisible(VerbosityLevel level) const;
    void getLogAsString(std::string& log_contents) const;
    std::string getLogAsString() const;
    void writeLogToFile(const std::optional<std::string>& fname_in = std::nullopt) const;
    void dumpLogToConsole() const;
    std::string getLoggerLastMsg() const;
    void getLoggerLastMsg(std::string& msg_str) const;
    void loggerReset();
    void logRegisterCallback(output_logger_callback_t userFunc);
    bool logDeregisterCallback(output_logger_callback_t userFunc);
    COutputLogger& operator = (const COutputLogger&);
    COutputLogger& operator = (COutputLogger&&);
    static std::array<mrpt::system::ConsoleForegroundColor, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_colors();
    static const std::array<const char*, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_names();
    mrpt::poses::CPosePDF::Ptr Align(const mrpt::maps::CMetricMap* m1, const mrpt::maps::CMetricMap* m2, const mrpt::poses::CPose2D& grossEst, mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt);

    virtual mrpt::poses::CPosePDF::Ptr AlignPDF(
        const mrpt::maps::CMetricMap* m1,
        const mrpt::maps::CMetricMap* m2,
        const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
        mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt
        ) = 0;

    mrpt::poses::CPose3DPDF::Ptr Align3D(const mrpt::maps::CMetricMap* m1, const mrpt::maps::CMetricMap* m2, const mrpt::poses::CPose3D& grossEst, mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt);

    virtual mrpt::poses::CPose3DPDF::Ptr Align3DPDF(
        const mrpt::maps::CMetricMap* m1,
        const mrpt::maps::CMetricMap* m2,
        const mrpt::poses::CPose3DPDFGaussian& initialEstimationPDF,
        mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt
        ) = 0;

Fields

TConfigParams options

The options employed by the ICP align.

Construction

CICP()

Constructor with the default options.

CICP(const TConfigParams& icpParams)

Constructor that directly set the ICP params from a given struct.

See also:

options

Methods

virtual mrpt::poses::CPosePDF::Ptr AlignPDF(
    const mrpt::maps::CMetricMap* m1,
    const mrpt::maps::CMetricMap* m2,
    const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
    mrpt::optional_ref<TMetricMapAlignmentResult> outInfo = std::nullopt
    )

See base method docs.

This class offers an implementation for the case of “m1” being a point map and “m2” either an occupancy grid or a point map.

This method can be configurated with “CICP::options”

The output PDF is a CPosePDFGaussian if “doRANSAC=false”, or a CPosePDFSOG otherwise.

See also:

CMetricMapsAlignmentAlgorithm, CICP::options, CICP::TReturnInfo