class mola::state_estimation_smoother::GyroHistory

Overview

Recent angular velocity readings of one IMU, in the vehicle frame.

A prediction extrapolates its anchor pose (a solved keyframe, or a front end’s last raw pose) to the query time. The rotation part of that increment is the integral of these readings, minus the gyroscope bias estimate, where they cover the interval; a constant angular velocity cannot follow a turn that reverses within it (e.g. a hand-held sensor swinging).

Thread-safe: written by fuse_imu() as readings arrive (before the async backend sees them) and read by both prediction paths.

#include <GyroHistory.h>

class GyroHistory
{
public:
    // fields

    static constexpr double MAX_GAP = 0.05;

    // construction

    GyroHistory(double keepSeconds);

    // methods

    void set_label_regex(const std::string& re);
    void add(const std::string& label, double t, const Eigen::Vector3d& w);
    std::string label() const;
    void set_bias(const Eigen::Vector3d& b);
    void clear();
    std::optional<Eigen::Matrix3d> rotation_between(double t0, double t1) const;
};

Fields

static constexpr double MAX_GAP = 0.05

Largest gap [s] between readings (or between a reading and an end of the interval) that the integration bridges.

Methods

void set_label_regex(const std::string& re)

Only readings whose sensor label matches this are used (default: any).

void add(const std::string& label, double t, const Eigen::Vector3d& w)

Adds one reading (time [s], angular velocity [rad/s] in the vehicle frame). Only the first matching label seen is used; readings not newer than the last one, or not finite, are ignored (a non-finite one leaves a gap, bridged up to MAX_GAP like any other).

std::string label() const

The sensor label in use (empty before the first matching reading).

void set_bias(const Eigen::Vector3d& b)

Sets the gyroscope bias [rad/s] (vehicle frame) subtracted from the readings.

void clear()

Forgets the readings and the bias.

std::optional<Eigen::Matrix3d> rotation_between(double t0, double t1) const

The vehicle rotation from t0 to t1 [s] (R_{t0,t1}, in the frame at t0), or nothing if t1 <= t0 or the readings do not cover the interval. A reading inside the interval holds from the previous one’s stamp (or t0) to its own. After the last reading inside, or over an interval with none inside, the newest reading not after that point holds up to t1: a reading stamped after t1 is never used, so the result does not depend on whether it has been received yet.