Class CoralIntakeSubsystem

java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.alotobots.reefscape.subsystems.coralIntake.CoralIntakeSubsystem
All Implemented Interfaces:
Sendable, Subsystem

public class CoralIntakeSubsystem extends SubsystemBase
The CoralIntake subsystem controls the robot's intake mechanism for game pieces. This subsystem manages both closed-loop velocity control and open loop control modes. Positive motor output pulls inward (intake direction), negative output pushes outward.
  • Constructor Details

    • CoralIntakeSubsystem

      public CoralIntakeSubsystem(CoralIntakeIO io)
      Constructs a new CoralIntakeSubsystem with the specified hardware interface.
      Parameters:
      io - The hardware interface for controlling the intake mechanism
  • Method Details

    • periodic

      public void periodic()
      Updates and logs intake sensor inputs. Called periodically by the command scheduler. This method ensures that the latest sensor data is available for control decisions.
    • runToTargetVelocity

      public void runToTargetVelocity(AngularVelocity velocity)
      Controls the intake to move at a specified velocity using closed-loop velocity control. [NOT YET IMPLEMENTED]
      Parameters:
      velocity - Target velocity in radians per second. Positive values indicate intake direction.
    • runAtPercentOutput

      public void runAtPercentOutput(double percentOutput)
      Controls the intake using direct percent output (open-loop control). Positive values pull inward (intake), negative values push outward.
      Parameters:
      percentOutput - Motor output percentage (-1.0 to 1.0)
    • stop

      public void stop()
      Stops intake movement. This method should be called when active control of the intake is no longer needed.
    • isIntakeOccupied

      public boolean isIntakeOccupied()
      Checks if the intake currently has a game piece.
      Returns:
      true if a game piece is detected in the intake
    • getCurrentVelocity

      public AngularVelocity getCurrentVelocity()
      Gets the current velocity of the intake. Positive values indicate intake direction.
      Returns:
      The current angular velocity