Class HoodHoming

java.lang.Object
frc.robot.subsystems.hood.HoodHoming

public final class HoodHoming extends Object
Finds the hood's bottom stop, so its angle does not depend on where it rested at power-on. Pure logic: Hood fills an HoodHoming.Inputs from logged inputs each loop and applies the HoodHoming.Output, so homing replays and is unit tested.

Homing drives the hood down at HoodHoming.Params.volts until its speed stays under HoodHoming.Params.stallDegPerSec for HoodHoming.Params.stallSeconds, then sets the position to the stop. It runs at auto start, at teleop start unless already zeroed, and each time the hood is sent home and gets within HoodHoming.Params.nearHomeDeg of the stop (1678's re-home on stow). Until the first success the hood refuses closed-loop setpoints and holds in brake. A reboot of the hood motor restarts its position, so it un-zeroes the hood and re-homes it at once if enabled.

No attempt runs while the hood's tracking stop holds it: a jammed hood stalls, and homing would take the jam for the stop and zero there. An attempt due meanwhile waits for the operator's clear; disabling drops it, and the next mode start asks again.

  • Constructor Details

  • Method Details

    • assumeZeroedForReplay

      public static boolean assumeZeroedForReplay(boolean replay, boolean recordedWithHoming)
      Whether to skip homing and treat the hood as zeroed: only when replaying a log recorded before homing existed. That robot trusted its boot angle and never wrote a zero, so its readings never show one, and waiting for one would hold the replayed shot gate where the robot fired.
      Parameters:
      replay - running in replay
      recordedWithHoming - the log's HoodHoming.LogMarker
      Returns:
      true to treat the hood as zeroed without homing
    • assumedZeroed

      public static HoodHoming.Output assumedZeroed()
      The output while assumeZeroedForReplay(boolean, boolean): zeroed, closed loop, no zero written.
    • getParams

      public HoodHoming.Params getParams()
    • isZeroed

      public boolean isZeroed()
    • update

      Advances homing one loop.
      Parameters:
      in - this loop's view of the hood
      Returns:
      what the hood does