Package frc.robot.subsystems.turret
Class Turret
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.turret.Turret
Subsystem representing the robot turret.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Rotation2dgetGearAnglesFromTurret(Angle rotation, double gearing, Rotation2d offset) Computes the expected gear encoder angle for a given turret rotation.voidperiodic()setAutoTurretFollow(Pose2d swervePose) Sets the turret to go in the opposite direction of the drivetrain so it can resist the direction change, and stay facing the hub.voidMethods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Field Details
-
inputs
public final frc.robot.subsystems.turret.TurretInputsAutoLogged inputs
-
-
Constructor Details
-
Turret
Creates a new Turret subsystem.- Parameters:
io- Hardware abstraction used to read sensors and control actuators
-
-
Method Details
-
periodic
public void periodic() -
getGearAnglesFromTurret
Computes the expected gear encoder angle for a given turret rotation.- Parameters:
rotation- Absolute turret rotationgearing- Gear ratio between turret and encoderoffset- Encoder offset applied during calibration- Returns:
- Normalized expected encoder angle
-
setGoal
- Parameters:
targetAngle- gets the goal angle
-
goToAngle
-
setAutoTurretFollow
Sets the turret to go in the opposite direction of the drivetrain so it can resist the direction change, and stay facing the hub.
-