2
2
3
3
import java .util .HashMap ;
4
4
5
+ import com .ctre .phoenix6 .hardware .CANcoder ;
5
6
import com .pathplanner .lib .path .PathConstraints ;
6
7
7
8
import common .core .controllers .Controller ;
8
9
import common .core .controllers .PIDFFConfig ;
9
10
import common .core .controllers .Controller .Type ;
10
11
import common .core .swerve .SwerveConversions ;
11
12
import common .core .swerve .SwerveModuleConfig ;
13
+ import common .core .swerve .SwerveModuleConfig .SwerveEncoderConfig ;
12
14
import common .core .swerve .SwerveModuleConfig .SwerveMotorConfig ;
13
15
import common .hardware .motorcontroller .NAR_CANSpark ;
14
16
import common .hardware .motorcontroller .NAR_TalonFX ;
@@ -60,7 +62,7 @@ public static class AutoConstants {
60
62
public static class SwerveConstants {
61
63
public static final double RAMP_TIME = 3 ;
62
64
63
- public static final int pigeonID = 30 ;
65
+ public static final int pigeonID = 15 ;
64
66
65
67
/* Drivetrain Constants */
66
68
public static final double bumperLength = Units .inchesToMeters (5 );
@@ -107,9 +109,9 @@ public static class SwerveConstants {
107
109
// Theoretical: v = 4.96824, omega = 11.5
108
110
// Real: v = 4.5, omega = 10
109
111
// For safety, use less than theoretical and real values
110
- public static final double maxSpeed = 5.87 ;//4.8; //meters per second - 16.3 ft/sec
112
+ public static final double maxSpeed = 3 ;//4.8; //meters per second - 16.3 ft/sec
111
113
public static final double maxAttainableSpeed = maxSpeed ; //Stole from citrus.
112
- public static final double maxAcceleration = 5 ;
114
+ public static final double maxAcceleration = 1 ;
113
115
public static final double maxAngularVelocity = 8 ; //3; //11.5; // citrus: 10 - Mason look at this later wtf
114
116
public static final double maxAngularAcceleration = 2 * Math .PI ; //I stole from citrus.
115
117
@@ -130,38 +132,31 @@ public static class SwerveConstants {
130
132
131
133
public static final SwerveModuleConfig Mod0 = new SwerveModuleConfig (
132
134
0 ,
133
- new SwerveMotorConfig (new NAR_TalonFX (1 ), driveMotorConfig , drivePIDConfig ),
134
- new SwerveMotorConfig (new NAR_TalonFX (2 ), angleMotorConfig , anglePIDConfig ),
135
- 10 ,
136
- 63.017578125 - 180 ,
137
- canCoderInvert ,
138
- maxSpeed );
135
+ new SwerveMotorConfig (new NAR_TalonFX (1 , "Drivetrain" ), driveMotorConfig , drivePIDConfig ),
136
+ new SwerveMotorConfig (new NAR_TalonFX (2 , "Drivetrain" ), angleMotorConfig , anglePIDConfig ),
137
+ new SwerveEncoderConfig (new CANcoder (11 , "Drivetrain" ), 105.15 , canCoderInvert ),
138
+ maxSpeed
139
+ );
139
140
140
141
public static final SwerveModuleConfig Mod1 = new SwerveModuleConfig (
141
142
1 ,
142
- new SwerveMotorConfig (new NAR_TalonFX (3 ), driveMotorConfig , drivePIDConfig ),
143
- new SwerveMotorConfig (new NAR_TalonFX (4 ), angleMotorConfig , anglePIDConfig ),
144
- 11 ,
145
- 110.478515625 - 180 ,
146
- canCoderInvert ,
143
+ new SwerveMotorConfig (new NAR_TalonFX (3 , "Drivetrain" ), driveMotorConfig , drivePIDConfig ),
144
+ new SwerveMotorConfig (new NAR_TalonFX (4 , "Drivetrain" ), angleMotorConfig , anglePIDConfig ),
145
+ new SwerveEncoderConfig (new CANcoder (12 , "Drivetrain" ), -62.40234375 , canCoderInvert ),
147
146
maxSpeed );
148
147
149
148
public static final SwerveModuleConfig Mod2 = new SwerveModuleConfig (
150
149
2 ,
151
- new SwerveMotorConfig (new NAR_TalonFX (5 ), driveMotorConfig , drivePIDConfig ),
152
- new SwerveMotorConfig (new NAR_TalonFX (6 ), angleMotorConfig , anglePIDConfig ),
153
- 12 ,
154
- -48.076171875 + 180 ,
155
- canCoderInvert ,
150
+ new SwerveMotorConfig (new NAR_TalonFX (5 , "Drivetrain" ), driveMotorConfig , drivePIDConfig ),
151
+ new SwerveMotorConfig (new NAR_TalonFX (6 , "Drivetrain" ), angleMotorConfig , anglePIDConfig ),
152
+ new SwerveEncoderConfig (new CANcoder (13 , "Drivetrain" ), -84.287109375 , canCoderInvert ),
156
153
maxSpeed );
157
154
158
155
public static final SwerveModuleConfig Mod3 = new SwerveModuleConfig (
159
156
3 ,
160
- new SwerveMotorConfig (new NAR_TalonFX (7 ), driveMotorConfig , drivePIDConfig ),
161
- new SwerveMotorConfig (new NAR_TalonFX (8 ), angleMotorConfig , anglePIDConfig ),
162
- 13 ,
163
- -158.37890625000003 + 180 ,
164
- canCoderInvert ,
157
+ new SwerveMotorConfig (new NAR_TalonFX (7 , "Drivetrain" ), driveMotorConfig , drivePIDConfig ),
158
+ new SwerveMotorConfig (new NAR_TalonFX (8 , "Drivetrain" ), angleMotorConfig , anglePIDConfig ),
159
+ new SwerveEncoderConfig (new CANcoder (14 , "Drivetrain" ), 167.607421875 , canCoderInvert ),
165
160
maxSpeed );
166
161
167
162
public static final double turnkP = 5 ;
@@ -462,24 +457,26 @@ public static class AmperConstants {
462
457
public static final int ELEV_MOTOR_ID = 21 ;
463
458
public static final NAR_CANSpark ELEV_MOTOR = new NAR_CANSpark (ELEV_MOTOR_ID );
464
459
465
- public static final int ROLLER_MOTOR_ID = 20 ;
466
- public static final NAR_CANSpark ROLLER_MOTOR = new NAR_CANSpark (ROLLER_MOTOR_ID , ControllerType .CAN_SPARK_FLEX );
460
+ // public static final int ROLLER_MOTOR_ID = 20;
461
+ // public static final NAR_CANSpark ROLLER_MOTOR = new NAR_CANSpark(ROLLER_MOTOR_ID, ControllerType.CAN_SPARK_FLEX);
467
462
468
- public static final PIDFFConfig PIDConstants = new PIDFFConfig (0.1 , 0 , 0 , 0.2 , 0 , 0 , 0.3625 );
463
+ public static final PIDFFConfig PIDConstants = new PIDFFConfig (0.75 , 0 , 0 , 0.21115 , 0.00182 , 0.00182 , 0.0 );
469
464
public static final double MAX_VELOCTIY = 10000000 ;
470
465
public static final double MAX_ACCELERATION = 100000 ;
471
466
public static final Constraints TRAP_CONSTRAINTS = new Constraints (MAX_VELOCTIY , MAX_ACCELERATION );
472
467
473
468
public static final double POSITION_TOLERANCE = 0.25 ;
474
469
public static final double MIN_SETPOINT = 0 ;
475
- public static final double MAX_SETPOINT = 25 ;
470
+ public static final double MAX_SETPOINT = 21. 25 ;
476
471
public static final int CURRENT_LIMIT = 40 ;
477
472
478
- public static final double GEAR_RATIO = 1.0 / 15.0 ;
479
- public static final double WHEEL_CIRCUMFERENCE = Units .inchesToMeters (1.751 ) * Math .PI ;
473
+ public static final double GEAR_RATIO = 1.0 / ( 6 + 2 / 3 ) ;
474
+ public static final double WHEEL_CIRCUMFERENCE = Units .inchesToMeters (0.9023 ) * Math .PI ;
480
475
public static final double UNIT_CONV_FACTOR = GEAR_RATIO * WHEEL_CIRCUMFERENCE * 100 ;
481
476
482
477
public static final double ROLLER_POWER = 0.5 ;
478
+
479
+ public static final double AMPER_ANGLE = 31.96 ;
483
480
}
484
481
}
485
482
0 commit comments