Class ClimberIORevServoReal
java.lang.Object
frc.alotobots.reefscape.subsystems.climber.io.ClimberIORevServoReal
- All Implemented Interfaces:
ClimberIO
Implementation of ClimberIO for REV Robotics Servo Hub hardware. Controls two servos for climbing
mechanism: - A plunger servo that moves between up/down positions - A locking servo that
engages/disengages a lock Also monitors two limit switches that detect cage position.
-
Nested Class Summary
Nested classes/interfaces inherited from interface frc.alotobots.reefscape.subsystems.climber.io.ClimberIO
ClimberIO.ClimberIOInputs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Disables the elevator locking servovoid
Disables power and control to the locking servo.void
Disables power and control to the plunger servo.void
Enables the elevator locking servovoid
Enables power and control to the locking servo.void
Enables power and control to the plunger servo.boolean
Gets the state of both cage limit switches.void
setElevatorLockingServoLocked
(boolean elevatorLockingServoLocked) Sets the elevator locking servo to either locked or unlocked position for the elevator.void
setLockingServoLocked
(boolean lockingServoLocked) Sets the locking servo to either locked or unlocked position.void
setPlungerServoPosition
(Angle angle) Sets the plunger servo position based on an angle.void
Updates all input values from hardware sensors.
-
Constructor Details
-
ClimberIORevServoReal
public ClimberIORevServoReal()Initializes the climber hardware. Briefly enables then disables both servos to ensure proper initialization.
-
-
Method Details
-
getCageSwitches
public boolean getCageSwitches()Gets the state of both cage limit switches.- Specified by:
getCageSwitches
in interfaceClimberIO
- Returns:
- true if both switches are triggered, false otherwise
-
updateInputs
Updates all input values from hardware sensors.- Specified by:
updateInputs
in interfaceClimberIO
- Parameters:
inputs
- The inputs object to update with current hardware state
-
enablePlungerServo
public void enablePlungerServo()Enables power and control to the plunger servo.- Specified by:
enablePlungerServo
in interfaceClimberIO
-
enableLockingServo
public void enableLockingServo()Enables power and control to the locking servo.- Specified by:
enableLockingServo
in interfaceClimberIO
-
disablePlungerServo
public void disablePlungerServo()Disables power and control to the plunger servo.- Specified by:
disablePlungerServo
in interfaceClimberIO
-
disableLockingServo
public void disableLockingServo()Disables power and control to the locking servo.- Specified by:
disableLockingServo
in interfaceClimberIO
-
enableElevatorLockingServo
public void enableElevatorLockingServo()Description copied from interface:ClimberIO
Enables the elevator locking servo- Specified by:
enableElevatorLockingServo
in interfaceClimberIO
-
disableElevatorLockingServo
public void disableElevatorLockingServo()Description copied from interface:ClimberIO
Disables the elevator locking servo- Specified by:
disableElevatorLockingServo
in interfaceClimberIO
-
setPlungerServoPosition
Sets the plunger servo position based on an angle.- Specified by:
setPlungerServoPosition
in interfaceClimberIO
- Parameters:
angle
- The desired angle, where: - 0 degrees = down/plunge position (PLUNGER_SERVO_0_PW) - 180 degrees = up/receive position (PLUNGER_SERVO_180_PW) The angle is mapped to pulse width: - Maps 0° → PLUNGER_SERVO_0_PW (plunge/down position) - Maps 180° → PLUNGER_SERVO_180_PW (receive/up position)
-
setLockingServoLocked
public void setLockingServoLocked(boolean lockingServoLocked) Sets the locking servo to either locked or unlocked position.- Specified by:
setLockingServoLocked
in interfaceClimberIO
- Parameters:
lockingServoLocked
- true to lock, false to unlock
-
setElevatorLockingServoLocked
public void setElevatorLockingServoLocked(boolean elevatorLockingServoLocked) Sets the elevator locking servo to either locked or unlocked position for the elevator.- Specified by:
setElevatorLockingServoLocked
in interfaceClimberIO
- Parameters:
elevatorLockingServoLocked
- true to lock, false to unlock
-