Record Class GateContext

java.lang.Object
java.lang.Record
frc.spectrumLib.localization.GateContext
Record Components:
nowSeconds - current time, Timer.getTimestamp() base
fusedPose - the fused robot pose before this loop's measurements
odometryPose - the wheel-and-gyro-only pose, never corrected by vision
robotVelocity - robot-relative chassis velocity
peakYawRateRadPerSec - largest |yaw rate| over the configured lookback window
disabled - whether the robot is disabled
headingSeeded - whether a camera has set the field heading yet
robotTiltDegrees - the robot's tilt from level (Pigeon pitch and roll), degrees

public record GateContext(double nowSeconds, Pose2d fusedPose, Pose2d odometryPose, ChassisVelocities robotVelocity, double peakYawRateRadPerSec, boolean disabled, boolean headingSeeded, double robotTiltDegrees) extends Record
Robot state a gate may consult, built once per loop from logged inputs so gating replays deterministically.
  • Constructor Details

    • GateContext

      public GateContext(double nowSeconds, Pose2d fusedPose, Pose2d odometryPose, ChassisVelocities robotVelocity, double peakYawRateRadPerSec, boolean disabled, boolean headingSeeded)
      A context for a level robot.
    • GateContext

      public GateContext(double nowSeconds, Pose2d fusedPose, Pose2d odometryPose, ChassisVelocities robotVelocity, double peakYawRateRadPerSec, boolean disabled, boolean headingSeeded, double robotTiltDegrees)
      Creates an instance of a GateContext record class.
      Parameters:
      nowSeconds - the value for the nowSeconds record component
      fusedPose - the value for the fusedPose record component
      odometryPose - the value for the odometryPose record component
      robotVelocity - the value for the robotVelocity record component
      peakYawRateRadPerSec - the value for the peakYawRateRadPerSec record component
      disabled - the value for the disabled record component
      headingSeeded - the value for the headingSeeded record component
      robotTiltDegrees - the value for the robotTiltDegrees record component
  • Method Details

    • linearSpeed

      public double linearSpeed()
      Robot linear speed in m/s.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • nowSeconds

      public double nowSeconds()
      Returns the value of the nowSeconds record component.
      Returns:
      the value of the nowSeconds record component
    • fusedPose

      public Pose2d fusedPose()
      Returns the value of the fusedPose record component.
      Returns:
      the value of the fusedPose record component
    • odometryPose

      public Pose2d odometryPose()
      Returns the value of the odometryPose record component.
      Returns:
      the value of the odometryPose record component
    • robotVelocity

      public ChassisVelocities robotVelocity()
      Returns the value of the robotVelocity record component.
      Returns:
      the value of the robotVelocity record component
    • peakYawRateRadPerSec

      public double peakYawRateRadPerSec()
      Returns the value of the peakYawRateRadPerSec record component.
      Returns:
      the value of the peakYawRateRadPerSec record component
    • disabled

      public boolean disabled()
      Returns the value of the disabled record component.
      Returns:
      the value of the disabled record component
    • headingSeeded

      public boolean headingSeeded()
      Returns the value of the headingSeeded record component.
      Returns:
      the value of the headingSeeded record component
    • robotTiltDegrees

      public double robotTiltDegrees()
      Returns the value of the robotTiltDegrees record component.
      Returns:
      the value of the robotTiltDegrees record component