This commit is contained in:
samuel desharnais 2024-02-01 20:20:04 -05:00
parent 353ea19d71
commit c430c98e19
3 changed files with 22 additions and 10 deletions

View File

@ -22,6 +22,8 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
// Commands // Commands
import frc.robot.command.Balayer; import frc.robot.command.Balayer;
import frc.robot.command.GrimpeurDroit;
import frc.robot.command.GrimpeurGauche;
import frc.robot.command.GuiderBas; import frc.robot.command.GuiderBas;
import frc.robot.command.GuiderHaut; import frc.robot.command.GuiderHaut;
import frc.robot.command.Lancer; import frc.robot.command.Lancer;
@ -49,6 +51,8 @@ public class RobotContainer {
GuiderBas guiderBas = new GuiderBas(guideur); GuiderBas guiderBas = new GuiderBas(guideur);
LancerNote lancernote = new LancerNote(lanceur, accumulateur); LancerNote lancernote = new LancerNote(lanceur, accumulateur);
Lancerampli lancerampli = new Lancerampli(lanceur); Lancerampli lancerampli = new Lancerampli(lanceur);
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, null);
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null);
CommandJoystick joystick = new CommandJoystick(0); CommandJoystick joystick = new CommandJoystick(0);
CommandXboxController manette = new CommandXboxController(1); CommandXboxController manette = new CommandXboxController(1);
@ -68,8 +72,8 @@ public class RobotContainer {
} }
private void configureBindings() { private void configureBindings() {
joystick.button(3).toggleOnTrue(balayer); joystick.button(3).toggleOnTrue(balayer);
} }

View File

@ -4,13 +4,17 @@
package frc.robot.command; package frc.robot.command;
import java.util.function.DoubleSupplier;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Grimpeur; import frc.robot.subsystem.Grimpeur;
public class GrimpeurHautDroit extends Command { public class GrimpeurDroit extends Command {
private DoubleSupplier doubleSupplier;
private Grimpeur grimpeur; private Grimpeur grimpeur;
/** Creates a new GrimpeurHaut. */ /** Creates a new GrimpeurHaut. */
public GrimpeurHautDroit(Grimpeur grimpeur) { public GrimpeurDroit(Grimpeur grimpeur, DoubleSupplier doubleSupplier) {
this.doubleSupplier = doubleSupplier;
this.grimpeur = grimpeur; this.grimpeur = grimpeur;
addRequirements(grimpeur); addRequirements(grimpeur);
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
@ -31,11 +35,11 @@ public class GrimpeurHautDroit extends Command {
grimpeur.droit(0); grimpeur.droit(0);
} }
else if(grimpeur.getpitch()<-15){ else if(grimpeur.getpitch()<-15){
grimpeur.droit(-0.6); grimpeur.droit(-doubleSupplier.getAsDouble());
} }
else if(grimpeur.getpitch()>15){ else if(grimpeur.getpitch()>15){
grimpeur.droit(0.6); grimpeur.droit(doubleSupplier.getAsDouble());
} }
else{ else{
grimpeur.droit(0); grimpeur.droit(0);

View File

@ -4,13 +4,17 @@
package frc.robot.command; package frc.robot.command;
import java.util.function.DoubleSupplier;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Grimpeur; import frc.robot.subsystem.Grimpeur;
public class GrimpeurHautGauche extends Command { public class GrimpeurGauche extends Command {
private DoubleSupplier doubleSupplier;
private Grimpeur grimpeur; private Grimpeur grimpeur;
/** Creates a new GrimpeurHautGauche. */ /** Creates a new GrimpeurHautGauche. */
public GrimpeurHautGauche(Grimpeur grimpeur) { public GrimpeurGauche(Grimpeur grimpeur,DoubleSupplier doubleSupplier) {
this.doubleSupplier = doubleSupplier;
this.grimpeur = grimpeur; this.grimpeur = grimpeur;
addRequirements(grimpeur); addRequirements(grimpeur);
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
@ -30,11 +34,11 @@ public class GrimpeurHautGauche extends Command {
grimpeur.gauche(0); grimpeur.gauche(0);
} }
else if(grimpeur.getpitch()<-15){ else if(grimpeur.getpitch()<-15){
grimpeur.gauche(0.6); grimpeur.gauche(doubleSupplier.getAsDouble());
} }
else if(grimpeur.getpitch()>15){ else if(grimpeur.getpitch()>15){
grimpeur.gauche(-0.6); grimpeur.gauche(-doubleSupplier.getAsDouble());
} }
else{ else{
grimpeur.gauche(0); grimpeur.gauche(0);