Class InterpolatingHistoryBuffer

java.lang.Object
xbot.common.math.InterpolatingHistoryBuffer

public class InterpolatingHistoryBuffer extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    InterpolatingHistoryBuffer(int length, double init_val)
    This class implements a set of circular buffers that can be used to store values of signals in the past, and retrieve values at arbitrary previous time indexes.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getValAtTime(double time)
    Returns the value at a given time, linearlly interpolated.
    boolean
    insert(double time, double value)
    Insert a new value into the buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InterpolatingHistoryBuffer

      public InterpolatingHistoryBuffer(int length, double init_val)
      This class implements a set of circular buffers that can be used to store values of signals in the past, and retrieve values at arbitrary previous time indexes. The value is assumed to saturate at the end of the maintained history.
      Parameters:
      length - Number of samples to keep
      init_val - Value to fill the inital samples with (probably zero is fine)
  • Method Details

    • insert

      public boolean insert(double time, double value)
      Insert a new value into the buffer. Discards the oldest value.
      Parameters:
      time - Time at which the value was sampled. elements must be inserted in a monotomically increasing fashion
      value - Value of the signal right now
      Returns:
      true if the value was inserted, false otherwise
    • getValAtTime

      public double getValAtTime(double time)
      Returns the value at a given time, linearlly interpolated.
      Parameters:
      time - time at which to retrieve value
      Returns:
      value at inputted time.