]> git.taranathan.com Git - FRC2026.git/commitdiff
a
authormaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 6 Feb 2026 01:02:09 +0000 (17:02 -0800)
committermaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 6 Feb 2026 01:02:09 +0000 (17:02 -0800)
src/main/java/frc/robot/subsystems/turret/Turret.java
vendordeps/yams.json [new file with mode: 0644]

index 8a1630f5467651fe6d928aab3a59b1d46c3c572e..ad3e5a077387b4f959ba8f4a69c78b6c4f8d10de 100644 (file)
@@ -32,6 +32,8 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
 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{
 
@@ -56,6 +58,8 @@ 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);
@@ -123,6 +127,22 @@ public class Turret extends SubsystemBase implements TurretIO{
                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(
diff --git a/vendordeps/yams.json b/vendordeps/yams.json
new file mode 100644 (file)
index 0000000..9557c14
--- /dev/null
@@ -0,0 +1,21 @@
+{
+    "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