Package frc.robot.subsystems
Class CoralManipulator
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.CoralManipulator
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,edu.wpi.first.wpilibj2.command.Subsystem
public class CoralManipulator extends edu.wpi.first.wpilibj2.command.SubsystemBase
Subsystem that controls the coral manipulator (intake/output mechanism). This handles the basic motor control and sensor detection for the coral game pieces.
Field Summary
FieldsModifier and TypeFieldDescriptionfinal edu.wpi.first.wpilibj2.command.button.Trigger
Trigger that is active when the Coral Manipulator does not have a coral.final edu.wpi.first.wpilibj2.command.button.Trigger
Trigger that is active when the Coral Manipulator has a coral.final edu.wpi.first.wpilibj2.command.button.Trigger
Trigger that is active when the Coral Manipulator is running.Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.Command
drop()
Drops a coral until the sensor no longer detects it.edu.wpi.first.wpilibj2.command.Command
eject()
Ejects a alga off the reef.edu.wpi.first.wpilibj2.command.Command
Command that toggles between different states: - If stopped: Drops coral if detected, otherwise ejects - If already running: Stops all operationsstatic CoralManipulator
Gets the singleton instance of the CoralManipulator subsystem.edu.wpi.first.wpilibj2.command.Command
Instantly stops the coral manipulator.edu.wpi.first.wpilibj2.command.Command
intake()
Intakes a coral until the sensor detects it.void
periodic()
edu.wpi.first.wpilibj2.command.Command
stop()
Stops the coral manipulator.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
Field Details
running
public final edu.wpi.first.wpilibj2.command.button.Trigger runningTrigger that is active when the Coral Manipulator is running.doesntHaveCoral
public final edu.wpi.first.wpilibj2.command.button.Trigger doesntHaveCoralTrigger that is active when the Coral Manipulator does not have a coral.hasCoral
public final edu.wpi.first.wpilibj2.command.button.Trigger hasCoralTrigger that is active when the Coral Manipulator has a coral.
Method Details
getInstance
Gets the singleton instance of the CoralManipulator subsystem.- Returns:
- The singleton instance.
intake
public edu.wpi.first.wpilibj2.command.Command intake()Intakes a coral until the sensor detects it.- Returns:
- A command that intakes a coral.
drop
public edu.wpi.first.wpilibj2.command.Command drop()Drops a coral until the sensor no longer detects it.- Returns:
- A command that drops a coral.
eject
public edu.wpi.first.wpilibj2.command.Command eject()Ejects a alga off the reef.- Returns:
- A command that ejects a alga.
stop
public edu.wpi.first.wpilibj2.command.Command stop()Stops the coral manipulator.- Returns:
- A command that stops the coral manipulator.
instantStop
public edu.wpi.first.wpilibj2.command.Command instantStop()Instantly stops the coral manipulator.- Returns:
- A command that instantly stops the coral manipulator.
ejectOrDrop
public edu.wpi.first.wpilibj2.command.Command ejectOrDrop()Command that toggles between different states: - If stopped: Drops coral if detected, otherwise ejects - If already running: Stops all operationsThis provides an easy way to perform the most intuitive action based on context.
- Returns:
- Command that performs the appropriate action based on current state
periodic
public void periodic()