Package org.chsrobotics.lib.commands
Class ConditionalEndRunnableCommand
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.CommandBase
-
- org.chsrobotics.lib.commands.ConditionalEndRunnableCommand
-
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj2.command.Command
public class ConditionalEndRunnableCommand extends edu.wpi.first.wpilibj2.command.CommandBaseClass for the command-based structure which allows for method execution at beginning and end of the command, with a boolean lambda of when the command should end.
-
-
Constructor Summary
Constructors Constructor Description ConditionalEndRunnableCommand(java.lang.Runnable init, java.lang.Runnable end, java.util.function.Supplier<java.lang.Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)Constructs a ConditionalEndRunnableCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidend(boolean interrupted)voidinitialize()booleanisFinished()booleanrunsWhenDisabled()voidsetRunsWhileDisabled(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, withName
-
-
-
-
Constructor Detail
-
ConditionalEndRunnableCommand
public ConditionalEndRunnableCommand(java.lang.Runnable init, java.lang.Runnable end, java.util.function.Supplier<java.lang.Boolean> endConditional, edu.wpi.first.wpilibj2.command.Subsystem... toRequire)Constructs a ConditionalEndRunnableCommand.- Parameters:
init- Method (with no parameters) to be called when this command is initialized. Will not be called ifnull.end- Method (with no parameters) to be called when this command ends. Will not be called ifnull.endConditional- Lambda of a boolean dictating whether this command should end.toRequire- Any subsystems required to be free for the methods.
-
-
Method Detail
-
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()
-
-