Class HomingCheck

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

public final class HomingCheck extends Object implements Check
Every mechanism that relies on its position knows where it is.

A mechanism reports a HomingCheck.State. addMechanism(Mechanism) covers any soft-limited Mechanism from what it already tracks (Mechanism.isPositionLost()); a mechanism with its own homing routine adds a supplier that maps that routine's state.

  • Constructor Details

    • HomingCheck

      public HomingCheck()
  • Method Details

    • add

      public void add(String name, Supplier<HomingCheck.State> state)
      Adds a mechanism with a state of its own.
      Parameters:
      name - its name in messages
      state - its homing state, from logged inputs
    • addMechanism

      public void addMechanism(Mechanism m)
      Adds a mechanism by its reboot tracking. Skipped unless it is attached and soft-limited (only then does its position matter).
      Parameters:
      m - the mechanism
    • stateOf

      public static HomingCheck.State stateOf(Mechanism m)
      A mechanism's state from its reboot tracking alone.
    • 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