Package gg.questnav.questnav
Record Class PoseFrame
java.lang.Object
java.lang.Record
gg.questnav.questnav.PoseFrame
- Record Components:
questPose3d- The robot's pose on the field as measured by the Quest tracking system. This will only provide meaningful field-relative coordinates afterQuestNav.setPose(Pose2d)has been called to establish the field reference frame.dataTimestamp- The NetworkTables timestamp indicating when this frame data was received by the robot. This timestamp should be used when adding vision measurements to pose estimators as it represents when the measurement was available to the robot code. Units: seconds since robot program start.appTimestamp- The Quest application's internal timestamp indicating when this frame was generated. This is primarily useful for debugging timing issues and calculating Quest-side latency. For pose estimation, usedataTimestamp()instead. Units: seconds since Quest app startup.frameCount- Sequential frame number from the Quest tracking system. This counter increments with each tracking frame and can be used to detect dropped frames or measure effective frame rate. Resets to 0 when the Quest app restarts.
public record PoseFrame(edu.wpi.first.math.geometry.Pose3d questPose3d, double dataTimestamp, double appTimestamp, int frameCount)
extends Record
Represents a single frame of pose tracking data received from the Quest headset.
This record encapsulates all the information needed to integrate Quest tracking data with FRC pose estimation systems. Each frame represents a single tracking measurement from the Quest's visual-inertial odometry system.
Usage with Pose Estimators
This record is designed to work seamlessly with WPILib's pose estimation framework:
PoseFrame[] frames = questNav.getAllUnreadPoseFrames();
for (PoseFrame frame : frames) {
if (questNav.isTracking()) {
poseEstimator.addVisionMeasurement(
frame.questPose(), // Use the pose measurement
frame.dataTimestamp(), // Use the NetworkTables timestamp
standardDeviations // Your measurement uncertainty
);
}
}
Timestamp Usage
Two timestamps are provided for different use cases:
dataTimestamp(): NetworkTables reception time - use this for pose estimationappTimestamp(): Quest internal time - use only for debugging/diagnostics
Coordinate System
The pose data follows WPILib field coordinate conventions:
- X-axis: Forward (towards opposing alliance)
- Y-axis: Left (when facing forward)
- Rotation: Counter-clockwise positive
- Units: Meters for translation, radians for rotation
- Since:
- 2025.1.0
- See Also:
-
QuestNav.getAllUnreadPoseFrames()QuestNav.setPose(Pose2d)PoseEstimatorPose2d
-
Constructor Summary
ConstructorsConstructorDescriptionPoseFrame(edu.wpi.first.math.geometry.Pose3d questPose3d, double dataTimestamp, double appTimestamp, int frameCount) Creates an instance of aPoseFramerecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theappTimestamprecord component.doubleReturns the value of thedataTimestamprecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of theframeCountrecord component.final inthashCode()Returns a hash code value for this object.edu.wpi.first.math.geometry.Pose3dReturns the value of thequestPose3drecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PoseFrame
public PoseFrame(edu.wpi.first.math.geometry.Pose3d questPose3d, double dataTimestamp, double appTimestamp, int frameCount) Creates an instance of aPoseFramerecord class.- Parameters:
questPose3d- the value for thequestPose3drecord componentdataTimestamp- the value for thedataTimestamprecord componentappTimestamp- the value for theappTimestamprecord componentframeCount- the value for theframeCountrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
questPose3d
public edu.wpi.first.math.geometry.Pose3d questPose3d()Returns the value of thequestPose3drecord component.- Returns:
- the value of the
questPose3drecord component
-
dataTimestamp
public double dataTimestamp()Returns the value of thedataTimestamprecord component.- Returns:
- the value of the
dataTimestamprecord component
-
appTimestamp
public double appTimestamp()Returns the value of theappTimestamprecord component.- Returns:
- the value of the
appTimestamprecord component
-
frameCount
public int frameCount()Returns the value of theframeCountrecord component.- Returns:
- the value of the
frameCountrecord component
-