Package gg.questnav.questnav
Class QuestNav
java.lang.Object
gg.questnav.questnav.QuestNav
The QuestNav class provides an interface to communicate with an Oculus/Meta Quest VR headset for
robot localization and tracking purposes. It uses NetworkTables to exchange data between the
robot and the Quest device.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up QuestNav responses after processing on the headset.Gets a list of results sent by the Quest since the last call to getAllUnreadResults().Returns the Quest's battery level (0-100%)Gets the current frame count from the Quest headset.doubleGets the latency of the Quest > Robot Connection.Gets the number of tracking lost events since the Quest connected to the robot.booleanDetermines if the Quest headset is currently connected to the robot.booleanGets the current tracking state of the Quest headset.voidsetPose(edu.wpi.first.math.geometry.Pose2d pose) Sets the field-relative pose of the Quest.
-
Constructor Details
-
QuestNav
public QuestNav()Creates a new QuestNav implementation
-
-
Method Details
-
setPose
public void setPose(edu.wpi.first.math.geometry.Pose2d pose) Sets the field-relative pose of the Quest. This is the position of the Quest, not the robot. Make sure you correctly offset back from the center of your robot first.- Parameters:
pose- The field relative position of the Quest
-
getBatteryPercent
Returns the Quest's battery level (0-100%)- Returns:
- An Optional containing battery percentage, or an empty Optional if no data is available
-
isTracking
public boolean isTracking()Gets the current tracking state of the Quest headset.- Returns:
- Boolean indicating if the Quest is currently tracking (true) or not (false)
-
getFrameCount
Gets the current frame count from the Quest headset.- Returns:
- The frame count value
-
getTrackingLostCounter
Gets the number of tracking lost events since the Quest connected to the robot.- Returns:
- The tracking lost counter value
-
isConnected
public boolean isConnected()Determines if the Quest headset is currently connected to the robot. Connection is determined by how stale the last received frame from the Quest is.- Returns:
- Boolean indicating if the Quest is connected (true) or not (false)
-
getLatency
public double getLatency()Gets the latency of the Quest > Robot Connection. Returns the latency between the current time and the last frame data update.- Returns:
- The latency in milliseconds
-
getAppTimestamp
-
getAllUnreadPoseFrames
Gets a list of results sent by the Quest since the last call to getAllUnreadResults().- Returns:
- returns a list of frames with pose data
-
commandPeriodic
public void commandPeriodic()Cleans up QuestNav responses after processing on the headset.
-