Class ElevatorWrist
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.elevator_wrist.ElevatorWrist
Elevator and Wrist Subsystem
-
Field Summary
FieldsModifier and TypeFieldDescriptionfrc.robot.subsystems.elevator_wrist.ElevatorWristInputsAutoLogged
-
Constructor Summary
ConstructorsConstructorDescriptionElevatorWrist
(ElevatorWristIO io, CommandXboxController operator, PumbaaViz viz) Create new ElevatorWrist. -
Method Summary
Modifier and TypeMethodDescriptionSet elevator and wrist to amp position.atGoal()
Get if at elevator + wrist PID goalSet elevator and wrist to climbing position.boolean
Check if the elevator is at the AMP positionboolean
Check if the elevator is at the home positiondouble
Get the height in meters of the elevator based on the rotations of the motorfollowPosition
(DoubleSupplier height, Supplier<Rotation2d> angle) Command to continuously move the Elevator and Wrist to an ever changing positiongetAngleFromDistance
(Pose2d position) Determine the angle of wrist based on the distance from the shooterdouble
Calculate elevator height from raw encoder value.Calculate wrist angle from raw encoder value.goToPosition
(double height, Rotation2d angle) Command to move Elevator and Wrist to set positionsSet elevator to home position which can fit under the stage.void
periodic()
void
setWristAngle
(Rotation2d angle) Set the Wrist to a specified angleSet elevator to home and angle the wrist at a set angle to shoot into the speaker from directly in front.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
-
io
-
inputs
public frc.robot.subsystems.elevator_wrist.ElevatorWristInputsAutoLogged inputs -
elevatorAtAmp
-
-
Constructor Details
-
ElevatorWrist
Create new ElevatorWrist.
-
-
Method Details
-
periodic
public void periodic() -
getHeight
public double getHeight()Calculate elevator height from raw encoder value. -
getWristAngleMeasurement
Calculate wrist angle from raw encoder value. -
getWristAngle
-
getAngleFromDistance
Determine the angle of wrist based on the distance from the shooter- Parameters:
position
- Position of the robot- Returns:
- Rotation of the wrist
-
setWristAngle
Set the Wrist to a specified angle- Parameters:
angle
- Angle of the wrist
-
speakerPreset
Set elevator to home and angle the wrist at a set angle to shoot into the speaker from directly in front. -
ampPosition
Set elevator and wrist to amp position. Performs two steps to avoid colliding with electronics box. -
climbPosition
Set elevator and wrist to climbing position. Performs two steps to avoid colliding with electronics box. -
homePosition
Set elevator to home position which can fit under the stage. Performs two steps to avoid colliding with electronics box. -
goToPosition
Command to move Elevator and Wrist to set positions- Parameters:
height
- The height of the elevator in metersangle
- The angle of the wrist inRotation2d
- Returns:
- A
Command
-
followPosition
Command to continuously move the Elevator and Wrist to an ever changing position- Parameters:
height
- ADoubleSupplier
to provide the height of the elevator in metersangle
- ASupplier
ofRotation2d
of angle of the wrist inRotation2d
- Returns:
- A
Command
-
elevatorDistanceTraveled
public double elevatorDistanceTraveled()Get the height in meters of the elevator based on the rotations of the motor- Returns:
- Height of elevator in meters
-
atGoal
Get if at elevator + wrist PID goal- Returns:
- boolean representing if the elevator and wrist PID controllers are at their goals
-
elevatorAtHome
public boolean elevatorAtHome()Check if the elevator is at the home position- Returns:
- True if the elevator is home
-
elevatorAtAmp
public boolean elevatorAtAmp()Check if the elevator is at the AMP position- Returns:
- True if the elevator is AMP
-