This commit is contained in:
samuel desharnais 2024-02-05 18:44:03 -05:00
parent c430c98e19
commit 723d918410
3 changed files with 18 additions and 7 deletions

View File

@ -51,11 +51,10 @@ 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);
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur,null);
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null);
public RobotContainer() { public RobotContainer() {
NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur));
NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur));

View File

@ -24,15 +24,16 @@ public class GrimpeurDroit extends Command {
@Override @Override
public void initialize() { public void initialize() {
grimpeur.resetencodeurd(); grimpeur.resetencodeurd();
grimpeur.resetencodeurg(); grimpeur.pistonferme();
} }
// Called every time the scheduler runs while the command is scheduled. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
grimpeur.droit(doubleSupplier.getAsDouble());
if(grimpeur.encoderd()>261 ){ if(grimpeur.encoderd()>261){
grimpeur.droit(0); grimpeur.droit(0);
} }
else if(grimpeur.getpitch()<-15){ else if(grimpeur.getpitch()<-15){
grimpeur.droit(-doubleSupplier.getAsDouble()); grimpeur.droit(-doubleSupplier.getAsDouble());
@ -44,6 +45,11 @@ public class GrimpeurDroit extends Command {
else{ else{
grimpeur.droit(0); grimpeur.droit(0);
} }
if(grimpeur.encoderd()>0){
grimpeur.resetencodeurd();
grimpeur.droit(0);
}
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -30,7 +30,8 @@ public class GrimpeurGauche extends Command {
// Called every time the scheduler runs while the command is scheduled. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
if(grimpeur.encoderg()>261 ){ grimpeur.gauche(doubleSupplier.getAsDouble());
if(grimpeur.encoderg()>261){
grimpeur.gauche(0); grimpeur.gauche(0);
} }
else if(grimpeur.getpitch()<-15){ else if(grimpeur.getpitch()<-15){
@ -43,6 +44,11 @@ public class GrimpeurGauche extends Command {
else{ else{
grimpeur.gauche(0); grimpeur.gauche(0);
} }
if(grimpeur.encoderd()>0){
grimpeur.resetencodeurg();
grimpeur.gauche(0);
}
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.