class mola::MetricChannel

Overview

Opaque handle a module holds after registering a metric channel via VizInterface::register_metric().

Thread-safe: push() may be called from any thread, at any rate, without external synchronization. On backends without plotting support (e.g. the nanogui MolaViz) the returned handle is a live no-op whose push() returns immediately. On backends with plotting support, push() is near-free whenever no plot window is currently displaying the channel.

#include <MetricChannel.h>

class MetricChannel
{
public:
    // typedefs

    typedef std::shared_ptr<MetricChannel> Ptr;

    // construction

    MetricChannel();
    MetricChannel(const MetricChannel&);
    MetricChannel(MetricChannel&&);

    // methods

    MetricChannel& operator = (const MetricChannel&);
    MetricChannel& operator = (MetricChannel&&);
    virtual void push(double t, double value) = 0;
    void push(double value);
};

// direct descendants

class MetricChannelImpl;

Methods

virtual void push(double t, double value) = 0

Appends one sample.

Parameters:

t

Timestamp in seconds, using any monotonic clock consistent across calls for this channel. Using wall-clock time (mrpt::Clock::nowDouble()) is recommended so multiple channels can share a common x-axis.

value

Sample value.

void push(double value)

Convenience overload: uses mrpt::Clock::nowDouble() as the timestamp.