From aa296810489c49545b66b37faf85e4f631eba6a6 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 31 Oct 2023 18:10:11 -0400 Subject: [PATCH 1/5] enleve ligne inutile --- src/main/java/frc/robot/commands/Deaccumuler.java | 2 +- src/main/java/frc/robot/subsystems/Accumulateur.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/Deaccumuler.java b/src/main/java/frc/robot/commands/Deaccumuler.java index 4602e13..5342314 100644 --- a/src/main/java/frc/robot/commands/Deaccumuler.java +++ b/src/main/java/frc/robot/commands/Deaccumuler.java @@ -21,7 +21,7 @@ public class Deaccumuler extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - accumulateur.Deaccumuler(0.5); + } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/subsystems/Accumulateur.java b/src/main/java/frc/robot/subsystems/Accumulateur.java index 823e9e0..8d753d3 100644 --- a/src/main/java/frc/robot/subsystems/Accumulateur.java +++ b/src/main/java/frc/robot/subsystems/Accumulateur.java @@ -18,8 +18,8 @@ public class Accumulateur extends SubsystemBase { public Accumulateur() { } - public void Deaccumuler(double vitesse){ - moteuracc.set(vitesse); + public void Deaccumuler(){ + moteuracc.set(0.5); } public boolean limit(){ From 91a15ff7e5c0604fb04f3ad2374b28caba38f28d Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 18:16:02 -0400 Subject: [PATCH 2/5] Command lancer --- src/main/java/frc/robot/commands/Lancer.java | 13 ++++++++++--- src/main/java/frc/robot/subsystems/Lanceur.java | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/Lancer.java b/src/main/java/frc/robot/commands/Lancer.java index 78f7f6b..784b73d 100644 --- a/src/main/java/frc/robot/commands/Lancer.java +++ b/src/main/java/frc/robot/commands/Lancer.java @@ -19,15 +19,22 @@ public class Lancer extends CommandBase { // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + + lanceur.setPID(0, 0, 0); + } // Called every time the scheduler runs while the command is scheduled. @Override - public void execute() {} + public void execute() { + + lanceur.lancer(0); + } // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + lanceur.lancer(0); } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/subsystems/Lanceur.java b/src/main/java/frc/robot/subsystems/Lanceur.java index 15ff030..c611a4b 100644 --- a/src/main/java/frc/robot/subsystems/Lanceur.java +++ b/src/main/java/frc/robot/subsystems/Lanceur.java @@ -29,8 +29,15 @@ public class Lanceur extends SubsystemBase { } + public void stop() { + + } + @Override public void periodic() { // This method will be called once per scheduler run } + + public void setPID(double d, double e, int i) { + } } From 2a484b6f11d12ad59e17b0635b09241d62659523 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 31 Oct 2023 18:40:44 -0400 Subject: [PATCH 3/5] encodeur acc --- .../java/frc/robot/commands/Deaccumuler.java | 4 +-- .../java/frc/robot/commands/Reaccumuler.java | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/main/java/frc/robot/commands/Reaccumuler.java diff --git a/src/main/java/frc/robot/commands/Deaccumuler.java b/src/main/java/frc/robot/commands/Deaccumuler.java index 5342314..c87df83 100644 --- a/src/main/java/frc/robot/commands/Deaccumuler.java +++ b/src/main/java/frc/robot/commands/Deaccumuler.java @@ -16,7 +16,7 @@ public class Deaccumuler extends CommandBase { } // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() {accumulateur.Reset();} // Called every time the scheduler runs while the command is scheduled. @Override @@ -31,6 +31,6 @@ public class Deaccumuler extends CommandBase { // Returns true when the command should end. @Override public boolean isFinished() { - return false; + return (accumulateur.distance()< 1024); } } diff --git a/src/main/java/frc/robot/commands/Reaccumuler.java b/src/main/java/frc/robot/commands/Reaccumuler.java new file mode 100644 index 0000000..0c19887 --- /dev/null +++ b/src/main/java/frc/robot/commands/Reaccumuler.java @@ -0,0 +1,36 @@ +// 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.commands; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc.robot.subsystems.Accumulateur; + +public class Reaccumuler extends CommandBase { + private Accumulateur accumulateur; + /** Creates a new Lancer. */ + public Reaccumuler(Accumulateur accumulateur) { + this.accumulateur = accumulateur; + addRequirements(accumulateur); + } + // Called when the command is initially scheduled. + @Override + public void initialize() {accumulateur.Reset();} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return (accumulateur.distance()< -256); + } +} From c021b4136a2fecffb04d0bc924743a2aeaebf445 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 18:41:23 -0400 Subject: [PATCH 4/5] lancez --- src/main/java/frc/robot/commands/Lancez.java | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/main/java/frc/robot/commands/Lancez.java diff --git a/src/main/java/frc/robot/commands/Lancez.java b/src/main/java/frc/robot/commands/Lancez.java new file mode 100644 index 0000000..896d544 --- /dev/null +++ b/src/main/java/frc/robot/commands/Lancez.java @@ -0,0 +1,23 @@ +// 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.commands; + +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import frc.robot.subsystems.Accumulateur; +import frc.robot.subsystems.Lanceur; + + +// NOTE: Consider using this command inline, rather than writing a subclass. For more +// information, see: +// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html +public class Lancez extends SequentialCommandGroup { + /** Creates a new Lancez. + * @param Lanceur */ + public Lancez(Lancer lancer, Deaccumuler deaccumuler, Reaccumuler reaccumuler, Lanceur Lanceur) { + // Add your commands in the addCommands() call, e.g. + // addCommands(new FooCommand(), new BarCommand()); + addCommands(new Lancer(Lanceur), new Deaccumuler(Accumulateur)); + } +} From ca69544017a63353ae73bfc3c5981cb352e9d7cb Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 18:51:03 -0400 Subject: [PATCH 5/5] Lancez --- src/main/java/frc/robot/commands/Lancez.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/commands/Lancez.java b/src/main/java/frc/robot/commands/Lancez.java index 896d544..75c69df 100644 --- a/src/main/java/frc/robot/commands/Lancez.java +++ b/src/main/java/frc/robot/commands/Lancez.java @@ -13,11 +13,14 @@ import frc.robot.subsystems.Lanceur; // information, see: // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html public class Lancez extends SequentialCommandGroup { - /** Creates a new Lancez. - * @param Lanceur */ - public Lancez(Lancer lancer, Deaccumuler deaccumuler, Reaccumuler reaccumuler, Lanceur Lanceur) { + + public Lancez(Lanceur lanceur, Accumulateur accumulateur) { // Add your commands in the addCommands() call, e.g. // addCommands(new FooCommand(), new BarCommand()); - addCommands(new Lancer(Lanceur), new Deaccumuler(Accumulateur)); + addCommands(new Lancer(lanceur), new Deaccumuler(accumulateur), new Reaccumuler(accumulateur)); + } -} + + +public Lancez(Lancez lancez){} +} \ No newline at end of file