class mola::InitialLevelCheck

Overview

Measures how tilted the map frame is, from the accelerometer and the odometry’s own positions and attitudes over a short window.

An accelerometer average measures gravity only while the platform is still. A steady acceleration tilts it without raising the dispersion of the readings, and a start that is never still leaves no window that measures gravity alone. The odometry knows what the platform’s acceleration was: with the specific force rotated to the map frame by the odometry’s attitude and integrated twice from the first pose, D(t), the positions satisfy

p(t) = p(t0) + v0 (t - t0) + g (t - t0)^2 / 2 + D(t)

whatever the motion. v0 and the gravity vector g are fitted by least squares, independently on each axis. The angle between -g and the map’s +Z is how tilted the map frame is.

A constant accelerometer bias enters an accelerometer average and this fit alike, so on a still platform the two agree exactly: the check measures the motion that leaked into the average, not the bias.

#include <InitialLevelCheck.h>

class InitialLevelCheck
{
public:
    // structs

    struct Reading;
    struct Result;
    struct StampedPose;

    // methods

    void add_specific_force(double t, const mrpt::math::TVector3D& f_vehicle);
    void add_pose(double t, const mrpt::poses::CPose3D& pose);
    double span() const;
    std::optional<Result> estimate() const;
};

Methods

void add_specific_force(double t, const mrpt::math::TVector3D& f_vehicle)

Adds an accelerometer reading (specific force) in the vehicle frame [m/s^2].

void add_pose(double t, const mrpt::poses::CPose3D& pose)

Adds an odometry pose of the vehicle in the map frame. Times must increase.

double span() const

Time between the first and the last pose added [s].

std::optional<Result> estimate() const

The fit, or nothing with fewer than 3 poses covered by readings, a gap in the readings inside the window, or a time span too short to separate velocity from gravity. Readings that go on without poses for over 2 s restart the window at the next pose.