From a862197b73c32cffb11f6d5d9cfeae370d8ad714 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 15 Feb 2024 18:25:45 -0500 Subject: [PATCH] --- simgui.json | 33 +------ src/main/deploy/pathplanner/autos/9.auto | 94 +++++++++++++++++++ src/main/deploy/pathplanner/paths/9.path | 52 ++++++++++ src/main/java/frc/robot/RobotContainer.java | 2 +- .../frc/robot/command/GrimpeurGauche.java | 1 - .../java/frc/robot/command/LancerNote.java | 8 +- src/main/java/frc/robot/subsystem/Drive.java | 2 +- 7 files changed, 158 insertions(+), 34 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/9.auto create mode 100644 src/main/deploy/pathplanner/paths/9.path diff --git a/simgui.json b/simgui.json index fb42214..395e7c0 100644 --- a/simgui.json +++ b/simgui.json @@ -25,39 +25,9 @@ "header": { "open": true } - }, - "SPARK MAX [3]": { - "header": { - "open": true - } - }, - "Talon SRX[16]": { - "header": { - "open": true - } - }, - "Talon SRX[19]": { - "header": { - "open": true - } - }, - "Talon SRX[20]": { - "header": { - "open": true - } - }, - "Talon SRX[21]": { - "header": { - "open": true - } } }, "Solenoids": { - "0": { - "header": { - "open": true - } - }, "window": { "visible": true } @@ -104,6 +74,9 @@ } } }, + "NetworkTables Info": { + "visible": true + }, "NetworkTables View": { "visible": false }, diff --git a/src/main/deploy/pathplanner/autos/9.auto b/src/main/deploy/pathplanner/autos/9.auto new file mode 100644 index 0000000..f1fd8c4 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/9.auto @@ -0,0 +1,94 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.3, + "y": 5.55 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + }, + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + }, + { + "type": "named", + "data": { + "name": "balyer" + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + }, + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "9" + } + } + ] + } + }, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/9.path b/src/main/deploy/pathplanner/paths/9.path new file mode 100644 index 0000000..dfd5514 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/9.path @@ -0,0 +1,52 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 1.3, + "y": 5.55 + }, + "prevControl": null, + "nextControl": { + "x": 1.270750725349431, + "y": 5.55 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 7.782768629670277, + "y": 7.468314794111773 + }, + "prevControl": { + "x": 7.812017904320845, + "y": 7.468314794111773 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 5.0, + "maxAcceleration": 5.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 180.0, + "rotateFast": false + }, + "reversed": false, + "folder": null, + "previewStartingState": { + "rotation": -179.76648041708185, + "velocity": 0 + }, + "useDefaultConstraints": 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 4a68b42..015628c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -83,7 +83,7 @@ public class RobotContainer { joystick.button(1).whileTrue(new LancerNote(lanceur, accumulateur)); joystick.button(4).whileTrue(new ParallelCommandGroup(new Lancer(lanceur,limelight),new Limelight_tracker(limelight,drive))); joystick.button(2).whileTrue(new ParallelCommandGroup(new Lancerampli(lanceur,limelight),new Limelight_tracker(limelight,drive),new GuiderHaut(guideur))); - + // deplacement configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ diff --git a/src/main/java/frc/robot/command/GrimpeurGauche.java b/src/main/java/frc/robot/command/GrimpeurGauche.java index 3e7e46e..ae5234c 100644 --- a/src/main/java/frc/robot/command/GrimpeurGauche.java +++ b/src/main/java/frc/robot/command/GrimpeurGauche.java @@ -36,7 +36,6 @@ public class GrimpeurGauche extends Command { } else if(grimpeur.getpitch()<-15){ grimpeur.gauche(doubleSupplier.getAsDouble()); - } else if(grimpeur.getpitch()>15){ grimpeur.gauche(-doubleSupplier.getAsDouble()); diff --git a/src/main/java/frc/robot/command/LancerNote.java b/src/main/java/frc/robot/command/LancerNote.java index 133492b..15b74c1 100644 --- a/src/main/java/frc/robot/command/LancerNote.java +++ b/src/main/java/frc/robot/command/LancerNote.java @@ -31,11 +31,17 @@ public class LancerNote extends Command { if(lancer.vitesse(vitesse)>vitesse){ accumulateur.Accumuler(0.6); } + else{ + accumulateur.Accumuler(0); + } } // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + lancer.vitesse(0); + accumulateur.Accumuler(0); + } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/subsystem/Drive.java b/src/main/java/frc/robot/subsystem/Drive.java index 896d1e7..c7d72da 100644 --- a/src/main/java/frc/robot/subsystem/Drive.java +++ b/src/main/java/frc/robot/subsystem/Drive.java @@ -38,7 +38,7 @@ public class Drive extends SubsystemBase { e.printStackTrace(); } AutoBuilder.configureHolonomic(swerveDrive::getPose, swerveDrive::resetOdometry, swerveDrive::getRobotVelocity, swerveDrive::setChassisSpeeds, new HolonomicPathFollowerConfig( - new PIDConstants(5,0,0), new PIDConstants(5,0,0), 4.5, + new PIDConstants(5,0,0), new PIDConstants(5,0,0), 15, 0.275, new ReplanningConfig() ), ()->{