class mola::LidarOdometry

Overview

LIDAR-inertial odometry based on ICP against a local metric map model.

#include <LidarOdometry.h>

class LidarOdometry:
    public mola::FrontEndBase,
    public mola::LocalizationSourceBase,
    public mola::MapSourceBase,
    public mola::MapServer,
    public mola::Relocalization
{
public:
    // enums

    enum AlignKind;
    enum InitLocalization;

    // structs

    struct ICP_Input;
    struct ICP_Output;
    struct MethodState;
    struct Parameters;
    struct StateUI;

    // fields

    Parameters params_;

    // methods

    virtual void initialize_frontend(const Yaml& cfg);
    virtual void spinOnce();
    virtual void onNewObservation(const CObservation::Ptr& o);
    void reset();
    bool isBusy() const;
    mrpt::poses::CPose3DInterpolator estimatedTrajectory() const;
    std::optional<std::tuple<mrpt::poses::CPose3DPDFGaussian, mrpt::math::TTwist3D>> lastEstimatedState() const;
    mrpt::maps::CSimpleMap reconstructedMap() const;
    void saveEstimatedTrajectoryToFile() const;
    void saveReconstructedMapToFile() const;
    void enqueue_request(const std::function<void()>& userRequest);
    virtual void relocalize_near_pose_pdf(const mrpt::poses::CPose3DPDFGaussian& p);
    virtual void relocalize_from_gnss();
    MapServer::ReturnStatus map_load(const std::string& path);
    MapServer::ReturnStatus map_save(const std::string& path);
    virtual ReturnStatus map_load(] const std::string& path);
    virtual ReturnStatus map_save(] const std::string& path);
};

Inherited Members

public:
    // typedefs

    typedef std::function<void(const LocalizationUpdate&)> localization_updates_callback_t;
    typedef std::function<void(const MapUpdate&)> map_updates_callback_t;

    // structs

    struct LocalizationUpdate;
    struct MapUpdate;
    struct ReturnStatus;

    // methods

    virtual void initialize(const Yaml& cfg) = 0;
    virtual void onNewObservation(const CObservation::Ptr& o) = 0;
    virtual void initialize(const Yaml& cfg);
    void subscribeToLocalizationUpdates(const localization_updates_callback_t& callback);
    void subscribeToMapUpdates(const map_updates_callback_t& callback);
    virtual void relocalize_near_pose_pdf(const mrpt::poses::CPose3DPDFGaussian& p) = 0;
    virtual void relocalize_from_gnss() = 0;

Fields

Parameters params_

Algorithm parameters

Methods

virtual void initialize_frontend(const Yaml& cfg)

Loads children specific parameters

virtual void spinOnce()

Runs any required action on a timely manner

virtual void onNewObservation(const CObservation::Ptr& o)

To be called whenever a new observation arrives. It should return as fast as possible, enqueuing the data for processing in another thread.

void reset()

Re-initializes the odometry system. It effectively calls initialize() once again with the same parameters that were used the first time.

mrpt::poses::CPose3DInterpolator estimatedTrajectory() const

Returns a copy of the estimated trajectory, with timestamps for each lidar observation. Multi-thread safe to call.

std::optional<std::tuple<mrpt::poses::CPose3DPDFGaussian, mrpt::math::TTwist3D>> lastEstimatedState() const

Returns the last estimated kinematic state: pose of the vehicle in the LiDAR odometry frame, and its estimated local (body-frame) twist vector. This method will block if LO is running in another thread, until it is safe to get the data. It will return std::nullopt if pose information is not available yet, e.g. still initializing.

mrpt::maps::CSimpleMap reconstructedMap() const

Returns a copy of the estimated simplemap. Multi-thread safe to call.

void enqueue_request(const std::function<void()>& userRequest)

Enqueue a custom user request to be executed on the main LidarOdometry thread on the next iteration.

So, this method is safe to be called from any other thread.

virtual void relocalize_near_pose_pdf(const mrpt::poses::CPose3DPDFGaussian& p)

Re-localize near this pose, including uncetainty.

Parameters:

pose

The pose, in the local map frame. There is no return value from this method.

virtual void relocalize_from_gnss()

Re-localize with the next incoming GNSS message. There is no return value from this method.

MapServer::ReturnStatus map_load(const std::string& path)

Loads a map from file(s) and sets it as active current map. Different implementations may use one or more files to store map as files.

Parameters:

path

File name(s) prefix for the map to load. Do not add file extension.

MapServer::ReturnStatus map_save(const std::string& path)

Saves a map from file(s) and sets it as active current map. Different implementations may use one or more files to store map as files.

Parameters:

path

File name(s) prefix for the map to save. Do not add file extension.

virtual ReturnStatus map_load(] const std::string& path)

Loads a map from file(s) and sets it as active current map. Different implementations may use one or more files to store map as files.

Parameters:

path

File name(s) prefix for the map to load. Do not add file extension.

virtual ReturnStatus map_save(] const std::string& path)

Saves a map from file(s) and sets it as active current map. Different implementations may use one or more files to store map as files.

Parameters:

path

File name(s) prefix for the map to save. Do not add file extension.