Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
update gear ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoticthegreat committed Nov 7, 2024
1 parent 4d0849a commit 5f41818
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ public class RobotContainer {
new BeamBreakIOAdafruit(SpindexConstants.kSpindexBeamBreakDIO));
private final Vision vision = new Vision(new VisionIOLimelight());

// private final Superstructure superstructure = // TODO: when uncommented also
// uncomment the
// private final Superstructure superstructure = // TODO: when uncommented also uncomment the
// periodic
// new Superstructure(
// ampevator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SpindexConstants {
public static final int spindexMotorID = 50;
public static final double spindexMotorVoltage = -7;
public static TalonFXConfiguration spindexMotorConfigs =
new TalonFXConfiguration() // TODO: tune
new TalonFXConfiguration()
.withSlot0(new Slot0Configs().withKS(0).withKV(0.1).withKP(1).withKI(0).withKD(0))
.withMotorOutput(
new MotorOutputConfigs()
Expand All @@ -36,7 +36,7 @@ public class SpindexConstants {
public static boolean useMotionMagic = false;
public static int kSpindexBeamBreakDIO = 1;
public static TalonFXConfiguration feederMotorConfigs =
new TalonFXConfiguration() // TODO: tune
new TalonFXConfiguration()
.withSlot0(new Slot0Configs().withKS(0).withKV(0.1).withKP(1).withKI(0).withKD(0))
.withMotorOutput(
new MotorOutputConfigs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

public final class SwerveConstants {
public static final PhoenixPIDController azimuthController =
new PhoenixPIDController(6, 0, 0); // you shouldn't have a I or D value TODO: tune
new PhoenixPIDController(6, 0, 0); // you shouldn't have a I or D value
public static final PIDConstants autoRotationalController =
new PIDConstants(6, azimuthController.getI(), azimuthController.getD()); // should be the same
public static final PIDConstants autoTranslationalController =
new PIDConstants(8, 0, 0); // you shouldn't have a I or D value TODO: tune
new PIDConstants(8, 0, 0); // you shouldn't have a I or D value

public static final List<Double> azimuthAngles = List.of(0.0, 90.0, 180.0, 270.0);
public static final double azimuthEpsilon = 10.0; // TODO: tune
public static final double azimuthEpsilon = 10.0;

public static final PIDController choreoTranslationController = new PIDController(8, 0, 0);
public static final PIDController choreoRotationController =
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/turret/Turret.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public Command setPositionFieldRelative(Rotation2d position, CommandSwerveDrivet
*/
public Command setPosition(Rotation2d position) {
return this.runOnce(
() -> turretIO.setPosition(position.getRotations() * TurretConstants.gearRatio));
() -> turretIO.setPosition(position.getRotations() / TurretConstants.gearRatio));
}

/**
* @return Command to zero the turret motor's encoder position
*/
public Command zero() {
return this.runOnce(() -> turretIO.zero());
return this.runOnce(turretIO::zero);
}

/**
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/frc/robot/subsystems/turret/TurretConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@

public final class TurretConstants {

public static int kCanCoderID1 = 41; // TODO: set id
public static int kCanCoderID2 = 42; // TODO: set id
public static int kCanCoderID1 = 41;
public static int kCanCoderID2 = 42;

public static final double gearRatio = 1; // TODO: Set gear ratio
public static final double gearRatio = 10.0 / 133; // TODO: Set gear ratio
public static final CANcoderConfiguration canCoderConfig =
new CANcoderConfiguration()
.withMagnetSensor(new MagnetSensorConfigs().withMagnetOffset(0)); // TODO: set config
new CANcoderConfiguration().withMagnetSensor(new MagnetSensorConfigs().withMagnetOffset(0));
public static final double updateFrequency = 50.0;

public static final int kTurretMotorID = 52; // TODO: Set ID
public static final int kTurretMotorID = 52;

public static final double followTagP = 1;
public static final double followTagI = 0;
Expand All @@ -40,7 +39,7 @@ public final class TurretConstants {
new Slot0Configs()
.withKS(0)
.withKV(0.05)
.withKP(25)
.withKP(1)
.withKI(0)
.withKD(0) // Original 0.145
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public final class VisionConstants {
public static final String turretLimelight = "limelight-speaker";

public static final double noteLimelightAngleDegrees = -29; // old -20.827
public static final double noteLimelightHeightInches = 21; // TODO: idk tune
public static final double noteHeightInches = 2; // TODO: idk tune
public static final double noteLimelightHeightInches = 21;
public static final double noteHeightInches = 2;

public static final Transform2d robotToCam =
new Transform2d(
Expand Down

0 comments on commit 5f41818

Please sign in to comment.