Package frc.spectrumLib
Class SpectrumState
java.lang.Object
edu.wpi.first.wpilibj2.command.button.Trigger
frc.spectrumLib.SpectrumState
- All Implemented Interfaces:
BooleanSupplier
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSpectrumState
(edu.wpi.first.wpilibj.event.EventLoop eventLoop, String name) Create a new EventTrigger that gets polled by the given event loop instead of the EventSchedulerSpectrumState
(String name) Create a new EventTrigger. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.Command
set
(boolean value) protected static void
setCondition
(String name, boolean value) Set the value of an event conditionedu.wpi.first.wpilibj2.command.Command
setFalse()
edu.wpi.first.wpilibj2.command.Command
void
setState
(boolean value) Directly set the spectrum state to the specified valueedu.wpi.first.wpilibj2.command.Command
setTrue()
edu.wpi.first.wpilibj2.command.Command
setTrueForTime
(DoubleSupplier time) edu.wpi.first.wpilibj2.command.Command
setTrueForTimeWithCancel
(DoubleSupplier time, Trigger cancelCondition) edu.wpi.first.wpilibj2.command.Command
Create a command that will set the state to true while the command is running Then it will set to false once it is cancellededu.wpi.first.wpilibj2.command.Command
toggle()
edu.wpi.first.wpilibj2.command.Command
Command to set state to true, and then to false, ensuring your state will trigger change to false actionsedu.wpi.first.wpilibj2.command.Command
Command to set state to false, and then to true, ensuring your state will trigger actionsMethods inherited from class edu.wpi.first.wpilibj2.command.button.Trigger
and, and, debounce, debounce, getAsBoolean, negate, not, onChange, onChangeToFalse, onChangeToTrue, onFalse, onFalse, onTrue, onTrue, or, or, runWithEndSequence, toggleOnFalse, toggleOnTrue, whileFalse, whileFalse, whileTrue, whileTrue
-
Constructor Details
-
SpectrumState
Create a new EventTrigger. This will run on the EventScheduler's event loop, which will be polled any time a path following command is running.- Parameters:
name
- The name of the event. This will be the name of the event marker in the GUI
-
SpectrumState
Create a new EventTrigger that gets polled by the given event loop instead of the EventScheduler- Parameters:
eventLoop
- The event loop to poll this triggername
- The name of the event. This will be the name of the event marker in the GUI
-
-
Method Details
-
setState
public void setState(boolean value) Directly set the spectrum state to the specified value- Parameters:
value
- The value to set the state to
-
setTrueWhileRunning
public edu.wpi.first.wpilibj2.command.Command setTrueWhileRunning()Create a command that will set the state to true while the command is running Then it will set to false once it is cancelled- Returns:
- the command
-
setTrueForTime
-
setFalseForTime
-
setTrueForTimeWithCancel
public edu.wpi.first.wpilibj2.command.Command setTrueForTimeWithCancel(DoubleSupplier time, Trigger cancelCondition) -
toggleToTrue
public edu.wpi.first.wpilibj2.command.Command toggleToTrue()Command to set state to false, and then to true, ensuring your state will trigger actions- Returns:
- the command
-
toggleToFalse
public edu.wpi.first.wpilibj2.command.Command toggleToFalse()Command to set state to true, and then to false, ensuring your state will trigger change to false actions- Returns:
-
set
public edu.wpi.first.wpilibj2.command.Command set(boolean value) - Parameters:
value
-- Returns:
-
setTrue
public edu.wpi.first.wpilibj2.command.Command setTrue() -
setFalse
public edu.wpi.first.wpilibj2.command.Command setFalse() -
toggle
public edu.wpi.first.wpilibj2.command.Command toggle() -
setCondition
Set the value of an event condition- Parameters:
name
- The name of the conditionvalue
- The value of the condition
-