class mola::KeyframePointCloudMap::KeyFrame

Overview

Key-frame data

class KeyFrame
{
public:
    // fields

    mrpt::Clock::time_point timestamp;

    // construction

    KeyFrame(
        std::size_t k_correspondences_for_cov,
        std::size_t min_correspondences_for_cov,
        double max_distance_for_cov
        );

    KeyFrame(const KeyFrame& other);
    KeyFrame(KeyFrame&&);

    // methods

    KeyFrame& operator = (const KeyFrame& other);
    KeyFrame& operator = (KeyFrame&&);
    void pointcloud(const mrpt::maps::CPointsMap::Ptr& pc);
    const mrpt::maps::CPointsMap::Ptr& pointcloud() const;
    const mrpt::maps::CPointsMap::Ptr& pointcloud_global() const;
    void pose(const mrpt::poses::CPose3D& pose);
    const mrpt::poses::CPose3D& pose() const;
    mrpt::math::TBoundingBoxf localBoundingBox() const;
    void buildCache() const;
    void invalidateCache();

    void updateCovarianceParams(
        std::size_t k_correspondences_for_cov,
        std::size_t min_correspondences_for_cov,
        double max_distance_for_cov
        );

    const auto& covariancesGlobal() const;
    const std::vector<mrpt::math::CMatrixFloat33>& covariancesLocal() const;
    void installCovariancesLocal(std::vector<mrpt::math::CMatrixFloat33>&& covs) const;

    std::shared_ptr<mrpt::opengl::CPointCloudColoured> getViz(
        const TRenderOptions& ro,
        const std::optional<mrpt::img::TColor>& overrideColor = std::nullopt
        ) const;

    std::shared_ptr<mrpt::opengl::CSetOfObjects> getCovarianceEllipsoidViz(const TRenderOptions& ro) const;
};

Fields

mrpt::Clock::time_point timestamp

Timestamp of the key-frame (from observation)

Methods

void pointcloud(const mrpt::maps::CPointsMap::Ptr& pc)

Local metric map for this key-frame. Points are already transformed from the sensor frame to the vehicle (“base_link”) frame.

void pose(const mrpt::poses::CPose3D& pose)

Sets the pose of the key-frame in the map reference frame.

const mrpt::poses::CPose3D& pose() const

Gets the pose of the key-frame in the map reference frame.

void buildCache() const

Ensures the bbox, the kd-tree, and the covariances are built.

void updateCovarianceParams(
    std::size_t k_correspondences_for_cov,
    std::size_t min_correspondences_for_cov,
    double max_distance_for_cov
    )

Updates the per-point covariance estimation parameters (normally frozen at construction time from TCreationOptions) and invalidates any cached covariance, so it gets recomputed with the new parameters next time it is queried.

const std::vector<mrpt::math::CMatrixFloat33>& covariancesLocal() const

Ensures the per-point local-frame covariances are computed and returns them. Used to bake them into the serialized map (see TCreationOptions::serialize_covariances).

void installCovariancesLocal(std::vector<mrpt::math::CMatrixFloat33>&& covs) const

Installs precomputed per-point local-frame covariances loaded from a baked .mm, so computeCovariancesAndDensity() becomes a no-op (it early-returns when cached_cov_local_.size() == pointcloud size). The global-frame rotation is invalidated so it is recomputed for the current pose. No-op (covariances left to be computed lazily) if covs does not match the current point count. Must be called after pointcloud(), which clears all caches.

std::shared_ptr<mrpt::opengl::CPointCloudColoured> getViz(
    const TRenderOptions& ro,
    const std::optional<mrpt::img::TColor>& overrideColor = std::nullopt
    ) const

Builds (or get cached) visualization of the cloud in this KF, already transformed to its global pose.

If overrideColor is set, ALL points are painted that single color instead of the normal per-field colormap, and the result is NOT cached (used by the per-keyframe debug coloring, see MOLA_KEYFRAME_MAP_VIZ_COLOR_BY_KF).