Record Class GateContext
java.lang.Object
java.lang.Record
frc.spectrumLib.localization.GateContext
- Record Components:
nowSeconds- current time,Timer.getTimestamp()basefusedPose- the fused robot pose before this loop's measurementsodometryPose- the wheel-and-gyro-only pose, never corrected by visionrobotVelocity- robot-relative chassis velocitypeakYawRateRadPerSec- largest |yaw rate| over the configured lookback windowdisabled- whether the robot is disabledheadingSeeded- whether a camera has set the field heading yetrobotTiltDegrees- 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 Summary
ConstructorsConstructorDescriptionGateContext(double nowSeconds, Pose2d fusedPose, Pose2d odometryPose, ChassisVelocities robotVelocity, double peakYawRateRadPerSec, boolean disabled, boolean headingSeeded) A context for a level robot.GateContext(double nowSeconds, Pose2d fusedPose, Pose2d odometryPose, ChassisVelocities robotVelocity, double peakYawRateRadPerSec, boolean disabled, boolean headingSeeded, double robotTiltDegrees) Creates an instance of aGateContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleandisabled()Returns the value of thedisabledrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefusedPoserecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theheadingSeededrecord component.doubleRobot linear speed in m/s.doubleReturns the value of thenowSecondsrecord component.Returns the value of theodometryPoserecord component.doubleReturns the value of thepeakYawRateRadPerSecrecord component.doubleReturns the value of therobotTiltDegreesrecord component.Returns the value of therobotVelocityrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aGateContextrecord class.- Parameters:
nowSeconds- the value for thenowSecondsrecord componentfusedPose- the value for thefusedPoserecord componentodometryPose- the value for theodometryPoserecord componentrobotVelocity- the value for therobotVelocityrecord componentpeakYawRateRadPerSec- the value for thepeakYawRateRadPerSecrecord componentdisabled- the value for thedisabledrecord componentheadingSeeded- the value for theheadingSeededrecord componentrobotTiltDegrees- the value for therobotTiltDegreesrecord component
-
-
Method Details
-
linearSpeed
public double linearSpeed()Robot linear speed in m/s. -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
nowSeconds
public double nowSeconds()Returns the value of thenowSecondsrecord component.- Returns:
- the value of the
nowSecondsrecord component
-
fusedPose
-
odometryPose
Returns the value of theodometryPoserecord component.- Returns:
- the value of the
odometryPoserecord component
-
robotVelocity
Returns the value of therobotVelocityrecord component.- Returns:
- the value of the
robotVelocityrecord component
-
peakYawRateRadPerSec
public double peakYawRateRadPerSec()Returns the value of thepeakYawRateRadPerSecrecord component.- Returns:
- the value of the
peakYawRateRadPerSecrecord component
-
disabled
-
headingSeeded
public boolean headingSeeded()Returns the value of theheadingSeededrecord component.- Returns:
- the value of the
headingSeededrecord component
-
robotTiltDegrees
public double robotTiltDegrees()Returns the value of therobotTiltDegreesrecord component.- Returns:
- the value of the
robotTiltDegreesrecord component
-