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

Commit e29b2d7

Browse files
locked in
1 parent 87e213b commit e29b2d7

File tree

10 files changed

+113
-81
lines changed

10 files changed

+113
-81
lines changed

src/main/java/frc/robot/subsystems/ampevator/AmpevatorConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public final class AmpevatorConstants {
1717

18-
public static final int ampevatorID = 62;
18+
public static final int ampevatorID = 47;
1919
public static final int ampevatorBeamBreakID = 0;
2020

2121
public static final TalonFXConfiguration motorConfigs =

src/main/java/frc/robot/subsystems/ampevatorrollers/RollerConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public final class RollerConstants {
1515
/* CAN */
16-
public static final int kRollerMotorID = 33;
16+
public static final int kRollerMotorID = 49;
1717

1818
public static final double kRollerOuttakeVoltage = 12;
1919

src/main/java/frc/robot/subsystems/climb/ClimbConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public final class ClimbConstants {
1515

16-
public static final int kLeftClimbMotorID = 18;
16+
public static final int kLeftClimbMotorID = 45;
1717
public static final double gearRatio = 20; // needs to be tuned
1818

1919
public static final double kClimbUpPosition = 150 / 20;

src/main/java/frc/robot/subsystems/intake/IntakeConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public final class IntakeConstants {
1515
/* CAN */
16-
public static final int kIntakeMotorID = 33;
16+
public static final int kIntakeMotorID = 46;
1717

1818
public static final double kIntakeIntakeVoltage = 12;
1919

src/main/java/frc/robot/subsystems/pivotshooter/PivotShooterConstants.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public final class PivotShooterConstants {
2020
public static final double kSubWooferPreset = 3.4 / 138.33; // 3.2
2121
public static final double kFeederPreset = 5.9 / 138.33;
2222

23-
public static final int kPivotMotorID = 60;
23+
public static final int kPivotMotorID = 51;
2424

2525
/* PID */
2626

@@ -33,7 +33,7 @@ public final class PivotShooterConstants {
3333

3434
/* Misc */
3535
public static final boolean kUseFOC = false;
36-
public static final boolean kUseMotionMagic = true; // idk
36+
public static final boolean kUseMotionMagic = false; // idk
3737
public static final double updateFrequency = 50.0;
3838
public static final int flashConfigRetries = 5;
3939
public static final double kPivotSlamStallCurrent = 50;
@@ -44,7 +44,7 @@ public final class PivotShooterConstants {
4444
new Slot0Configs()
4545
.withKS(0)
4646
.withKV(0)
47-
.withKP(10)
47+
.withKP(2)
4848
.withKI(0)
4949
.withKD(0)
5050
.withKG(1)
@@ -54,10 +54,10 @@ public final class PivotShooterConstants {
5454
new MotorOutputConfigs()
5555
.withNeutralMode(NeutralModeValue.Brake)
5656
.withInverted(InvertedValue.Clockwise_Positive))
57-
.withMotionMagic(
58-
new MotionMagicConfigs()
59-
.withMotionMagicAcceleration(400)
60-
.withMotionMagicCruiseVelocity(50))
57+
// .withMotionMagic(
58+
// new MotionMagicConfigs()
59+
// .withMotionMagicAcceleration(400)
60+
// .withMotionMagicCruiseVelocity(50))
6161
.withCurrentLimits(
6262
new CurrentLimitsConfigs()
6363
.withStatorCurrentLimitEnable(true)

src/main/java/frc/robot/subsystems/shooter/ShooterConstants.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public final class ShooterConstants {
1717
public static final boolean kUseFOC = true;
1818
public static final boolean kUseShooterRegenBraking = true;
1919
/* CAN */
20-
public static int kShooterMotorID = 11;
21-
public static int kShooterMotorFollowerID = 23;
20+
public static int kShooterMotorRightID = 43;
21+
public static int kShooterMotorLeftID = 48;
2222
/* PID */
2323
// Shooter
2424
public static MotorOutputConfigs motorOutputConfigs =
@@ -30,12 +30,12 @@ public final class ShooterConstants {
3030
.withSlot0(
3131
new Slot0Configs()
3232
.withKS(0)
33-
.withKV(0.145) // Original 0.145
33+
.withKV(0.15) // Original 0.145
3434
// .withKA(1.48)// Original 0 only for feedforward, might not
3535
// use
36-
.withKP(0.4)
36+
.withKP(8)
3737
.withKI(0)
38-
.withKD(0))
38+
.withKD(0.1))
3939
// For regenerative braking
4040
// we need to make sure that the backcurrent is below the breaker limit
4141
// P = 2 gives us like 102 amps so that's good enough

src/main/java/frc/robot/subsystems/shooter/ShooterIOTalonFX.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import frc.robot.utils.PhoenixUtil;
1515

1616
public class ShooterIOTalonFX implements ShooterIO {
17-
private final TalonFX shooterMotor = new TalonFX(ShooterConstants.kShooterMotorID);
17+
private final TalonFX shooterMotor = new TalonFX(ShooterConstants.kShooterMotorRightID);
1818
final VelocityVoltage velocityRequest = new VelocityVoltage(0).withSlot(0);
1919
final MotionMagicVelocityVoltage motionMagicRequest =
2020
new MotionMagicVelocityVoltage(0).withSlot(0);
@@ -29,8 +29,7 @@ public class ShooterIOTalonFX implements ShooterIO {
2929
private final StatusSignal<Double> shooterMotorReferenceSlope =
3030
shooterMotor.getClosedLoopReferenceSlope();
3131

32-
private final TalonFX shooterMotorFollower =
33-
new TalonFX(ShooterConstants.kShooterMotorFollowerID);
32+
private final TalonFX shooterMotorFollower = new TalonFX(ShooterConstants.kShooterMotorLeftID);
3433
final VelocityVoltage velocityRequestFollower = new VelocityVoltage(0).withSlot(0);
3534
final MotionMagicVelocityVoltage motionMagicRequestFollower =
3635
new MotionMagicVelocityVoltage(0).withSlot(0);

src/main/java/frc/robot/subsystems/spindex/SpindexConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.ctre.phoenix6.signals.NeutralModeValue;
1313

1414
public class SpindexConstants {
15-
public static final int spindexMotorID = 0;
15+
public static final int spindexMotorID = 50;
1616
public static final double spindexMotorVoltage = -7;
1717
public static TalonFXConfiguration spindexMotorConfigs =
1818
new TalonFXConfiguration() // TODO: tune
@@ -52,6 +52,6 @@ public class SpindexConstants {
5252
.withStatorCurrentLimitEnable(true)
5353
.withStatorCurrentLimit(80));
5454
;
55-
public static int shooterFeederMotorID = 43;
55+
public static int shooterFeederMotorID = 44;
5656
public static double shooterFeederVoltage = 7;
5757
}

src/main/java/frc/robot/subsystems/swerve/TunerConstants.java

Lines changed: 90 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
package frc.robot.subsystems.swerve;
99

10+
import com.ctre.phoenix6.configs.CANcoderConfiguration;
11+
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
12+
import com.ctre.phoenix6.configs.Pigeon2Configuration;
1013
import com.ctre.phoenix6.configs.Slot0Configs;
14+
import com.ctre.phoenix6.configs.TalonFXConfiguration;
1115
import com.ctre.phoenix6.mechanisms.swerve.SwerveDrivetrainConstants;
1216
import com.ctre.phoenix6.mechanisms.swerve.SwerveModule.ClosedLoopOutputType;
1317
import com.ctre.phoenix6.mechanisms.swerve.SwerveModuleConstants;
@@ -28,7 +32,7 @@ public class TunerConstants {
2832
// When using closed-loop control, the drive motor uses the control
2933
// output type specified by SwerveModuleConstants.DriveMotorClosedLoopOutput
3034
private static final Slot0Configs driveGains =
31-
new Slot0Configs().withKP(.1).withKI(0).withKD(0).withKS(0).withKV(0.12).withKA(0);
35+
new Slot0Configs().withKP(3).withKI(0).withKD(0).withKS(0).withKV(0).withKA(0);
3236

3337
// The closed-loop output type to use for the steer motors;
3438
// This affects the PID/FF gains for the steer motors
@@ -39,7 +43,24 @@ public class TunerConstants {
3943

4044
// The stator current at which the wheels start to slip;
4145
// This needs to be tuned to your individual robot
42-
private static final double kSlipCurrentA = 75.0;
46+
private static final double kSlipCurrentA = 150.0;
47+
48+
// Initial configs for the drive and steer motors and the CANcoder; these cannot be null.
49+
// Some configs will be overwritten; check the `with*InitialConfigs()` API documentation.
50+
private static final TalonFXConfiguration driveInitialConfigs = new TalonFXConfiguration();
51+
private static final TalonFXConfiguration steerInitialConfigs =
52+
new TalonFXConfiguration()
53+
.withCurrentLimits(
54+
new CurrentLimitsConfigs()
55+
// Swerve azimuth does not require much torque output, so we can set a relatively
56+
// low
57+
// stator current limit to help avoid brownouts without impacting performance.
58+
.withStatorCurrentLimit(60)
59+
.withStatorCurrentLimitEnable(true));
60+
private static final CANcoderConfiguration cancoderInitialConfigs = new CANcoderConfiguration();
61+
// Configs for the Pigeon 2; leave this null to skip applying Pigeon 2 configs
62+
private static final Pigeon2Configuration pigeonConfigs = null;
63+
4364
// Theoretical free speed (m/s) at 12v applied output;
4465
// This needs to be tuned to your individual robot
4566
public static final double kSpeedAt12VoltsMps = 5.96;
@@ -52,12 +73,11 @@ public class TunerConstants {
5273
private static final double kSteerGearRatio = 21.428571428571427;
5374
private static final double kWheelRadiusInches = 2;
5475

55-
private static final boolean kSteerMotorReversed = true;
5676
private static final boolean kInvertLeftSide = false;
5777
private static final boolean kInvertRightSide = true;
5878

5979
private static final String kCANbusName = "mani";
60-
private static final int kPigeonId = 24;
80+
private static final int kPigeonId = 4;
6181

6282
// These are only used for simulation
6383
private static final double kSteerInertia = 0.00001;
@@ -67,7 +87,10 @@ public class TunerConstants {
6787
private static final double kDriveFrictionVoltage = 0.25;
6888

6989
private static final SwerveDrivetrainConstants DrivetrainConstants =
70-
new SwerveDrivetrainConstants().withPigeon2Id(kPigeonId).withCANbusName(kCANbusName);
90+
new SwerveDrivetrainConstants()
91+
.withCANbusName(kCANbusName)
92+
.withPigeon2Id(kPigeonId)
93+
.withPigeon2Configs(pigeonConfigs);
7194

7295
private static final SwerveModuleConstantsFactory ConstantCreator =
7396
new SwerveModuleConstantsFactory()
@@ -86,80 +109,90 @@ public class TunerConstants {
86109
.withDriveFrictionVoltage(kDriveFrictionVoltage)
87110
.withFeedbackSource(SteerFeedbackType.FusedCANcoder)
88111
.withCouplingGearRatio(kCoupleRatio)
89-
.withSteerMotorInverted(kSteerMotorReversed);
112+
.withDriveMotorInitialConfigs(driveInitialConfigs)
113+
.withSteerMotorInitialConfigs(steerInitialConfigs)
114+
.withCANcoderInitialConfigs(cancoderInitialConfigs);
90115

91116
// Front Left
92-
private static final int kFrontLeftDriveMotorId = 1;
93-
private static final int kFrontLeftSteerMotorId = 8;
94-
private static final int kFrontLeftEncoderId = 2;
95-
private static final double kFrontLeftEncoderOffset = -0.067626953125;
117+
private static final int kFrontLeftDriveMotorId = 8;
118+
private static final int kFrontLeftSteerMotorId = 7;
119+
private static final int kFrontLeftEncoderId = 23;
120+
private static final double kFrontLeftEncoderOffset = -0.399658203125;
121+
private static final boolean kFrontLeftSteerInvert = true;
96122

97-
private static final double kFrontLeftXPosInches = 10.375;
98-
private static final double kFrontLeftYPosInches = 10.375;
123+
private static final double kFrontLeftXPosInches = 11;
124+
private static final double kFrontLeftYPosInches = 11;
99125

100126
// Front Right
101-
private static final int kFrontRightDriveMotorId = 6;
102-
private static final int kFrontRightSteerMotorId = 7;
103-
private static final int kFrontRightEncoderId = 9;
104-
private static final double kFrontRightEncoderOffset = -0.27099609375;
127+
private static final int kFrontRightDriveMotorId = 9;
128+
private static final int kFrontRightSteerMotorId = 21;
129+
private static final int kFrontRightEncoderId = 22;
130+
private static final double kFrontRightEncoderOffset = -0.46142578125;
131+
private static final boolean kFrontRightSteerInvert = true;
105132

106-
private static final double kFrontRightXPosInches = 10.375;
107-
private static final double kFrontRightYPosInches = -10.375;
133+
private static final double kFrontRightXPosInches = 11;
134+
private static final double kFrontRightYPosInches = -11;
108135

109136
// Back Left
110137
private static final int kBackLeftDriveMotorId = 2;
111-
private static final int kBackLeftSteerMotorId = 4;
112-
private static final int kBackLeftEncoderId = 1;
113-
private static final double kBackLeftEncoderOffset = -0.125732421875;
138+
private static final int kBackLeftSteerMotorId = 0;
139+
private static final int kBackLeftEncoderId = 24;
140+
private static final double kBackLeftEncoderOffset = 0.275390625;
141+
private static final boolean kBackLeftSteerInvert = true;
114142

115-
private static final double kBackLeftXPosInches = -10.375;
116-
private static final double kBackLeftYPosInches = 10.375;
143+
private static final double kBackLeftXPosInches = -11;
144+
private static final double kBackLeftYPosInches = 11;
117145

118146
// Back Right
119-
private static final int kBackRightDriveMotorId = 5;
120-
private static final int kBackRightSteerMotorId = 0;
121-
private static final int kBackRightEncoderId = 0;
122-
private static final double kBackRightEncoderOffset = 0.41455078125;
147+
private static final int kBackRightDriveMotorId = 1;
148+
private static final int kBackRightSteerMotorId = 3;
149+
private static final int kBackRightEncoderId = 25;
150+
private static final double kBackRightEncoderOffset = -0.2666015625;
151+
private static final boolean kBackRightSteerInvert = true;
123152

124-
private static final double kBackRightXPosInches = -10.375;
125-
private static final double kBackRightYPosInches = -10.375;
153+
private static final double kBackRightXPosInches = -11;
154+
private static final double kBackRightYPosInches = -11;
126155

127156
private static final SwerveModuleConstants FrontLeft =
128157
ConstantCreator.createModuleConstants(
129-
kFrontLeftSteerMotorId,
130-
kFrontLeftDriveMotorId,
131-
kFrontLeftEncoderId,
132-
kFrontLeftEncoderOffset,
133-
Units.inchesToMeters(kFrontLeftXPosInches),
134-
Units.inchesToMeters(kFrontLeftYPosInches),
135-
kInvertLeftSide);
158+
kFrontLeftSteerMotorId,
159+
kFrontLeftDriveMotorId,
160+
kFrontLeftEncoderId,
161+
kFrontLeftEncoderOffset,
162+
Units.inchesToMeters(kFrontLeftXPosInches),
163+
Units.inchesToMeters(kFrontLeftYPosInches),
164+
kInvertLeftSide)
165+
.withSteerMotorInverted(kFrontLeftSteerInvert);
136166
private static final SwerveModuleConstants FrontRight =
137167
ConstantCreator.createModuleConstants(
138-
kFrontRightSteerMotorId,
139-
kFrontRightDriveMotorId,
140-
kFrontRightEncoderId,
141-
kFrontRightEncoderOffset,
142-
Units.inchesToMeters(kFrontRightXPosInches),
143-
Units.inchesToMeters(kFrontRightYPosInches),
144-
kInvertRightSide);
168+
kFrontRightSteerMotorId,
169+
kFrontRightDriveMotorId,
170+
kFrontRightEncoderId,
171+
kFrontRightEncoderOffset,
172+
Units.inchesToMeters(kFrontRightXPosInches),
173+
Units.inchesToMeters(kFrontRightYPosInches),
174+
kInvertRightSide)
175+
.withSteerMotorInverted(kFrontRightSteerInvert);
145176
private static final SwerveModuleConstants BackLeft =
146177
ConstantCreator.createModuleConstants(
147-
kBackLeftSteerMotorId,
148-
kBackLeftDriveMotorId,
149-
kBackLeftEncoderId,
150-
kBackLeftEncoderOffset,
151-
Units.inchesToMeters(kBackLeftXPosInches),
152-
Units.inchesToMeters(kBackLeftYPosInches),
153-
kInvertLeftSide);
178+
kBackLeftSteerMotorId,
179+
kBackLeftDriveMotorId,
180+
kBackLeftEncoderId,
181+
kBackLeftEncoderOffset,
182+
Units.inchesToMeters(kBackLeftXPosInches),
183+
Units.inchesToMeters(kBackLeftYPosInches),
184+
kInvertLeftSide)
185+
.withSteerMotorInverted(kBackLeftSteerInvert);
154186
private static final SwerveModuleConstants BackRight =
155187
ConstantCreator.createModuleConstants(
156-
kBackRightSteerMotorId,
157-
kBackRightDriveMotorId,
158-
kBackRightEncoderId,
159-
kBackRightEncoderOffset,
160-
Units.inchesToMeters(kBackRightXPosInches),
161-
Units.inchesToMeters(kBackRightYPosInches),
162-
kInvertRightSide);
188+
kBackRightSteerMotorId,
189+
kBackRightDriveMotorId,
190+
kBackRightEncoderId,
191+
kBackRightEncoderOffset,
192+
Units.inchesToMeters(kBackRightXPosInches),
193+
Units.inchesToMeters(kBackRightYPosInches),
194+
kInvertRightSide)
195+
.withSteerMotorInverted(kBackRightSteerInvert);
163196

164197
public static final CommandSwerveDrivetrain DriveTrain =
165198
new CommandSwerveDrivetrain(

src/main/java/frc/robot/subsystems/turret/TurretConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414

1515
public final class TurretConstants {
1616

17-
public static int kCanCoderID1 = 0; // TODO: set id
18-
public static int kCanCoderID2 = 0; // TODO: set id
17+
public static int kCanCoderID1 = 41; // TODO: set id
18+
public static int kCanCoderID2 = 42; // TODO: set id
1919

2020
public static final double gearRatio = 1; // TODO: Set gear ratio
2121
public static final CANcoderConfiguration canCoderConfig =
2222
new CANcoderConfiguration()
2323
.withMagnetSensor(new MagnetSensorConfigs().withMagnetOffset(0)); // TODO: set config
2424
public static final double updateFrequency = 50.0;
2525

26-
public static final int kTurretMotorID = 0; // TODO: Set ID
26+
public static final int kTurretMotorID = 52; // TODO: Set ID
2727

2828
public static final double followTagP = 1;
2929
public static final double followTagI = 0;

0 commit comments

Comments
 (0)