Class CoralIntakeSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.alotobots.reefscape.subsystems.coralIntake.CoralIntakeSubsystem
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 Summary
ConstructorsConstructorDescriptionConstructs a new CoralIntakeSubsystem with the specified hardware interface. -
Method Summary
Modifier and TypeMethodDescriptionGets the current velocity of the intake.boolean
Checks if the intake currently has a game piece.void
periodic()
Updates and logs intake sensor inputs.void
runAtPercentOutput
(double percentOutput) Controls the intake using direct percent output (open-loop control).void
runToTargetVelocity
(AngularVelocity velocity) Controls the intake to move at a specified velocity using closed-loop velocity control.void
stop()
Stops intake movement.Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
CoralIntakeSubsystem
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
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
Gets the current velocity of the intake. Positive values indicate intake direction.- Returns:
- The current angular velocity
-