Class QuestNav

java.lang.Object
gg.questnav.questnav.QuestNav

public class QuestNav extends Object
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 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

      public OptionalInt 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

      public OptionalInt getFrameCount()
      Gets the current frame count from the Quest headset.
      Returns:
      The frame count value
    • getTrackingLostCounter

      public OptionalInt 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

      public OptionalDouble getAppTimestamp()
    • getAllUnreadPoseFrames

      public PoseFrame[] 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.