Package lib.subsystems
Class SolenoidSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
lib.subsystems.SolenoidSubsystem
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj2.command.Subsystem
public class SolenoidSubsystem
extends edu.wpi.first.wpilibj2.command.SubsystemBase
A class that wraps multiple DoubleSolenoid objects with subsystem
functionality. Allows for easy inversion and setting of default state of
solenoids
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDoubleSolenoid.Value simplified to three simple states -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SolenoidSubsystem.SolenoidStateprotected booleanprotected edu.wpi.first.wpilibj.DoubleSolenoid[]protected SolenoidSubsystem.SolenoidState -
Constructor Summary
ConstructorsConstructorDescriptionSolenoidSubsystem(boolean isInverted, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality.SolenoidSubsystem(boolean isInverted, SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality.SolenoidSubsystem(edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality.SolenoidSubsystem(String name, boolean isInverted, SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality.SolenoidSubsystem(SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj.DoubleSolenoid[]getState()Inverts the state givenbooleanReturns whether the solenoid is extended.voidSets the state of the system.voidSets the state of the system regardless of current stateMethods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, periodic, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Field Details
-
solenoids
protected edu.wpi.first.wpilibj.DoubleSolenoid[] solenoids -
state
-
defaultState
-
isInverted
protected boolean isInverted
-
-
Constructor Details
-
SolenoidSubsystem
public SolenoidSubsystem(String name, boolean isInverted, SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. Allows for easy inversion and setting of default state of solenoids- Parameters:
name- Name of the subsystemisInverted- True if the solenoids should be inverteddefaultState- Set the default state of the SolenoidSystemsolenoids- Double solenoids of the system
-
SolenoidSubsystem
public SolenoidSubsystem(boolean isInverted, SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. Allows for easy inversion and setting of default state of solenoids- Parameters:
isInverted- True if the solenoids should be inverteddefaultState- Set the default state of the SolenoidSystemsolenoids- Double solenoids of the system
-
SolenoidSubsystem
public SolenoidSubsystem(boolean isInverted, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. Allows for easy inversion and setting of default state of solenoids- Parameters:
isInverted- True if the solenoids should be invertedsolenoids- Double solenoids of the system
-
SolenoidSubsystem
public SolenoidSubsystem(SolenoidSubsystem.SolenoidState defaultState, edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. Allows for easy inversion and setting of default state of solenoids- Parameters:
defaultState- Set the default state of the SolenoidSystemsolenoids- Double solenoids of the system
-
SolenoidSubsystem
public SolenoidSubsystem(edu.wpi.first.wpilibj.DoubleSolenoid... solenoids) A class that wraps multiple DoubleSolenoid objects with subsystem functionality. Allows for easy inversion and setting of default state of solenoids- Parameters:
solenoids- Double solenoids of the system
-
-
Method Details
-
getState
- Returns:
- Returns the current state of the system
-
invertState
Inverts the state given- Parameters:
state- SolenoidState to be inverted- Returns:
- SolenoidState Inverted state
-
set
Sets the state of the system. Only sets if current state is not equal to state to be set- Parameters:
state- State to set system
-
setOverride
Sets the state of the system regardless of current state- Parameters:
state- State to set
-
getSolenoids
public edu.wpi.first.wpilibj.DoubleSolenoid[] getSolenoids()- Returns:
- solenoids DoubleSolenoid objects of the system
-
isExtended
public boolean isExtended()Returns whether the solenoid is extended.- Returns:
- extended
-