Class AbstractVelocityCommand<TSubsystem extends AbstractVelocitySubsystem<?>>

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.robot.shared.commands.AbstractSubsystemCommand<TSubsystem>
frc.robot.shared.commands.AbstractVelocityCommand<TSubsystem>
Type Parameters:
TSubsystem - concrete velocity subsystem type
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
Direct Known Subclasses:
EjectIntakeCommand, FeedCommand, ReverseFeederCommand, ReverseIndexerCommand

public class AbstractVelocityCommand<TSubsystem extends AbstractVelocitySubsystem<?>> extends AbstractSubsystemCommand<TSubsystem>
Command base that drives an AbstractVelocitySubsystem toward a supplied target RPM using its velocity controller.

Provide a target RPM supplier in the constructor; the command sets the goal on initialize, steps the controller each cycle, and finishes once the subsystem reports AbstractVelocitySubsystem.isAtTargetVelocity().

  • Nested Class Summary

    Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command

    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
  • Field Summary

    Fields inherited from class frc.robot.shared.commands.AbstractSubsystemCommand

    log, subsystem
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractVelocityCommand(TSubsystem subsystem, Supplier<Double> targetRpmSupplier)
    Builds a velocity command for the given subsystem.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end(boolean interrupted)
     
    void
     
    boolean
     
    protected void
    Optional hook for subclasses to run logic during initialize after the start log.

    Methods inherited from class frc.robot.shared.commands.AbstractSubsystemCommand

    initialize

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractVelocityCommand

      protected AbstractVelocityCommand(TSubsystem subsystem, Supplier<Double> targetRpmSupplier)
      Builds a velocity command for the given subsystem.
      Parameters:
      subsystem - subsystem instance to control
      targetRpmSupplier - provider for target velocity in mechanism RPM; evaluated on initialize
  • Method Details

    • execute

      public void execute()
      Overrides:
      execute in class edu.wpi.first.wpilibj2.command.Command
    • end

      public void end(boolean interrupted)
      Overrides:
      end in class edu.wpi.first.wpilibj2.command.Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class edu.wpi.first.wpilibj2.command.Command
    • onInitialize

      protected void onInitialize()
      Description copied from class: AbstractSubsystemCommand
      Optional hook for subclasses to run logic during initialize after the start log.
      Overrides:
      onInitialize in class AbstractSubsystemCommand<TSubsystem extends AbstractVelocitySubsystem<?>>