Class DefaultElevatorRunAtVelocity
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.alotobots.reefscape.subsystems.elevator.commands.DefaultElevatorRunAtVelocity
- All Implemented Interfaces:
Sendable
Default command that runs the elevator at a specified velocity. This command takes a velocity
input (normalized between -1.0 and 1.0) and applies it to the elevator, scaled by the maximum
speed constant.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command
Command.InterruptionBehavior
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultElevatorRunAtVelocity
(ElevatorSubsystem elevatorSubsystem, DoubleSupplier input) Creates a new DefaultElevatorRunAtVelocity command. -
Method Summary
Methods inherited from class edu.wpi.first.wpilibj2.command.Command
addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout
-
Constructor Details
-
DefaultElevatorRunAtVelocity
Creates a new DefaultElevatorRunAtVelocity command.- Parameters:
elevatorSubsystem
- The elevator subsystem this command will run oninput
- A supplier that provides the normalized velocity input (-1.0 to 1.0)
-
-
Method Details
-
initialize
public void initialize()Called when the command is initially scheduled. No initialization is needed for this command.- Overrides:
initialize
in classCommand
-
execute
public void execute()Called repeatedly when this command is scheduled to run. Calculates the target velocity by multiplying the input value by the maximum speed, then commands the elevator subsystem to run at that velocity. -
end
public void end(boolean interrupted) Called once when the command ends or is interrupted. Stops the elevator to ensure it doesn't continue moving. -
isFinished
public boolean isFinished()Returns whether this command has finished. This command never finishes on its own and will run until interrupted.- Overrides:
isFinished
in classCommand
- Returns:
- false always, as this is a default command that should not terminate
-