Class ConditionalEndConsumerCommand<T>

java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
org.chsrobotics.lib.commands.ConditionalEndConsumerCommand<T>
Type Parameters:
T - The data type of the method parameter(s).
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable, edu.wpi.first.wpilibj2.command.Command

public class ConditionalEndConsumerCommand<T> extends edu.wpi.first.wpilibj2.command.CommandBase
Class for the command-based structure which allows for method execution (using one or two values of generic T) at beginning and end of the command, with a boolean lambda of when the command should end.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj2.command.Command

    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
  • Field Summary

    Fields inherited from class edu.wpi.first.wpilibj2.command.CommandBase

    m_requirements
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConditionalEndConsumerCommand(BiConsumer<T,T> biConsumer, Tuple2<T> init, Tuple2<T> end, Supplier<Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)
    Constructs a ConditionalConsumerCommand for a method with two parameters.
    ConditionalEndConsumerCommand(Consumer<T> consumer, T init, T end, Supplier<Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)
    Constructs a ConditionalConsumerCommand for a method with one parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end(boolean interrupted)
     
    void
     
    boolean
     
    boolean
     
    void
    setRunsWhileDisabled(boolean runsWhileDisabled)
    Sets whether this command should continue to run even while the robot is in a disabled state.

    Methods inherited from class edu.wpi.first.wpilibj2.command.CommandBase

    addRequirements, getName, getRequirements, getSubsystem, initSendable, setName, setSubsystem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.wpi.first.wpilibj2.command.Command

    alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineWith, execute, finallyDo, getInterruptionBehavior, handleInterrupt, hasRequirement, ignoringDisable, isScheduled, perpetually, raceWith, repeatedly, schedule, unless, until, withInterrupt, withInterruptBehavior, withName, withTimeout
  • Constructor Details

    • ConditionalEndConsumerCommand

      public ConditionalEndConsumerCommand(Consumer<T> consumer, T init, T end, Supplier<Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)
      Constructs a ConditionalConsumerCommand for a method with one parameter.
      Parameters:
      consumer - A method which takes one parameter of type T.
      init - A value of T to feed to the consumer upon command initalization.
      end - A value of T to feed to the consumer upon command end.
      endConditional - A lambda of whether the command should be ended.
      toRequire - Any subsystems required to be freed for method execution.
    • ConditionalEndConsumerCommand

      public ConditionalEndConsumerCommand(BiConsumer<T,T> biConsumer, Tuple2<T> init, Tuple2<T> end, Supplier<Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)
      Constructs a ConditionalConsumerCommand for a method with two parameters.
      Parameters:
      biConsumer - A method which takes two parameters, each of type T.
      init - A Tuple2 of Ts to feed to the consumer upon command initalization, in the order that they are in the actual method.
      end - A Tuple2 of Ts to feed to the consumer upon command end, in the order that they are in the actual method.
      endConditional - A lambda of whether the command should be ended.
      toRequire - Any subsystems required to be freed for method execution.
  • Method Details

    • setRunsWhileDisabled

      public void setRunsWhileDisabled(boolean runsWhileDisabled)
      Sets whether this command should continue to run even while the robot is in a disabled state.
      Parameters:
      runsWhileDisabled - True if this command should continue in the disabled state.
    • runsWhenDisabled

      public boolean runsWhenDisabled()
    • initialize

      public void initialize()
    • end

      public void end(boolean interrupted)
    • isFinished

      public boolean isFinished()