Class Vec3Frame

java.lang.Object
com.reduxrobotics.frames.Frame<Vector<N3>>
com.reduxrobotics.sensors.canandgyro.Vec3Frame

public class Vec3Frame extends Frame<Vector<N3>>
Implements an object-holding Frame with considerations for 3-vectors. This avoids creation of new objects by only converting to a Vector when the value is requested, while also offering interfaces to efficiently retrieve components without allocation.
  • Constructor Details

    • Vec3Frame

      public Vec3Frame(double timestamp, Vector<N3> defaultData, double scaleFactor)
      Instantiates a new Vec3Frame.
      Parameters:
      timestamp - The timestamp the update happened at.
      defaultData - An instance of the object to return before the first update happens.
      scaleFactor - The conversion factor between one LSB and one vector unit.
  • Method Details

    • getValue

      public Vector<N3> getValue()
      Description copied from class: Frame
      Returns the value of the data frame.
      Specified by:
      getValue in class Frame<Vector<N3>>
      Returns:
      the value the data frame holds.
    • getX

      public double getX()
      The x (first) component.
      Returns:
      x value
    • getY

      public double getY()
      The y (second) component.
      Returns:
      x value
    • getZ

      public double getZ()
      The z (third) component.
      Returns:
      z value
    • hasData

      public boolean hasData()
      Returns if this frame has data.
      Specified by:
      hasData in class Frame<Vector<N3>>
      Returns:
      if this frame's data can be considered valid
    • clearData

      public void clearData()
      Flag that this frame's data is not valid.
    • updateData

      public void updateData(byte[] data, double timestamp)
      Update the Frame with new data.
      Parameters:
      data - the new data to update with
      timestamp - the timestamp at which it occured