Class Vec3Frame
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.-
Nested Class Summary
Nested classes/interfaces inherited from class com.reduxrobotics.frames.Frame
Frame.FrameCallback<FC>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Flag that this frame's data is not valid.getValue()
Returns the value of the data frame.double
getX()
The x (first) component.double
getY()
The y (second) component.double
getZ()
The z (third) component.boolean
hasData()
Returns if this frame has data.void
updateData
(byte[] data, double timestamp) Update the Frame with new data.Methods inherited from class com.reduxrobotics.frames.Frame
addCallback, getFrameData, getTimestamp, maxTimestamp, removeCallback, update, waitForFrames
-
Constructor Details
-
Vec3Frame
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
Description copied from class:Frame
Returns the value of the data frame. -
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. -
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 withtimestamp
- the timestamp at which it occured
-