java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.mechanisms.arm.Pivot
All Implemented Interfaces:
Sendable, Subsystem

public class Pivot extends SubsystemBase
Subsystem used to control the elevator pivot.
  • Constructor Details

    • Pivot

      public Pivot()
      Creates a new Pivot.
  • Method Details

    • periodic

      public void periodic()
      This method is responsible for they safety of the pivot.

      This uses the target to determine the target position of the pivot.

    • init

      public void init()
      Sets up the pivot. Should be called pre-enable.
    • setTarget

      public void setTarget(Angle position)
      A method to move the pivot to a position.
      Parameters:
      position - The position as a angle.
    • setTarget

      public void setTarget(double position)
      A function to move the pivot to a position in degrees.
      Parameters:
      position - The position in degrees.
    • getTarget

      public double getTarget()
      Gets the current target.
      Returns:
      The pivot target in meters.
    • getPosition

      public double getPosition()
      Gets the current position of the pivot.
      Returns:
      The pivot position in degrees.
    • isAtTarget

      public boolean isAtTarget()
      Check if the pivot is within the tolerance to it's target position. This is used to determine if the Arm.setPositionCommand(ArmPosition) command is finished.
    • setSpeedCommand

      public Command setSpeedCommand(DoubleSupplier pivotSpeed)
      A command to set the speed of the pivot. Used for relative control.
      Parameters:
      pivotSpeed - The speed of the pivot as a percentage of max speed. [-1, 1]
      Returns:
      Command to run.
    • doNothing

      public Command doNothing()
      A command that does nothing. This command requires the elevator subsystem so it will kill any other command. This is used to let the drivers regain controll of the elevator if it is unable to reach its target.
      Returns:
      Command to run.
    • toggleBrakeModeCommand

      public Command toggleBrakeModeCommand()
      Toggles brake mode on the pivot motor.
      Returns:
      Command to run.
    • enableBrakeModeCommand

      public Command enableBrakeModeCommand()
      Enables brake mode on the pivot motor. Called on enable to ensure the pivot is in brake mode for the match.
      Returns:
      Command to run.