From 443d56b3f015baed52c01cb01e0fbc80ae9371ec Mon Sep 17 00:00:00 2001 From: Liam Murray Date: Sat, 8 Feb 2025 16:32:09 -0500 Subject: [PATCH] L1 + L2 Autos work --- .../pathplanner/autos/1-Piece Coral 2G1.auto | 17 ++++++- .../pathplanner/autos/1-Piece Coral 2G2.auto | 44 +++++++++++++++++++ .../paths/1 - A go to top source.path | 2 +- .../paths/1 - B go to top source.path | 2 +- .../pathplanner/paths/1 - score coral.path | 2 +- .../paths/From left 1 to source.path | 2 +- .../pathplanner/paths/Start2 to ReefG .path | 10 ++--- src/main/deploy/pathplanner/settings.json | 32 +++++++------- src/main/java/frc/robot/CommandSequences.java | 10 ++++- src/main/java/frc/robot/Robot.java | 3 ++ src/main/java/frc/robot/maps/ColdStart.java | 2 +- 11 files changed, 97 insertions(+), 29 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/1-Piece Coral 2G2.auto diff --git a/src/main/deploy/pathplanner/autos/1-Piece Coral 2G1.auto b/src/main/deploy/pathplanner/autos/1-Piece Coral 2G1.auto index 71a6936..b0f2ba5 100644 --- a/src/main/deploy/pathplanner/autos/1-Piece Coral 2G1.auto +++ b/src/main/deploy/pathplanner/autos/1-Piece Coral 2G1.auto @@ -5,9 +5,22 @@ "data": { "commands": [ { - "type": "path", + "type": "parallel", "data": { - "pathName": "Start2 to ReefG " + "commands": [ + { + "type": "path", + "data": { + "pathName": "Start2 to ReefG " + } + }, + { + "type": "named", + "data": { + "name": "Position Coral L1" + } + } + ] } }, { diff --git a/src/main/deploy/pathplanner/autos/1-Piece Coral 2G2.auto b/src/main/deploy/pathplanner/autos/1-Piece Coral 2G2.auto new file mode 100644 index 0000000..78b3d51 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/1-Piece Coral 2G2.auto @@ -0,0 +1,44 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Zero Da Elevatah" + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "Start2 to ReefG " + } + }, + { + "type": "named", + "data": { + "name": "Position Coral L2" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Score Coral L2" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/1 - A go to top source.path b/src/main/deploy/pathplanner/paths/1 - A go to top source.path index 5d53185..177dfbc 100644 --- a/src/main/deploy/pathplanner/paths/1 - A go to top source.path +++ b/src/main/deploy/pathplanner/paths/1 - A go to top source.path @@ -45,7 +45,7 @@ "rotation": -53.28579702395382 }, "reversed": false, - "folder": "New Folder", + "folder": null, "idealStartingState": { "velocity": 0, "rotation": -59.582522575463145 diff --git a/src/main/deploy/pathplanner/paths/1 - B go to top source.path b/src/main/deploy/pathplanner/paths/1 - B go to top source.path index a32373e..81f3eae 100644 --- a/src/main/deploy/pathplanner/paths/1 - B go to top source.path +++ b/src/main/deploy/pathplanner/paths/1 - B go to top source.path @@ -45,7 +45,7 @@ "rotation": -53.28579702395382 }, "reversed": false, - "folder": "New Folder", + "folder": null, "idealStartingState": { "velocity": 0, "rotation": -59.582522575463145 diff --git a/src/main/deploy/pathplanner/paths/1 - score coral.path b/src/main/deploy/pathplanner/paths/1 - score coral.path index a786f6d..46257c9 100644 --- a/src/main/deploy/pathplanner/paths/1 - score coral.path +++ b/src/main/deploy/pathplanner/paths/1 - score coral.path @@ -45,7 +45,7 @@ "rotation": -59.74193780533312 }, "reversed": false, - "folder": "New Folder", + "folder": null, "idealStartingState": { "velocity": 0, "rotation": -53.65165382024256 diff --git a/src/main/deploy/pathplanner/paths/From left 1 to source.path b/src/main/deploy/pathplanner/paths/From left 1 to source.path index 791e47f..b82fc7d 100644 --- a/src/main/deploy/pathplanner/paths/From left 1 to source.path +++ b/src/main/deploy/pathplanner/paths/From left 1 to source.path @@ -45,7 +45,7 @@ "rotation": -52.92646451172692 }, "reversed": false, - "folder": "New Folder", + "folder": null, "idealStartingState": { "velocity": 0, "rotation": -58.615935245141955 diff --git a/src/main/deploy/pathplanner/paths/Start2 to ReefG .path b/src/main/deploy/pathplanner/paths/Start2 to ReefG .path index 2cec939..f010feb 100644 --- a/src/main/deploy/pathplanner/paths/Start2 to ReefG .path +++ b/src/main/deploy/pathplanner/paths/Start2 to ReefG .path @@ -3,13 +3,13 @@ "waypoints": [ { "anchor": { - "x": 7.6, + "x": 7.2, "y": 3.85 }, "prevControl": null, "nextControl": { - "x": 6.457169117647059, - "y": 3.8736213235294112 + "x": 6.710880681818183, + "y": 3.840525568181818 }, "isLocked": false, "linkedName": null @@ -20,8 +20,8 @@ "y": 3.85 }, "prevControl": { - "x": 5.6108727973981285, - "y": 3.8291280828919345 + "x": 6.28775641025641, + "y": 3.828910256410256 }, "nextControl": null, "isLocked": false, diff --git a/src/main/deploy/pathplanner/settings.json b/src/main/deploy/pathplanner/settings.json index 48b3a3b..912ac95 100644 --- a/src/main/deploy/pathplanner/settings.json +++ b/src/main/deploy/pathplanner/settings.json @@ -1,6 +1,6 @@ { - "robotWidth": 0.9, - "robotLength": 0.9, + "robotWidth": 0.8763, + "robotLength": 0.8763, "holonomicMode": true, "pathFolders": [ "CoralStationL to Reef", @@ -16,23 +16,23 @@ "defaultMaxAngVel": 540.0, "defaultMaxAngAccel": 720.0, "defaultNominalVoltage": 12.0, - "robotMass": 74.088, - "robotMOI": 6.883, + "robotMass": 58.0, + "robotMOI": 4.889, "robotTrackwidth": 0.546, - "driveWheelRadius": 0.048, + "driveWheelRadius": 0.1016, "driveGearing": 5.143, "maxDriveSpeed": 5.45, - "driveMotorType": "krakenX60", - "driveCurrentLimit": 60.0, - "wheelCOF": 1.2, - "flModuleX": 0.273, - "flModuleY": 0.273, - "frModuleX": 0.273, - "frModuleY": -0.273, - "blModuleX": -0.273, - "blModuleY": 0.273, - "brModuleX": -0.273, - "brModuleY": -0.273, + "driveMotorType": "vortex", + "driveCurrentLimit": 50.0, + "wheelCOF": 1.0, + "flModuleX": 0.289, + "flModuleY": 0.289, + "frModuleX": 0.289, + "frModuleY": -0.289, + "blModuleX": -0.289, + "blModuleY": 0.289, + "brModuleX": -0.289, + "brModuleY": -0.289, "bumperOffsetX": 0.0, "bumperOffsetY": 0.0, "robotFeatures": [] diff --git a/src/main/java/frc/robot/CommandSequences.java b/src/main/java/frc/robot/CommandSequences.java index 71149b0..12cb3a0 100644 --- a/src/main/java/frc/robot/CommandSequences.java +++ b/src/main/java/frc/robot/CommandSequences.java @@ -62,8 +62,16 @@ public Command scoreCoralAuto(ElevatorPresets level) { // L1 is different from the other scoring presets which is why its has it own // move to and score command + public Command positionL1Auto() { + return moveElevator(ElevatorPresets.SCOREL1); + } + public Command scoreL1Auto() { - return moveElevator(ElevatorPresets.SCOREL1).andThen(scoreL1()); + return scoreL1(); + } + + public Command positionL2Auto() { + return moveElevator(ElevatorPresets.SCOREL2); } // Scores on L1 preset, then stows elevator diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 29bc4d6..ecb55d9 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -62,9 +62,12 @@ public final class Robot extends CommandRobot { public void registerNamedCommands() { NamedCommands.registerCommand("Intake Game Piece", commandSequences.intake()); + NamedCommands.registerCommand("Position Coral L1", commandSequences.positionL1Auto()); + NamedCommands.registerCommand("Position Coral L2", commandSequences.positionL2Auto()); NamedCommands.registerCommand("Score Coral L1", commandSequences.scoreL1Auto()); NamedCommands.registerCommand("Score Coral L2", commandSequences.scoreCoralAuto(ElevatorPresets.SCOREL2)); NamedCommands.registerCommand("Score Coral L3", commandSequences.scoreCoralAuto(ElevatorPresets.SCOREL3)); + NamedCommands.registerCommand("Zero Da Elevatah", elevator.zero()); } @Autonomous(name = "No Auto", defaultAuto = true) diff --git a/src/main/java/frc/robot/maps/ColdStart.java b/src/main/java/frc/robot/maps/ColdStart.java index d075309..c24ef11 100644 --- a/src/main/java/frc/robot/maps/ColdStart.java +++ b/src/main/java/frc/robot/maps/ColdStart.java @@ -98,7 +98,7 @@ public SwerveDriveMap getDriveMap() { final double maxRotationRadianPerSecond = Math.PI; - RobotConfig config = new RobotConfig(68, 5000, new ModuleConfig( + RobotConfig config = new RobotConfig(68, 4.889, new ModuleConfig( 0.1016, 6000, 1.0, DCMotor.getNeoVortex(1), 50, 1), new Translation2d(MODULE_OFFSET_XY, MODULE_OFFSET_XY), new Translation2d(MODULE_OFFSET_XY, -MODULE_OFFSET_XY),