Class WaitUntilInterrupt

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.robot.commands.WaitUntilInterrupt
All Implemented Interfaces:
Sendable

public class WaitUntilInterrupt extends Command
Command that creates an AsynchronousInterrupt and uses it to trigger a callback, waiting until the callback happens before finishing.
  • Constructor Details

    • WaitUntilInterrupt

      public WaitUntilInterrupt(DigitalSource source, BiConsumer<Boolean,Boolean> callback, boolean risingEdge, boolean fallingEdge)
      Creates a new WaitUntilInterrupt command that finishes when the interrupt is triggered.

      First bool in callback indicates trigger on rising edge, second bool indicates falling edge.

      Parameters:
      source - Digital source to await an interrupt on.
      callback - Callback to call on interrupt.
      risingEdge - Trigger on the rising edge.
      fallingEdge - Trigger on the falling edge.
    • WaitUntilInterrupt

      public WaitUntilInterrupt(DigitalSource source, BiConsumer<Boolean,Boolean> callback)
      Creates a new WaitUntilInterrupt command that finishes when the interrupt is triggered. Triggers on both the rising and falling edges.

      First bool in callback indicates trigger on rising edge, second bool indicates falling edge.

      Parameters:
      source - Digital source to await an interrupt on.
      callback - Callback to call on interrupt.
  • Method Details

    • initialize

      public void initialize()
      Overrides:
      initialize in class Command
    • end

      public void end(boolean interrupted)
      Overrides:
      end in class Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class Command