import frc.robot.constants.Constants;
import frc.robot.constants.IdConstants;
import frc.robot.constants.swerve.DriveConstants;
+import yams.units.EasyCRT;
+import yams.units.EasyCRTConfig;
public class Turret extends SubsystemBase implements TurretIO{
private double lastFrameVelocity = 0.0;
+ EasyCRT easyCRT;
+
/* ---------------- Hardware ---------------- */
private final TalonFX motor = new TalonFX(IdConstants.TURRET_MOTOR_ID, Constants.RIO_CAN);
setpoint = new State(getPositionRad(), 0.0);
lastGoalRad = setpoint.position;
+ EasyCRTConfig crt_cfg = new EasyCRTConfig(null, null)
+ .withEncoderRatios(TurretConstants.LEFT_ENCODER_RATIO, TurretConstants.RIGHT_ENCODER_RATIO)
+ .withAbsoluteEncoderOffsets(Rotations.of(Units.degreesToRotations(TurretConstants.LEFT_ENCODER_OFFSET)), Rotations.of(Units.degreesToRotations(TurretConstants.RIGHT_ENCODER_OFFSET)))
+ .withMechanismRange(Degrees.of(TurretConstants.MIN_ANGLE), Degrees.of(TurretConstants.MAX_ANGLE))
+ .withMatchTolerance(Degrees.of(2)) // Tune this
+ .withAbsoluteEncoderInversions(false, false)
+ // shared drive gear / pinion (the tan gear/tiny first gear on motor shaft)
+ // turret ring / shared drive pulley (big turret gear / first black belt gear weird thingy?)
+ .withCrtGearRecommendationInputs(10, 140.0/22.0); // prob need to fix
+
+ this.easyCRT = new EasyCRT(crt_cfg);
+
+ this.easyCRT.getAngleOptional().ifPresent(angle -> {
+ motor.setPosition(angle.in(Rotations) * gearRatio);
+ });
+
if (RobotBase.isSimulation()) {
simState = motor.getSimState();
turretSim = new SingleJointedArmSim(
--- /dev/null
+{
+ "fileName": "yams.json",
+ "name": "Yet Another Mechanism System",
+ "version": "2026.2.3",
+ "frcYear": "2026",
+ "uuid": "a1051e86-a979-4880-a28b-a0d5362d1d96",
+ "mavenUrls": [
+ "https://yet-another-software-suite.github.io/YAMS/releases/"
+ ],
+ "jsonUrl": "https://yet-another-software-suite.github.io/YAMS/yams.json",
+ "javaDependencies": [
+ {
+ "groupId": "yams",
+ "artifactId": "YAMS-java",
+ "version": "2026.2.3"
+ }
+ ],
+ "cppDependencies": [],
+ "jniDependencies": [],
+ "requires": []
+}
\ No newline at end of file