diff --git a/src/main/deploy/pathplanner/autos/TirSimple.auto b/src/main/deploy/pathplanner/autos/TirSimple.auto deleted file mode 100644 index 06339c3..0000000 --- a/src/main/deploy/pathplanner/autos/TirSimple.auto +++ /dev/null @@ -1,37 +0,0 @@ -{ - "version": "2025.0", - "command": { - "type": "sequential", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "TirerSimple" - } - }, - { - "type": "named", - "data": { - "name": "DescendreBalayeuse" - } - }, - { - "type": "named", - "data": { - "name": "Limelighter" - } - }, - { - "type": "named", - "data": { - "name": "Lancer" - } - } - ] - } - }, - "resetOdom": true, - "folder": null, - "choreoAuto": false -} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/DepotTirerReservoir.auto b/src/main/deploy/pathplanner/autos/Tirgrimpe.auto similarity index 60% rename from src/main/deploy/pathplanner/autos/DepotTirerReservoir.auto rename to src/main/deploy/pathplanner/autos/Tirgrimpe.auto index b73aedd..514be4d 100644 --- a/src/main/deploy/pathplanner/autos/DepotTirerReservoir.auto +++ b/src/main/deploy/pathplanner/autos/Tirgrimpe.auto @@ -4,49 +4,18 @@ "type": "sequential", "data": { "commands": [ + { + "type": "path", + "data": { + "pathName": "tirgrimpe1" + } + }, { "type": "named", "data": { "name": "DescendreBalayeuse" } }, - { - "type": "deadline", - "data": { - "commands": [ - { - "type": "wait", - "data": { - "waitTime": 3.0 - } - }, - { - "type": "path", - "data": { - "pathName": "Depot" - } - }, - { - "type": "named", - "data": { - "name": "Aspirer" - } - } - ] - } - }, - { - "type": "path", - "data": { - "pathName": "Tir" - } - }, - { - "type": "named", - "data": { - "name": "Limelighter" - } - }, { "type": "deadline", "data": { @@ -66,12 +35,6 @@ ] } }, - { - "type": "path", - "data": { - "pathName": "GrimperReservoir" - } - }, { "type": "named", "data": { diff --git a/src/main/deploy/pathplanner/paths/tirgrimpe1.path b/src/main/deploy/pathplanner/paths/tirgrimpe1.path new file mode 100644 index 0000000..df45b5d --- /dev/null +++ b/src/main/deploy/pathplanner/paths/tirgrimpe1.path @@ -0,0 +1,54 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 3.5991440798858774, + "y": 2.3465049928673327 + }, + "prevControl": null, + "nextControl": { + "x": 2.589928673323822, + "y": 1.7513266761768898 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 1.8783024251069897, + "y": 2.3465049928673327 + }, + "prevControl": { + "x": 2.706376604850214, + "y": 1.7125106990014274 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 33.11134196037204 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": 180.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/java/frc/robot/commands/DescendreGrimpeur.java b/src/main/java/frc/robot/commands/DescendreGrimpeur.java index c8da33e..67a6e9a 100644 --- a/src/main/java/frc/robot/commands/DescendreGrimpeur.java +++ b/src/main/java/frc/robot/commands/DescendreGrimpeur.java @@ -24,18 +24,21 @@ public class DescendreGrimpeur extends Command { @Override public void execute() { if(!grimpeur.Limit()){ - grimpeur.Grimper(-0.4); + grimpeur.GrimperGauche(-0.4); + grimpeur.GrimperDroit(-0.4); } else{ grimpeur.Reset(); - grimpeur.Grimper(0); + grimpeur.GrimperGauche(0); + grimpeur.GrimperDroit(0); } } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - grimpeur.Grimper(0); + grimpeur.GrimperGauche(0); + grimpeur.GrimperDroit(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/commands/MonterGrimpeur.java b/src/main/java/frc/robot/commands/MonterGrimpeur.java index d79b763..6c0bd98 100644 --- a/src/main/java/frc/robot/commands/MonterGrimpeur.java +++ b/src/main/java/frc/robot/commands/MonterGrimpeur.java @@ -25,18 +25,21 @@ public class MonterGrimpeur extends Command { public void execute() { if(Math.abs(grimpeur.Position()) < grimpeur.PositionFinal()){ - grimpeur.Grimper(0.5); + grimpeur.GrimperGauche(0.5); + grimpeur.GrimperDroit(0.5); System.out.println("monte"); } else { - grimpeur.Grimper(0); + grimpeur.GrimperGauche(0); + grimpeur.GrimperDroit(0); } } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - grimpeur.Grimper(0); + grimpeur.GrimperGauche(0); + grimpeur.GrimperDroit(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/subsystems/Grimpeur.java b/src/main/java/frc/robot/subsystems/Grimpeur.java index 9ffd566..1a2e3b2 100644 --- a/src/main/java/frc/robot/subsystems/Grimpeur.java +++ b/src/main/java/frc/robot/subsystems/Grimpeur.java @@ -22,9 +22,11 @@ public class Grimpeur extends SubsystemBase { DigitalInput limit = new DigitalInput(0); private GenericEntry EncodeurGrimpeur = teb.add("Position haut grimpeur", 100).getEntry(); - public void Grimper(double vitesse){ - grimpeur1.set(vitesse); + public void GrimperDroit(double vitesse){ grimpeur2.set(vitesse); + } + public void GrimperGauche(double vitesse){ + grimpeur1.set(vitesse); } public double Position(){ return grimpeur1.getEncoder().getPosition(); diff --git a/src/main/java/frc/robot/subsystems/LEDSubsystem.java b/src/main/java/frc/robot/subsystems/LEDSubsystem.java index 5002802..7506c38 100644 --- a/src/main/java/frc/robot/subsystems/LEDSubsystem.java +++ b/src/main/java/frc/robot/subsystems/LEDSubsystem.java @@ -20,6 +20,7 @@ import com.ctre.phoenix6.signals.RGBWColor; */ public class LEDSubsystem extends SubsystemBase { Timer _timer; + boolean q = true; ShuffleboardTab teb = Shuffleboard.getTab("teb"); private GenericEntry equipe = teb.add("equipe commence (bleu = ouvert, rouge = fermé)", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); @@ -39,7 +40,8 @@ public class LEDSubsystem extends SubsystemBase { m_candle.setControl(new SolidColor(0, 80).withColor(new RGBWColor(0, 0, 0, 0))); } public void Flash(boolean couleur){ - if(_timer.get() <0.5){ + Timer timer = new Timer(); + if(timer.get() <0.5){ if(couleur){ Bleu(); } @@ -49,13 +51,12 @@ public class LEDSubsystem extends SubsystemBase { } else{ Noir(); - _timer.reset(); + timer.reset(); } } public LEDSubsystem() { setDefaultCommand(updateLEDs()); _timer = new Timer(); - _timer.reset(); _timer.start(); } public boolean Equipe(){ @@ -67,39 +68,43 @@ public class LEDSubsystem extends SubsystemBase { * @return Command to run */ public Command updateLEDs() { - double temps = DriverStation.getMatchTime(); - System.out.println(temps); return run(() -> { + // if(q){ + // _timer.reset(); + // q = false; + // } + double temps = _timer.get(); + System.out.println(temps); if(Equipe()){ - if(temps > 110){ + if(temps > 30){ Vert(); } - else if(temps > 88){ + else if(temps > 52){ Bleu(); } - else if(temps > 85){ + else if(temps > 55){ Flash(true); } - else if(temps > 63){ + else if(temps > 67){ Rouge(); } - else if(temps > 60){ + else if(temps > 70){ Flash(false); } - else if(temps > 33){ + else if(temps > 103){ Bleu(); } - else if(temps > 30){ + else if(temps > 105){ Flash(true); } - else if(temps > 13){ + else if(temps > 127){ Rouge(); } - else if(temps > 10){ + else if(temps > 130){ Flash(false); } - else if(temps < 10){ + else if(temps < 140){ Vert(); } } @@ -136,6 +141,8 @@ public class LEDSubsystem extends SubsystemBase { Vert(); } } + // _timer.stop(); + }); } }