Skip to content

Commit 87fbc45

Browse files
authored
Merge pull request #8 from Coconuts2486-FRC/Az-RBSI_template_sync_bf20be4
[bot] Update Robot Code with latest version of Az-RBSI
2 parents 2453ce8 + 041c69e commit 87fbc45

File tree

9 files changed

+84
-122
lines changed

9 files changed

+84
-122
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "2025.0",
3+
"command": {
4+
"type": "sequential",
5+
"data": {
6+
"commands": [
7+
{
8+
"type": "path",
9+
"data": {
10+
"pathName": "Consistancy Test"
11+
}
12+
}
13+
]
14+
}
15+
},
16+
"resetOdom": true,
17+
"folder": null,
18+
"choreoAuto": false
19+
}

src/main/deploy/pathplanner/paths/Consistancy Test.path

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
"waypoints": [
44
{
55
"anchor": {
6-
"x": 9.400179398148147,
7-
"y": 6.184303023726215
6+
"x": 9.35,
7+
"y": 6.18
88
},
99
"prevControl": null,
1010
"nextControl": {
11-
"x": 8.752472205652685,
12-
"y": 6.17933470428246
11+
"x": 9.141987426415538,
12+
"y": 6.318675049056306
1313
},
1414
"isLocked": false,
1515
"linkedName": null
1616
},
1717
{
1818
"anchor": {
1919
"x": 8.18,
20-
"y": 6.184303023726215
20+
"y": 6.18
2121
},
2222
"prevControl": {
23-
"x": 8.642916609125686,
24-
"y": 6.1899481811172015
23+
"x": 8.56,
24+
"y": 6.17
2525
},
2626
"nextControl": null,
2727
"isLocked": false,
@@ -33,15 +33,15 @@
3333
"pointTowardsZones": [],
3434
"eventMarkers": [],
3535
"globalConstraints": {
36-
"maxVelocity": 1.0,
37-
"maxAcceleration": 4.0,
36+
"maxVelocity": 0.5,
37+
"maxAcceleration": 1.0,
3838
"maxAngularVelocity": 540.0,
39-
"maxAngularAcceleration": 1200.0,
39+
"maxAngularAcceleration": 720.0,
4040
"nominalVoltage": 12.0,
4141
"unlimited": false
4242
},
4343
"goalEndState": {
44-
"velocity": 0.0,
44+
"velocity": 0,
4545
"rotation": 0.0
4646
},
4747
"reversed": false,
Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
{
2-
"robotWidth": 0.813,
3-
"robotLength": 0.813,
2+
"robotWidth": 0.9,
3+
"robotLength": 0.9,
44
"holonomicMode": true,
55
"pathFolders": [],
66
"autoFolders": [],
7-
"defaultMaxVel": 4.0,
8-
"defaultMaxAccel": 7.0,
7+
"defaultMaxVel": 3.0,
8+
"defaultMaxAccel": 3.0,
99
"defaultMaxAngVel": 540.0,
10-
"defaultMaxAngAccel": 1200.0,
11-
"defaultNominalVoltage": 12.0,
12-
"robotMass": 55.0,
10+
"defaultMaxAngAccel": 720.0,
11+
"robotMass": 74.088,
1312
"robotMOI": 6.883,
13+
"robotWheelbase": 0.546,
1414
"robotTrackwidth": 0.546,
1515
"driveWheelRadius": 0.048,
16-
"driveGearing": 6.75,
16+
"driveGearing": 5.143,
1717
"maxDriveSpeed": 5.45,
1818
"driveMotorType": "krakenX60FOC",
19-
"driveCurrentLimit": 50.0,
20-
"wheelCOF": 1.1,
21-
"flModuleX": 0.263525,
22-
"flModuleY": 0.263525,
23-
"frModuleX": 0.263525,
24-
"frModuleY": -0.263525,
25-
"blModuleX": -0.263525,
26-
"blModuleY": 0.263525,
27-
"brModuleX": -0.263525,
28-
"brModuleY": -0.263525,
29-
"bumperOffsetX": 0.0,
30-
"bumperOffsetY": 0.0,
31-
"robotFeatures": []
19+
"driveCurrentLimit": 60.0,
20+
"wheelCOF": 1.2
3221
}

src/main/java/frc/robot/Constants.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public final class Constants {
7676
private static AutoType autoType = AutoType.PATHPLANNER; // PATHPLANNER, CHOREO
7777
private static VisionType visionType = VisionType.NONE; // PHOTON, LIMELIGHT, NONE
7878

79-
// private static PracticeSpace practiceSpace = PracticeSpace.NUTHOUSE; // NUTHOUSE, FIELD
80-
8179
/** Enumerate the robot types (name your robots here) */
8280
public static enum RobotType {
8381
DEVBOT, // Development / Alpha / Practice Bot
@@ -137,12 +135,7 @@ public static final class DrivebaseConstants {
137135
// Theoretical free speed (m/s) at 12v applied output;
138136
// IMPORTANT: Follow the AdvantageKit instructions for measuring the ACTUAL maximum linear speed
139137
// of YOUR ROBOT, and replace the estimate here with your measured value!
140-
// public static final double kMaxLinearSpeed =
141-
// switch (practiceSpace) {
142-
// case NUTHOUSE -> Units.feetToMeters(1);
143-
// case FIELD -> Units.feetToMeters(18);
144-
// };
145-
public static final double kMaxLinearSpeed = Units.feetToMeters(6);
138+
public static final double kMaxLinearSpeed = Units.feetToMeters(18);
146139

147140
// Set 3/4 of a rotation per second as the max angular velocity (radians/sec)
148141
public static final double kMaxAngularSpeed = 1.5 * Math.PI;
@@ -249,9 +242,8 @@ public static class OperatorConstants {
249242
public static final class AutoConstants {
250243

251244
// Drive and Turn PID constants used for PathPlanner
252-
public static final PIDConstants kPPdrivePID = new PIDConstants(1.9, 0.0, 0.0);
253-
public static final PIDConstants kPPsteerPID = new PIDConstants(1.9, 0.0, 0.0);
254-
// 1 Cordinate = 39.3437945791726
245+
public static final PIDConstants kPPdrivePID = new PIDConstants(5.0, 0.0, 0.0);
246+
public static final PIDConstants kPPsteerPID = new PIDConstants(5.0, 0.0, 0.0);
255247

256248
// PathPlanner Config constants
257249
public static final RobotConfig kPathPlannerConfig =

src/main/java/frc/robot/RobotContainer.java

Lines changed: 33 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import edu.wpi.first.wpilibj2.command.Commands;
3636
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
3737
import edu.wpi.first.wpilibj2.command.button.RobotModeTriggers;
38+
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
3839
import frc.robot.Constants.AprilTagConstants.AprilTagLayoutType;
3940
import frc.robot.Constants.OperatorConstants;
4041
import frc.robot.commands.DriveCommands;
@@ -193,32 +194,6 @@ public RobotContainer() {
193194
configureBindings();
194195
}
195196

196-
// // Create a list of waypoints from poses. Each pose represents one waypoint.
197-
// // The rotation component of the pose should be the direction of travel. Do not use holonomic
198-
// rotation.
199-
// List<Waypoint> waypoints = PathPlannerPath.waypointsFromPoses(
200-
// new Pose2d(1.0, 1.0, Rotation2d.fromDegrees(0)),
201-
// new Pose2d(5.0, 3.0, Rotation2d.fromDegrees(90))
202-
// );
203-
204-
// PathConstraints constraints = new PathConstraints(3.0, 3.0, 2 * Math.PI, 4 * Math.PI); // The
205-
// constraints for this path.
206-
// // PathConstraints constraints = PathConstraints.unlimitedConstraints(12.0); // You can also
207-
// use unlimited constraints, only limited by motor torque and nominal battery voltage
208-
209-
// // Create the path using the waypoints created above
210-
// PathPlannerPath path = new PathPlannerPath(
211-
// waypoints,
212-
// constraints,
213-
// null, // The ideal starting state, this is only relevant for pre-planned paths, so can be
214-
// null for on-the-fly paths.
215-
// new GoalEndState(0.0, Rotation2d.fromDegrees(-90)) // Goal end state. You can set a holonomic
216-
// rotation here. If using a differential drivetrain, the rotation will have no effect.
217-
// );
218-
219-
// // Prevent the path from being flipped if the coordinates are already correct
220-
// path.preventFlipping = true;
221-
222197
/** Use this method to define your Autonomous commands for use with PathPlanner / Choreo */
223198
private void defineAutoCommands() {
224199

@@ -288,10 +263,6 @@ private void configureBindings() {
288263
m_drivebase)
289264
.ignoringDisable(true));
290265

291-
driverController
292-
.leftBumper()
293-
.onTrue(Commands.runOnce(() -> new Pose2d(10.0, 10.0, new Rotation2d())));
294-
295266
// Press RIGHT BUMPER --> Run the example flywheel
296267
driverController
297268
.rightBumper()
@@ -351,38 +322,38 @@ public void updateAlerts() {
351322
private void definesysIdRoutines() {
352323
if (Constants.getAutoType() == RBSIEnum.AutoType.PATHPLANNER) {
353324
// Drivebase characterization
354-
// autoChooserPathPlanner.addOption(
355-
// "Drive Wheel Radius Characterization",
356-
// DriveCommands.wheelRadiusCharacterization(m_drivebase));
357-
// autoChooserPathPlanner.addOption(
358-
// "Drive Simple FF Characterization",
359-
// DriveCommands.feedforwardCharacterization(m_drivebase));
360-
// autoChooserPathPlanner.addOption(
361-
// "Drive SysId (Quasistatic Forward)",
362-
// m_drivebase.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
363-
// autoChooserPathPlanner.addOption(
364-
// "Drive SysId (Quasistatic Reverse)",
365-
// m_drivebase.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
366-
// autoChooserPathPlanner.addOption(
367-
// "Drive SysId (Dynamic Forward)",
368-
// m_drivebase.sysIdDynamic(SysIdRoutine.Direction.kForward));
369-
// autoChooserPathPlanner.addOption(
370-
// "Drive SysId (Dynamic Reverse)",
371-
// m_drivebase.sysIdDynamic(SysIdRoutine.Direction.kReverse));
372-
373-
// // Example Flywheel SysId Characterization
374-
// autoChooserPathPlanner.addOption(
375-
// "Flywheel SysId (Quasistatic Forward)",
376-
// m_flywheel.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
377-
// autoChooserPathPlanner.addOption(
378-
// "Flywheel SysId (Quasistatic Reverse)",
379-
// m_flywheel.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
380-
// autoChooserPathPlanner.addOption(
381-
// "Flywheel SysId (Dynamic Forward)",
382-
// m_flywheel.sysIdDynamic(SysIdRoutine.Direction.kForward));
383-
// autoChooserPathPlanner.addOption(
384-
// "Flywheel SysId (Dynamic Reverse)",
385-
// m_flywheel.sysIdDynamic(SysIdRoutine.Direction.kReverse));
325+
autoChooserPathPlanner.addOption(
326+
"Drive Wheel Radius Characterization",
327+
DriveCommands.wheelRadiusCharacterization(m_drivebase));
328+
autoChooserPathPlanner.addOption(
329+
"Drive Simple FF Characterization",
330+
DriveCommands.feedforwardCharacterization(m_drivebase));
331+
autoChooserPathPlanner.addOption(
332+
"Drive SysId (Quasistatic Forward)",
333+
m_drivebase.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
334+
autoChooserPathPlanner.addOption(
335+
"Drive SysId (Quasistatic Reverse)",
336+
m_drivebase.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
337+
autoChooserPathPlanner.addOption(
338+
"Drive SysId (Dynamic Forward)",
339+
m_drivebase.sysIdDynamic(SysIdRoutine.Direction.kForward));
340+
autoChooserPathPlanner.addOption(
341+
"Drive SysId (Dynamic Reverse)",
342+
m_drivebase.sysIdDynamic(SysIdRoutine.Direction.kReverse));
343+
344+
// Example Flywheel SysId Characterization
345+
autoChooserPathPlanner.addOption(
346+
"Flywheel SysId (Quasistatic Forward)",
347+
m_flywheel.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
348+
autoChooserPathPlanner.addOption(
349+
"Flywheel SysId (Quasistatic Reverse)",
350+
m_flywheel.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
351+
autoChooserPathPlanner.addOption(
352+
"Flywheel SysId (Dynamic Forward)",
353+
m_flywheel.sysIdDynamic(SysIdRoutine.Direction.kForward));
354+
autoChooserPathPlanner.addOption(
355+
"Flywheel SysId (Dynamic Reverse)",
356+
m_flywheel.sysIdDynamic(SysIdRoutine.Direction.kReverse));
386357
}
387358
}
388359

src/main/java/frc/robot/generated/TunerConstants.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class TunerConstants {
8888

8989
private static final double kDriveGearRatio = 6.746031746031747;
9090
private static final double kSteerGearRatio = 21.428571428571427;
91-
private static final Distance kWheelRadius = Inches.of(1.9875);
91+
private static final Distance kWheelRadius = Inches.of(2);
9292

9393
private static final boolean kInvertLeftSide = false;
9494
private static final boolean kInvertRightSide = true;
@@ -231,10 +231,10 @@ public class TunerConstants {
231231
kBackRightSteerMotorInverted,
232232
kBackRightEncoderInverted);
233233

234-
/**
235-
* Creates a CommandSwerveDrivetrain instance. This should only be called once in your robot
236-
* program,.
237-
*/
234+
// /**
235+
// * Creates a CommandSwerveDrivetrain instance.
236+
// * This should only be called once in your robot program,.
237+
// */
238238
// public static CommandSwerveDrivetrain createDrivetrain() {
239239
// return new CommandSwerveDrivetrain(
240240
// DrivetrainConstants, FrontLeft, FrontRight, BackLeft, BackRight

src/main/java/frc/robot/subsystems/drive/Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void periodic() {
5959
int sampleCount = inputs.odometryTimestamps.length; // All signals are sampled together
6060
odometryPositions = new SwerveModulePosition[sampleCount];
6161
for (int i = 0; i < sampleCount; i++) {
62-
double positionMeters = inputs.odometryDrivePositionsRad[i] * kWheelRadiusInches;
62+
double positionMeters = inputs.odometryDrivePositionsRad[i] * kWheelRadiusMeters;
6363
Rotation2d angle = inputs.odometryTurnPositions[i];
6464
odometryPositions[i] = new SwerveModulePosition(positionMeters, angle);
6565
}

src/main/java/frc/robot/subsystems/drive/SwerveConstants.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,8 @@ public class SwerveConstants {
113113
kCoupleRatio = TunerConstants.FrontLeft.CouplingGearRatio;
114114
kDriveGearRatio = TunerConstants.FrontLeft.DriveMotorGearRatio;
115115
kSteerGearRatio = TunerConstants.FrontLeft.SteerMotorGearRatio;
116-
// kWheelRadiusMeters = TunerConstants.FrontLeft.WheelRadius;
117-
// kWheelRadiusInches = Units.metersToInches(kWheelRadiusMeters);
118-
119-
kWheelRadiusInches = TunerConstants.FrontLeft.WheelRadius;
120-
kWheelRadiusMeters = Units.inchesToMeters(kWheelRadiusInches);
121-
116+
kWheelRadiusMeters = TunerConstants.FrontLeft.WheelRadius;
117+
kWheelRadiusInches = Units.metersToInches(kWheelRadiusMeters);
122118
kCANbusName = TunerConstants.DrivetrainConstants.CANBusName;
123119
kPigeonId = TunerConstants.DrivetrainConstants.Pigeon2Id;
124120
kSteerInertia = TunerConstants.FrontLeft.SteerInertia;

src/main/java/frc/robot/util/RBSIEnum.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,4 @@ public static enum MotorIdleMode {
5959
COAST, // Allow the motor to coast when idle
6060
BRAKE // Hold motor position when idle
6161
}
62-
63-
// public static enum PracticeSpace {
64-
// NUTHOUSE,
65-
// FIELD
66-
// }
6762
}

0 commit comments

Comments
 (0)