From 8bee4280be8ea3e3f053a917effa9ad903bd7169 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Wed, 15 Nov 2023 19:36:19 -0500 Subject: [PATCH] dashboard --- src/main/java/frc/robot/commands/Force1.java | 8 +++----- src/main/java/frc/robot/commands/Force2.java | 11 ++++++----- src/main/java/frc/robot/commands/Force3.java | 16 ++++++---------- src/main/java/frc/robot/commands/Force4.java | 15 ++++++--------- src/main/java/frc/robot/commands/Force5.java | 15 ++++++--------- src/main/java/frc/robot/commands/Force6.java | 17 ++++++----------- src/main/java/frc/robot/commands/Force7.java | 15 +++++---------- .../java/frc/robot/subsystems/Accumulateur.java | 2 +- 8 files changed, 39 insertions(+), 60 deletions(-) diff --git a/src/main/java/frc/robot/commands/Force1.java b/src/main/java/frc/robot/commands/Force1.java index ca5b1cb..8d4e567 100644 --- a/src/main/java/frc/robot/commands/Force1.java +++ b/src/main/java/frc/robot/commands/Force1.java @@ -6,7 +6,6 @@ package frc.robot.commands; import edu.wpi.first.networktables.GenericEntry; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Accumulateur; import frc.robot.subsystems.Lanceur; @@ -20,7 +19,7 @@ public class Force1 extends CommandBase { public Force1(Lanceur lanceur,Accumulateur accumulateur, GenericEntry force1) { this.lanceur = lanceur; this.accumulateur = accumulateur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force1 = force1; // Use addRequirements() here to declare subsystem dependencies. } @@ -34,9 +33,8 @@ public class Force1 extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lanceur.lancer(force1.getDouble(0)); - double vitesse = (600); - lanceur.lancer(100); + lanceur.lancer(force1.getDouble(100)); + double vitesse = (100); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force2.java b/src/main/java/frc/robot/commands/Force2.java index 918cd0f..ea8564c 100644 --- a/src/main/java/frc/robot/commands/Force2.java +++ b/src/main/java/frc/robot/commands/Force2.java @@ -4,7 +4,7 @@ package frc.robot.commands; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Accumulateur; import frc.robot.subsystems.Lanceur; @@ -12,12 +12,13 @@ import frc.robot.subsystems.Lanceur; public class Force2 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - + GenericEntry force2; /** Creates a new Force1. */ - public Force2(Lanceur lancer,Accumulateur accumulateur) { + public Force2(Lanceur lanceur,Accumulateur accumulateur, GenericEntry force2) { this.lanceur = lanceur; this.accumulateur = accumulateur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); + this.force2 = force2; // Use addRequirements() here to declare subsystem dependencies. } @@ -31,7 +32,7 @@ public class Force2 extends CommandBase { @Override public void execute() { double vitesse = (200); - lanceur.lancer(200); + lanceur.lancer(force2.getDouble(200)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force3.java b/src/main/java/frc/robot/commands/Force3.java index 2c3b1a5..4c1e363 100644 --- a/src/main/java/frc/robot/commands/Force3.java +++ b/src/main/java/frc/robot/commands/Force3.java @@ -8,7 +8,7 @@ package frc.robot.commands; import frc.robot.subsystems.Accumulateur; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; + import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; @@ -18,18 +18,14 @@ public class Force3 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - - public void Lancer(Lanceur lanceur) { - this.lanceur = lanceur; - this.accumulateur = accumulateur; - addRequirements(lanceur , accumulateur);} - GenericEntry force3; + /** Creates a new Force1. */ - public Force3(Lanceur lanceur,GenericEntry force3) { + public Force3(Lanceur lanceur,GenericEntry force3, Accumulateur accumulateur) { this.lanceur = lanceur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force3 = force3; + this.accumulateur = accumulateur; // Use addRequirements() here to declare subsystem dependencies. } @@ -44,7 +40,7 @@ public class Force3 extends CommandBase { public void execute() { double vitesse = (300); - lanceur.lancer(300); + lanceur.lancer(force3.getDouble(300)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force4.java b/src/main/java/frc/robot/commands/Force4.java index d766b9c..8658cfc 100644 --- a/src/main/java/frc/robot/commands/Force4.java +++ b/src/main/java/frc/robot/commands/Force4.java @@ -4,7 +4,7 @@ package frc.robot.commands; import frc.robot.subsystems.Accumulateur; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; + import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; @@ -14,17 +14,14 @@ public class Force4 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - - public void Lancer(Lanceur lanceur) { - this.lanceur = lanceur; - this.accumulateur = accumulateur; - addRequirements(lanceur , accumulateur);} GenericEntry force4; + /** Creates a new Force1. */ - public Force4(Lanceur lanceur,GenericEntry force4) { + public Force4(Lanceur lanceur,GenericEntry force4, Accumulateur accumulateur) { this.lanceur = lanceur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force4 = force4; + this.accumulateur = accumulateur; // Use addRequirements() here to declare subsystem dependencies. } @@ -38,7 +35,7 @@ public class Force4 extends CommandBase { @Override public void execute() { double vitesse = (400); - lanceur.lancer(400); + lanceur.lancer(force4.getDouble(400)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force5.java b/src/main/java/frc/robot/commands/Force5.java index 9dfa156..1354f81 100644 --- a/src/main/java/frc/robot/commands/Force5.java +++ b/src/main/java/frc/robot/commands/Force5.java @@ -4,7 +4,7 @@ package frc.robot.commands; import frc.robot.subsystems.Accumulateur; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; + import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; @@ -14,17 +14,14 @@ public class Force5 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - - public void Lancer(Lanceur lanceur) { - this.lanceur = lanceur; - this.accumulateur = accumulateur; - addRequirements(lanceur , accumulateur);} GenericEntry force5; + /** Creates a new Force1. */ - public Force5(Lanceur lanceur,GenericEntry force5) { + public Force5(Lanceur lanceur,GenericEntry force5, Accumulateur accumulateur) { this.lanceur = lanceur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force5 = force5; + this.accumulateur = accumulateur; // Use addRequirements() here to declare subsystem dependencies. } @@ -38,7 +35,7 @@ public class Force5 extends CommandBase { @Override public void execute() { double vitesse = (500); - lanceur.lancer(500); + lanceur.lancer(force5.getDouble(500)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force6.java b/src/main/java/frc/robot/commands/Force6.java index 97cc71f..6655df4 100644 --- a/src/main/java/frc/robot/commands/Force6.java +++ b/src/main/java/frc/robot/commands/Force6.java @@ -4,8 +4,6 @@ package frc.robot.commands; import frc.robot.subsystems.Accumulateur; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Lanceur; @@ -14,18 +12,15 @@ public class Force6 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - - public void Lancer(Lanceur lanceur) { - this.lanceur = lanceur; - this.accumulateur = accumulateur; - addRequirements(lanceur , accumulateur); - } GenericEntry force6; + + /** Creates a new Force1. */ - public Force6(Lanceur lanceur, GenericEntry force6) { + public Force6(Lanceur lanceur, GenericEntry force6, Accumulateur accumulateur) { this.lanceur = lanceur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force6 = force6; + this.accumulateur = accumulateur; // Use addRequirements() here to declare subsystem dependencies. } @@ -39,7 +34,7 @@ public class Force6 extends CommandBase { @Override public void execute() { double vitesse = (600); - lanceur.lancer(600); + lanceur.lancer(force6.getDouble(600)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/commands/Force7.java b/src/main/java/frc/robot/commands/Force7.java index 78af2af..b1ba4cc 100644 --- a/src/main/java/frc/robot/commands/Force7.java +++ b/src/main/java/frc/robot/commands/Force7.java @@ -4,8 +4,6 @@ package frc.robot.commands; import frc.robot.subsystems.Accumulateur; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Lanceur; @@ -14,17 +12,14 @@ public class Force7 extends CommandBase { private Lanceur lanceur; private Accumulateur accumulateur; - - public void Lancer(Lanceur lanceur) { - this.lanceur = lanceur; - this.accumulateur = accumulateur; - addRequirements(lanceur , accumulateur);} GenericEntry force7; + /** Creates a new Force1. */ - public Force7(Lanceur lanceur,GenericEntry force7) { + public Force7(Lanceur lanceur,GenericEntry force7, Accumulateur accumulateur) { this.lanceur = lanceur; - addRequirements(lanceur); + addRequirements(lanceur, accumulateur); this.force7 = force7; + this.accumulateur = accumulateur; // Use addRequirements() here to declare subsystem dependencies. } @@ -38,7 +33,7 @@ public class Force7 extends CommandBase { @Override public void execute() { double vitesse = (700); - lanceur.lancer(700); + lanceur.lancer(force7.getDouble(700)); if (lanceur.vitesse() > vitesse ){ accumulateur.tourneavant(); accumulateur.tournearriere(); diff --git a/src/main/java/frc/robot/subsystems/Accumulateur.java b/src/main/java/frc/robot/subsystems/Accumulateur.java index daa68d0..facaa88 100644 --- a/src/main/java/frc/robot/subsystems/Accumulateur.java +++ b/src/main/java/frc/robot/subsystems/Accumulateur.java @@ -7,7 +7,7 @@ package frc.robot.subsystems; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; -import edu.wpi.first.wpilibj.DigitalInput; + import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants;