Package frc.lib.util

Class LazySelectCommand<K>

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.lib.util.LazySelectCommand<K>
All Implemented Interfaces:
Sendable

public class LazySelectCommand<K> extends Command
Similar to SelectCommand but allows commands for all variants of an enum instead. Also doesn't require all subsystems of all commands, only the selected command on run time.
  • Constructor Details

    • LazySelectCommand

      public LazySelectCommand(Map<K,Command> commands, Supplier<? extends K> selector)
      Create new LazySelectCommand. Note that the length of enumValues and commandValues must be the same.
      Throws:
      IllegalArgumentException - when enumValues and commandValues have different lengths.
  • Method Details

    • initialize

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

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

      public void execute()
      Overrides:
      execute in class Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class Command
    • runsWhenDisabled

      public boolean runsWhenDisabled()
      Whether the given command should run when the robot is disabled. Override to return true if the command should run when disabled.
      Overrides:
      runsWhenDisabled in class Command
      Returns:
      true. Otherwise, this proxy would cancel commands that do run when disabled.
    • initSendable

      public void initSendable(SendableBuilder builder)
      Specified by:
      initSendable in interface Sendable
      Overrides:
      initSendable in class Command