From 89703286ea48ea743f0e970e62d5df8e2955b069 Mon Sep 17 00:00:00 2001 From: Bob Bell Date: Sun, 7 Apr 2024 09:34:58 -0400 Subject: [PATCH] Add smart BCAD autos --- .../pathplanner/autos/BC-direct-AD start.auto | 138 +++++++++++++++++ .../deploy/pathplanner/autos/BCAD start.auto | 144 ++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 26 ++++ 3 files changed, 308 insertions(+) create mode 100644 src/main/deploy/pathplanner/autos/BC-direct-AD start.auto create mode 100644 src/main/deploy/pathplanner/autos/BCAD start.auto diff --git a/src/main/deploy/pathplanner/autos/BC-direct-AD start.auto b/src/main/deploy/pathplanner/autos/BC-direct-AD start.auto new file mode 100644 index 0000000..4a6d477 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/BC-direct-AD start.auto @@ -0,0 +1,138 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.33, + "y": 5.54 + }, + "rotation": 0.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Startup delay" + } + }, + { + "type": "named", + "data": { + "name": "Shoot without aiming" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "Subwoofer to B" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Shoot without aiming" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "B to C for shooting" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Shoot" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "C to A" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Shoot" + } + }, + { + "type": "race", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Intake note" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "A to D" + } + }, + { + "type": "wait", + "data": { + "waitTime": 0.5 + } + } + ] + } + } + ] + } + } + ] + } + }, + "folder": "Partial", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/BCAD start.auto b/src/main/deploy/pathplanner/autos/BCAD start.auto new file mode 100644 index 0000000..45d3ea2 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/BCAD start.auto @@ -0,0 +1,144 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.33, + "y": 5.54 + }, + "rotation": 0.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Startup delay" + } + }, + { + "type": "named", + "data": { + "name": "Shoot without aiming" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "Subwoofer to B" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Shoot without aiming" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "B to C" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "C to B" + } + }, + { + "type": "named", + "data": { + "name": "Shoot" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "B to A" + } + }, + { + "type": "named", + "data": { + "name": "Intake note" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "Shoot" + } + }, + { + "type": "race", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Intake note" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "A to D" + } + }, + { + "type": "wait", + "data": { + "waitTime": 0.5 + } + } + ] + } + } + ] + } + } + ] + } + }, + "folder": "Partial", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f678d2f..1c6f9a3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -338,6 +338,32 @@ private void buildAutos(SendableChooser chooser) { ).withName("Smart ADE"); chooser.addOption("Smart ADE", smartADE); + Command smartBCAD = + Commands.sequence( + new PathPlannerAuto("BCAD start"), + Commands.runOnce(() -> { System.out.println("Ready for conditional part: " + s_Index.haveNote()); }), + Commands.either( + Commands.print("Running DE from A").andThen(new PathPlannerAuto("DE from A")), + Commands.print("Running D-E-Shoot").andThen(new PathPlannerAuto("D-E-Shoot")), + s_Index::haveNote + ), + Commands.print("Conditional part over") + ).withName("Smart BCAD"); + chooser.addOption("Smart BCAD", smartBCAD); + + Command smartBCdirectAD = + Commands.sequence( + new PathPlannerAuto("BC-direct-AD start"), + Commands.runOnce(() -> { System.out.println("Ready for conditional part: " + s_Index.haveNote()); }), + Commands.either( + Commands.print("Running DE from A").andThen(new PathPlannerAuto("DE from A")), + Commands.print("Running D-E-Shoot").andThen(new PathPlannerAuto("D-E-Shoot")), + s_Index::haveNote + ), + Commands.print("Conditional part over") + ).withName("Smart BC-direct-AD"); + chooser.addOption("Smart BC-direct-AD", smartBCdirectAD); + Command smartADEOTF = Commands.sequence( new PathPlannerAuto("Amp-side OTF + AD"),