From 9c9d821939f1bc51ba738a25d4be0bacc57f1021 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Sat, 17 Feb 2024 13:27:27 -0500 Subject: [PATCH 1/6] b --- src/main/java/frc/robot/RobotContainer.java | 1 + src/main/java/frc/robot/command/Balayer.java | 2 +- src/main/java/frc/robot/subsystem/Accumulateur.java | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index cecc364..0b43edf 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -79,6 +79,7 @@ public class RobotContainer { CameraServer.startAutomaticCapture(); manette.a().whileTrue(new GuiderBas(guideur)); manette.b().whileTrue(new GuiderHaut(guideur)); + manette.x().whileTrue(new PistonFerme(grimpeur)); joystick.button(3).whileTrue(new Balayer(balayeuse, accumulateur)); joystick.button(1).whileTrue(new LancerNote(lanceur, accumulateur)); joystick.button(4).whileTrue(new ParallelCommandGroup(new Lancer(lanceur,limelight),new Limelight_tracker(limelight,drive))); diff --git a/src/main/java/frc/robot/command/Balayer.java b/src/main/java/frc/robot/command/Balayer.java index 58e3531..01a230d 100644 --- a/src/main/java/frc/robot/command/Balayer.java +++ b/src/main/java/frc/robot/command/Balayer.java @@ -29,7 +29,7 @@ public class Balayer extends Command { accumulateur.Accumuler(); } else{ - balayeuse.balaye(0.6); + balayeuse.balaye(0.3); accumulateur.Accumuler(); } } diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index f85e6c3..1e7a558 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -18,7 +18,7 @@ public class Accumulateur extends SubsystemBase { ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); private GenericEntry vitesse = - dashboard.add("vitesseacc", 1) + dashboard.add("vitesseacc", 0.1) .withSize(1, 1) .withPosition(4, 3) .getEntry(); @@ -41,11 +41,11 @@ public class Accumulateur extends SubsystemBase { dashboard.addBoolean("limitacc", this::limitswitch); } public void Accumuler(double vitesse){ - Moteuracc.set(vitesse); - Moteuracc2.set(vitesse); + Moteuracc.set(-vitesse); + Moteuracc2.set(-vitesse); } public void Accumuler(){ - Accumuler(vitesse.getDouble(0.1)); + Accumuler(vitesse.getDouble(0.3)); } @Override From 652353a05b9584f9c1123addb7520ec2d1aaa942 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Sat, 17 Feb 2024 13:47:22 -0500 Subject: [PATCH 2/6] ws --- src/main/java/frc/robot/Constants.java | 2 - .../java/frc/robot/command/LancerAmp.java | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/main/java/frc/robot/command/LancerAmp.java diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 12bb4c1..5735435 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -46,8 +46,6 @@ public class Constants { public static int guideurhaut = 4; public static int guideurbas = 5; public static int photocellacc = 2; - public static int limithaut = 4; - public static int limitbas = 5; //piston public static int pistondroiteouvre= 6; diff --git a/src/main/java/frc/robot/command/LancerAmp.java b/src/main/java/frc/robot/command/LancerAmp.java new file mode 100644 index 0000000..0392f21 --- /dev/null +++ b/src/main/java/frc/robot/command/LancerAmp.java @@ -0,0 +1,50 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystem.Accumulateur; +import frc.robot.subsystem.Lanceur; + +public class LancerAmp extends Command { + private Lanceur lancer; + private Accumulateur accumulateur; + /** Creates a new LancerNote. */ + public LancerAmp(Lanceur lancer, Accumulateur accumulateur) { + this.lancer = lancer; + this.accumulateur = accumulateur; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize(){} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + double vitesse = 0.1; + lancer.lanceramp(); + if(lancer.vitesse(vitesse)>vitesse){ + accumulateur.Accumuler(); + } + else{ + accumulateur.Accumuler(0); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + lancer.lancer(0); + accumulateur.Accumuler(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From f890ec4daa8029d159d0896b34433a52eb2c42a2 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Sat, 17 Feb 2024 13:47:34 -0500 Subject: [PATCH 3/6] commit --- src/main/java/frc/robot/command/LancerNote.java | 4 ++-- src/main/java/frc/robot/subsystem/Accumulateur.java | 4 ---- src/main/java/frc/robot/subsystem/Lanceur.java | 10 +++++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/frc/robot/command/LancerNote.java b/src/main/java/frc/robot/command/LancerNote.java index 8cc3a4a..1c32ce5 100644 --- a/src/main/java/frc/robot/command/LancerNote.java +++ b/src/main/java/frc/robot/command/LancerNote.java @@ -26,7 +26,7 @@ public class LancerNote extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - double vitesse = 0.5; + double vitesse = 0.8; lancer.lancerspeaker(); if(lancer.vitesse(vitesse)>vitesse){ accumulateur.Accumuler(); @@ -39,7 +39,7 @@ public class LancerNote extends Command { // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - lancer.vitesse(0); + lancer.lancer(0); accumulateur.Accumuler(0); } diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index 22611c4..cf52f21 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -18,11 +18,7 @@ public class Accumulateur extends SubsystemBase { ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); private GenericEntry vitesse = -<<<<<<< HEAD - dashboard.add("vitesseacc", 0.1) -======= dashboard.add("vitesseacc", 0.5) ->>>>>>> 9d55ab9afa804a6ffb304aee298f28ad470c396d .withSize(1, 1) .withPosition(4, 3) .getEntry(); diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index bd4f7fc..7730b2b 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -16,12 +16,12 @@ public class Lanceur extends SubsystemBase { /** Creates a new Lanceur. */ ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); private GenericEntry vitesse = - dashboard.add("vitesse", 0.5) + dashboard.add("vitesse", 0.8) .withSize(1, 1) .withPosition(3, 3) .getEntry(); private GenericEntry vitesseamp = - dashboard.add("vitesseamp", 0.4) + dashboard.add("vitesseamp", 0.1) .withSize(1, 1) .withPosition(3, 4) .getEntry(); @@ -42,13 +42,13 @@ public class Lanceur extends SubsystemBase { lanceur4.set(-vitesse); } public void lancerspeaker(){ - lancer(vitesse.getDouble(0.5)); + lancer(vitesse.getDouble(0.8)); } public void lanceramp(){ - lancer(vitesseamp.getDouble(0.4)); + lancer(vitesseamp.getDouble(0.1)); } public double vitesse(double vitesse){ - return lanceur1.getEncoder().getVelocity(); + return lanceur3.getEncoder().getVelocity(); } public void lanceur(){ From 8f8633a250aac11b5fbe2df0a82ab27474bd4fb6 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Sat, 17 Feb 2024 13:47:53 -0500 Subject: [PATCH 4/6] s --- src/main/java/frc/robot/subsystem/Accumulateur.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index 22611c4..cf52f21 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -18,11 +18,7 @@ public class Accumulateur extends SubsystemBase { ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); private GenericEntry vitesse = -<<<<<<< HEAD - dashboard.add("vitesseacc", 0.1) -======= dashboard.add("vitesseacc", 0.5) ->>>>>>> 9d55ab9afa804a6ffb304aee298f28ad470c396d .withSize(1, 1) .withPosition(4, 3) .getEntry(); From 17e8d85f7ee9bd5a766f8bca761ef9f6e5d40ba1 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Sat, 17 Feb 2024 13:56:50 -0500 Subject: [PATCH 5/6] j --- src/main/java/frc/robot/RobotContainer.java | 2 ++ src/main/java/frc/robot/subsystem/Accumulateur.java | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 22d113d..5765337 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -27,6 +27,7 @@ import frc.robot.command.GrimpeurGauche; import frc.robot.command.GuiderBas; import frc.robot.command.GuiderHaut; import frc.robot.command.Lancer; +import frc.robot.command.LancerAmp; import frc.robot.command.LancerNote; import frc.robot.command.Lancerampli; import frc.robot.command.Limelight_tracker; @@ -82,6 +83,7 @@ public class RobotContainer { manette.x().whileTrue(new PistonFerme(grimpeur)); joystick.button(3).whileTrue(balayer); joystick.button(1).whileTrue(new LancerNote(lanceur, accumulateur)); + joystick.button(5).whileTrue(new LancerAmp(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))); diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index cf52f21..00d56b7 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -26,13 +26,7 @@ public class Accumulateur extends SubsystemBase { final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc); final DigitalInput photocellacc = new DigitalInput(Constants.photocellacc); - public void Deaccumuler(double vitesse){ - Moteuracc2.set(-vitesse); - Moteuracc.set(-vitesse); - } - public void moteuraccfollow(){ - - } + public boolean limitswitch(){ return photocellacc.get(); } From fafc79523ea469d907bc9519db9cb53606676aed Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Sat, 17 Feb 2024 14:15:03 -0500 Subject: [PATCH 6/6] changement petit code vers gros --- src/main/java/frc/robot/Constants.java | 2 +- src/main/java/frc/robot/command/GrimpeurDroit.java | 6 ++---- .../java/frc/robot/command/GrimpeurGauche.java | 14 ++++++++------ src/main/java/frc/robot/command/PistonFerme.java | 6 ++++-- src/main/java/frc/robot/subsystem/Grimpeur.java | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 5735435..cdb9911 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -48,5 +48,5 @@ public class Constants { public static int photocellacc = 2; //piston - public static int pistondroiteouvre= 6; + public static int pistondroiteouvre= 7; } diff --git a/src/main/java/frc/robot/command/GrimpeurDroit.java b/src/main/java/frc/robot/command/GrimpeurDroit.java index 162d692..cb53ba4 100644 --- a/src/main/java/frc/robot/command/GrimpeurDroit.java +++ b/src/main/java/frc/robot/command/GrimpeurDroit.java @@ -24,16 +24,14 @@ public class GrimpeurDroit extends Command { @Override public void initialize() { grimpeur.resetencodeurd(); - grimpeur.pistonferme(); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { grimpeur.droit(doubleSupplier.getAsDouble()); - if(grimpeur.encoderd()>78){ - grimpeur.droit(0); - + if(grimpeur.encoderd()<73){ + grimpeur.droit(doubleSupplier.getAsDouble()); } else if(grimpeur.getpitch()<-15){ grimpeur.droit(-doubleSupplier.getAsDouble()); diff --git a/src/main/java/frc/robot/command/GrimpeurGauche.java b/src/main/java/frc/robot/command/GrimpeurGauche.java index ea9d860..df8891e 100644 --- a/src/main/java/frc/robot/command/GrimpeurGauche.java +++ b/src/main/java/frc/robot/command/GrimpeurGauche.java @@ -23,17 +23,17 @@ public class GrimpeurGauche extends Command { // Called when the command is initially scheduled. @Override public void initialize() { - grimpeur.resetencodeurd(); grimpeur.resetencodeurg(); + } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { grimpeur.gauche(doubleSupplier.getAsDouble()); - if(grimpeur.encoderg()>73){ - grimpeur.gauche(0); - } + if(grimpeur.encoderg()<78){ + grimpeur.gauche(doubleSupplier.getAsDouble()); + } else if(grimpeur.getpitch()<-15){ grimpeur.gauche(doubleSupplier.getAsDouble()); } @@ -43,10 +43,12 @@ public class GrimpeurGauche extends Command { else{ grimpeur.gauche(0); } - if(grimpeur.encoderd()>0){ + if(grimpeur.encoderg()<0){ + grimpeur.gauche(doubleSupplier.getAsDouble()); + } + else{ grimpeur.resetencodeurg(); grimpeur.gauche(0); - } } diff --git a/src/main/java/frc/robot/command/PistonFerme.java b/src/main/java/frc/robot/command/PistonFerme.java index b4ef3fd..c072790 100644 --- a/src/main/java/frc/robot/command/PistonFerme.java +++ b/src/main/java/frc/robot/command/PistonFerme.java @@ -19,7 +19,7 @@ public class PistonFerme extends Command { // Called when the command is initially scheduled. @Override public void initialize() { - grimpeur.pistonferme(); + grimpeur.pistonouvre(); } // Called every time the scheduler runs while the command is scheduled. @@ -28,7 +28,9 @@ public class PistonFerme extends Command { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + grimpeur.pistonferme(); + } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/subsystem/Grimpeur.java b/src/main/java/frc/robot/subsystem/Grimpeur.java index 045a1be..e16af68 100644 --- a/src/main/java/frc/robot/subsystem/Grimpeur.java +++ b/src/main/java/frc/robot/subsystem/Grimpeur.java @@ -28,7 +28,7 @@ public class Grimpeur extends SubsystemBase { final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless); final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless); // limit switch - final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre); + final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.REVPH, Constants.pistondroiteouvre); //fonction public Grimpeur() { pistonouvre();