From c021b4136a2fecffb04d0bc924743a2aeaebf445 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 18:41:23 -0400 Subject: [PATCH 01/10] 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 02/10] 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 From ab5bb442d1fed0d7ce9d759c4e7e4a1c3e9b4bb9 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 31 Oct 2023 18:51:46 -0400 Subject: [PATCH 03/10] grfcg --- src/main/java/frc/robot/RobotContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e34918e..d3dd718 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -17,9 +17,9 @@ public class RobotContainer { Drive drive = new Drive(); public RobotContainer() { configureBindings(); - drive.setDefaultCommand(new RunCommand(()->{ - drive.drive(manette1.getLeftX(), manette1.getLeftY(), manette1.getRightX()); - },drive)); + // drive.setDefaultCommand(new RunCommand(()->{ + // drive.drive(manette1.getLeftX(), manette1.getLeftY(), manette1.getRightX()); + //},drive)); } private void configureBindings() {} From dd4e115c3b6a9b565425ec04767d6cad413ba3e7 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 18:52:23 -0400 Subject: [PATCH 04/10] dfis --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e34918e..0c87142 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -3,7 +3,7 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot; - +import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; From 1dc4b31f4fd6f15c59ed956fba62c649bf4046b4 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 31 Oct 2023 19:10:05 -0400 Subject: [PATCH 05/10] joystick --- src/main/java/frc/robot/RobotContainer.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 0901441..c3d6163 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -9,20 +9,26 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; import frc.robot.subsystems.Drive; public class RobotContainer { - CommandXboxController manette1 = new CommandXboxController(0); - CommandXboxController manette2 = new CommandXboxController(0); + CommandXboxController manette = new CommandXboxController(0); + Joystick joystick1 = new Joystick(0); Drive drive = new Drive(); public RobotContainer() { configureBindings(); // drive.setDefaultCommand(new RunCommand(()->{ - // drive.drive(manette1.getLeftX(), manette1.getLeftY(), manette1.getRightX()); + // drive.drive(manette.getLeftX(), manette.getLeftY(), manette.getRightX()); //},drive)); + drive.setDefaultCommand(new RunCommand(()->{ + drive.drive(joystick1.getX(), -joystick1.getY(), joystick1.getZ()); + },drive)); } - private void configureBindings() {} + private void configureBindings() { + JoystickButton button =new JoystickButton(joystick1, 1); + } public Command getAutonomousCommand() { return Commands.print("No autonomous command configured"); From 633ebb0ac93fa96e366c3717f2eda0c5d3edb8fc Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 31 Oct 2023 19:57:56 -0400 Subject: [PATCH 06/10] Changer id swerve --- simgui-ds.json | 5 +++++ simgui.json | 11 ++++++++++- src/main/deploy/swerve/modules/backleft.json | 4 ++-- src/main/deploy/swerve/modules/backright.json | 6 +++--- src/main/deploy/swerve/modules/frontleft.json | 6 +++--- src/main/deploy/swerve/modules/frontright.json | 6 +++--- src/main/java/frc/robot/RobotContainer.java | 2 +- src/main/java/frc/robot/subsystems/Drive.java | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/simgui-ds.json b/simgui-ds.json index 73cc713..46c45d8 100644 --- a/simgui-ds.json +++ b/simgui-ds.json @@ -88,5 +88,10 @@ "buttonCount": 0, "povCount": 0 } + ], + "robotJoysticks": [ + { + "guid": "030000006d04000015c2000000000000" + } ] } diff --git a/simgui.json b/simgui.json index 449f4b1..be49c52 100644 --- a/simgui.json +++ b/simgui.json @@ -1,7 +1,16 @@ { "NTProvider": { "types": { - "/FMSInfo": "FMSInfo" + "/FMSInfo": "FMSInfo", + "/SmartDashboard/Field": "Field2d", + "/SmartDashboard/navX-Sensor[1]": "Gyro" + }, + "windows": { + "/SmartDashboard/Field": { + "window": { + "visible": true + } + } } } } diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index 3ae3fdd..ceabe5f 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -11,12 +11,12 @@ }, "angle": { "type": "sparkmax", - "id": 0, + "id": 1, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 2, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index c896a6e..1de02f1 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 3, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 4, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 5, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index 018c523..5ac2369 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 6, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 7, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 8, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index d3ccba2..50fccc3 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 9, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 10, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 11, "canbus": null }, "inverted": { diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index c3d6163..ed090c1 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -22,7 +22,7 @@ public class RobotContainer { // drive.drive(manette.getLeftX(), manette.getLeftY(), manette.getRightX()); //},drive)); drive.setDefaultCommand(new RunCommand(()->{ - drive.drive(joystick1.getX(), -joystick1.getY(), joystick1.getZ()); + drive.drive(joystick1.getX(), -joystick1.getY(), -joystick1.getZ()); },drive)); } diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index 7337a17..637b22c 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -18,7 +18,7 @@ public class Drive extends SubsystemBase { File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve"); public void drive(double x, double y, double zRotation){ - swerveDrive.drive(new Translation2d(x, y), zRotation, true, true); + swerveDrive.drive(new Translation2d(x, y), zRotation, true, false); } From 84f48cdbb8f09accb563ac9330dc9c211e5bb23d Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 1 Nov 2023 18:04:47 -0400 Subject: [PATCH 07/10] -z joystick --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index c3d6163..ed090c1 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -22,7 +22,7 @@ public class RobotContainer { // drive.drive(manette.getLeftX(), manette.getLeftY(), manette.getRightX()); //},drive)); drive.setDefaultCommand(new RunCommand(()->{ - drive.drive(joystick1.getX(), -joystick1.getY(), joystick1.getZ()); + drive.drive(joystick1.getX(), -joystick1.getY(), -joystick1.getZ()); },drive)); } From b5a40e219b8b621d50ea48a1cfbf1d62206a1061 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Wed, 1 Nov 2023 18:12:14 -0400 Subject: [PATCH 08/10] drgf --- src/main/java/frc/robot/commands/Lancer.java | 2 +- src/main/java/frc/robot/subsystems/Lanceur.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/Lancer.java b/src/main/java/frc/robot/commands/Lancer.java index 784b73d..efecd99 100644 --- a/src/main/java/frc/robot/commands/Lancer.java +++ b/src/main/java/frc/robot/commands/Lancer.java @@ -39,6 +39,6 @@ public class Lancer extends CommandBase { // Returns true when the command should end. @Override public boolean isFinished() { - return false; + return lanceur.distance()>1; } } diff --git a/src/main/java/frc/robot/subsystems/Lanceur.java b/src/main/java/frc/robot/subsystems/Lanceur.java index c611a4b..4c1bbfa 100644 --- a/src/main/java/frc/robot/subsystems/Lanceur.java +++ b/src/main/java/frc/robot/subsystems/Lanceur.java @@ -20,7 +20,7 @@ public class Lanceur extends SubsystemBase { } // encodeur - public double vitesse() { + public double distance() { return(lanceur.getEncoder().getPosition()); } From 561aab6d321ac6be236d236201a84b1b967f5027 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 1 Nov 2023 18:23:51 -0400 Subject: [PATCH 09/10] pus de lancez --- .../frc/robot/commands/{Lancez.java => Accumuler.java} | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) rename src/main/java/frc/robot/commands/{Lancez.java => Accumuler.java} (73%) diff --git a/src/main/java/frc/robot/commands/Lancez.java b/src/main/java/frc/robot/commands/Accumuler.java similarity index 73% rename from src/main/java/frc/robot/commands/Lancez.java rename to src/main/java/frc/robot/commands/Accumuler.java index 75c69df..e4f13ba 100644 --- a/src/main/java/frc/robot/commands/Lancez.java +++ b/src/main/java/frc/robot/commands/Accumuler.java @@ -12,15 +12,12 @@ 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 { +public class Accumuler extends SequentialCommandGroup { - public Lancez(Lanceur lanceur, Accumulateur accumulateur) { + public Accumuler(Accumulateur accumulateur) { // Add your commands in the addCommands() call, e.g. // addCommands(new FooCommand(), new BarCommand()); - addCommands(new Lancer(lanceur), new Deaccumuler(accumulateur), new Reaccumuler(accumulateur)); + addCommands(new Deaccumuler(accumulateur), new Reaccumuler(accumulateur)); } - - -public Lancez(Lancez lancez){} } \ No newline at end of file From 83fda9aa61594696be48f36953ae491a97d1baeb Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 1 Nov 2023 18:54:36 -0400 Subject: [PATCH 10/10] Changer ID swerve pour les bons --- src/main/deploy/swerve/modules/backleft.json | 6 +++--- src/main/deploy/swerve/modules/backright.json | 6 +++--- src/main/deploy/swerve/modules/frontleft.json | 6 +++--- src/main/deploy/swerve/modules/frontright.json | 6 +++--- src/main/java/frc/robot/commands/Accumuler.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index ceabe5f..9eecec3 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 8, "canbus": null }, "angle": { "type": "sparkmax", - "id": 1, + "id": 9, "canbus": null }, "encoder": { "type": "cancoder", - "id": 2, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index 1de02f1..4d87807 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 3, + "id": 11, "canbus": null }, "angle": { "type": "sparkmax", - "id": 4, + "id": 12, "canbus": null }, "encoder": { "type": "cancoder", - "id": 5, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index 5ac2369..e0168dc 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 6, + "id": 0, "canbus": null }, "angle": { "type": "sparkmax", - "id": 7, + "id": 1, "canbus": null }, "encoder": { "type": "cancoder", - "id": 8, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 50fccc3..b0dd13b 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 9, + "id": 17, "canbus": null }, "angle": { "type": "sparkmax", - "id": 10, + "id": 18, "canbus": null }, "encoder": { "type": "cancoder", - "id": 11, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/java/frc/robot/commands/Accumuler.java b/src/main/java/frc/robot/commands/Accumuler.java index e4f13ba..89a90e7 100644 --- a/src/main/java/frc/robot/commands/Accumuler.java +++ b/src/main/java/frc/robot/commands/Accumuler.java @@ -14,7 +14,7 @@ import frc.robot.subsystems.Lanceur; // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html public class Accumuler extends SequentialCommandGroup { - public Accumuler(Accumulateur accumulateur) { + public void Accumuler(Accumulateur accumulateur) { // Add your commands in the addCommands() call, e.g. // addCommands(new FooCommand(), new BarCommand()); addCommands(new Deaccumuler(accumulateur), new Reaccumuler(accumulateur));