Class Turret

All Implemented Interfaces:
Sendable, Subsystem

public class Turret extends SubsystemBase
Subsystem representing the robot turret.
  • Field Details

    • inputs

      public final frc.robot.subsystems.turret.TurretInputsAutoLogged inputs
  • Constructor Details

    • Turret

      public Turret(TurretIO io, RobotState state)
      Creates a new Turret subsystem.
      Parameters:
      io - Hardware abstraction used to read sensors and control actuators
  • Method Details

    • periodic

      public void periodic()
    • getGearAnglesFromTurret

      public static Rotation2d getGearAnglesFromTurret(Angle rotation, double gearing, Rotation2d offset)
      Computes the expected gear encoder angle for a given turret rotation.
      Parameters:
      rotation - Absolute turret rotation
      gearing - Gear ratio between turret and encoder
      offset - Encoder offset applied during calibration
      Returns:
      Normalized expected encoder angle
    • setGoal

      public void setGoal(Angle targetAngle)
      Parameters:
      targetAngle - gets the goal angle
    • goToAngle

      public Command goToAngle(Angle rotations)
    • setAutoTurretFollow

      public Command 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.