Class AutoStartCheck

java.lang.Object
frc.spectrumLib.checks.AutoStartCheck
All Implemented Interfaces:
Check

public final class AutoStartCheck extends Object implements Check
An auto is selected, its file loaded, and the robot sits on its starting pose (254 2025's "Near Auto Starting Pose").

The pose comparison needs a multi-tag vision seed taken after the code last put the pose on the start. Before that the pose is only where the code put it, and comparing it with the start would compare the start with itself, so the check warns that the start is unverified.

Once the robot is enabled it stops comparing: the robot has driven, and the start of the path is history. It re-arms for the next match on a rising edge of FMS attach or a new match number, and then needs a fresh seed too.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    What the check needs, from logged inputs.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    How long the robot must stay off the start before it fails: it may be being placed.
    static final double
    Farther than this from the start is the wrong spot, side or alliance.
    static final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    evaluate(double now)
    Judges the robot now.
    double
    Distance from the start, metres, or NaN when not compared.
    double
    Heading error from the start, degrees, or NaN when not compared.
    void
    observe(double now)
    Called every loop, enabled or not, for checks that must see every loop: a reset flag that is true for one loop, or a condition that has to hold for some time.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_DISTANCE_METERS

      public static final double MAX_DISTANCE_METERS
      Farther than this from the start is the wrong spot, side or alliance.
      See Also:
    • MAX_HEADING_DEG

      public static final double MAX_HEADING_DEG
      See Also:
    • HOLD_SECONDS

      public static final double HOLD_SECONDS
      How long the robot must stay off the start before it fails: it may be being placed.
      See Also:
  • Constructor Details

    • AutoStartCheck

      public AutoStartCheck(Supplier<AutoStartCheck.State> state)
      Parameters:
      state - this loop's auto selection and robot pose
  • Method Details

    • observe

      public void observe(double now)
      Description copied from interface: Check
      Called every loop, enabled or not, for checks that must see every loop: a reset flag that is true for one loop, or a condition that has to hold for some time. Keep it cheap.
      Specified by:
      observe in interface Check
      Parameters:
      now - this loop's robot time
    • evaluate

      public CheckResult evaluate(double now)
      Description copied from interface: Check
      Judges the robot now. Called only while disabled, and not every loop: PreMatchChecks spreads the checks across loops.
      Specified by:
      evaluate in interface Check
      Parameters:
      now - this loop's robot time
      Returns:
      the verdict
    • getDistanceMeters

      public double getDistanceMeters()
      Distance from the start, metres, or NaN when not compared.
    • getHeadingErrorDeg

      public double getHeadingErrorDeg()
      Heading error from the start, degrees, or NaN when not compared.