struct mrpt::graphslam::TSlidingWindow

Class to monitor the evolution of a statistical quantity.

Keeps track of the last N incoming measurements of the quantity at hand and upon request returns statistical properties of these measurements (mean, median, etc.)

Class also contains methods for evaluating incoming measurements (whether to accept or reject those)

  • sliding_win_size

    • Default value : 10

    • Required : FALSE

    • Description : How many of the latest measurements to take into account when computing the relevant statistics

#include <mrpt/graphslam/misc/TSlidingWindow.h>

struct TSlidingWindow: public mrpt::config::CLoadableOptions
{
    // construction

    TSlidingWindow(const std::string& name = "window");

    //
methods

    double getMedian();
    double getMean();
    double getStdDev();
    bool evaluateMeasurementInGaussian(double measurement);
    bool evaluateMeasurementAbove(double value);
    bool evaluateMeasurementBelow(double value);
    void addNewMeasurement(double measurement);
    void resizeWindow(size_t new_size);
    virtual void loadFromConfigFile(const mrpt::config::CConfigFileBase& source, const std::string& section);
    virtual void dumpToTextStream(std::ostream& out) const;
    size_t getWindowSize() const;
    bool windowIsFull() const;
};

Inherited Members

public:
    //
methods

    virtual void loadFromConfigFile(const mrpt::config::CConfigFileBase& source, const std::string& section) = 0;
    void loadFromConfigFileName(const std::string& config_file, const std::string& section);
    virtual void saveToConfigFile(mrpt::config::CConfigFileBase& target, const std::string& section) const;
    void saveToConfigFileName(const std::string& config_file, const std::string& section) const;
    void dumpToConsole() const;
    virtual void dumpToTextStream(std::ostream& out) const;

Methods

double getMedian()

Return the current median value.

double getMean()

Return the current mean value.

double getStdDev()

Return the Standard deviation of the current measurement vector.

bool evaluateMeasurementInGaussian(double measurement)

Determine whether the incoming measurement is inside the [-3sigma, +3sigma] boundaries from the current mean value.

Returns:

True if it’s inside the uncertainty boundaries

bool evaluateMeasurementAbove(double value)

Determine whether the incoming measurement is over the current mean value.

Returns:

True if it’s above the mean

bool evaluateMeasurementBelow(double value)

Determine whether the incoming measurement is less or equal to the current mean value.

Returns:

True if it’s <= to the mean

void addNewMeasurement(double measurement)

Update the sliding window by appending a new measurement.

void resizeWindow(size_t new_size)

Resize the window.

Method affects the underlying vector only if the new_size specified has already been reached

virtual void loadFromConfigFile(const mrpt::config::CConfigFileBase& source, const std::string& section)

This method load the options from a “.ini”-like file or memory-stored string list.

Only those parameters found in the given “section” and having the same name that the variable are loaded. Those not found in the file will stay with their previous values (usually the default values loaded at initialization). An example of an “.ini” file:

[section]
resolution    = 0.10   // blah blah...
modeSelection = 1      // 0=blah, 1=blah,...

See also:

loadFromConfigFileName, saveToConfigFile

virtual void dumpToTextStream(std::ostream& out) const

This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.

The default implementation in this base class relies on saveToConfigFile() to generate a plain text representation of all the parameters.

size_t getWindowSize() const

Return the size of the window.

bool windowIsFull() const

Check if the window has reached its limit.

This limit is set by the user via the resizeWindow method.

See also:

resizeWindow