changement petit code vers gros

This commit is contained in:
Olivier Dubois 2024-02-17 14:15:03 -05:00
parent 9ad60cd09b
commit fafc79523e
5 changed files with 16 additions and 14 deletions

View File

@ -48,5 +48,5 @@ public class Constants {
public static int photocellacc = 2;
//piston
public static int pistondroiteouvre= 6;
public static int pistondroiteouvre= 7;
}

View File

@ -24,16 +24,14 @@ public class GrimpeurDroit extends Command {
@Override
public void initialize() {
grimpeur.resetencodeurd();
grimpeur.pistonferme();
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
grimpeur.droit(doubleSupplier.getAsDouble());
if(grimpeur.encoderd()>78){
grimpeur.droit(0);
if(grimpeur.encoderd()<73){
grimpeur.droit(doubleSupplier.getAsDouble());
}
else if(grimpeur.getpitch()<-15){
grimpeur.droit(-doubleSupplier.getAsDouble());

View File

@ -23,17 +23,17 @@ public class GrimpeurGauche extends Command {
// Called when the command is initially scheduled.
@Override
public void initialize() {
grimpeur.resetencodeurd();
grimpeur.resetencodeurg();
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
grimpeur.gauche(doubleSupplier.getAsDouble());
if(grimpeur.encoderg()>73){
grimpeur.gauche(0);
}
if(grimpeur.encoderg()<78){
grimpeur.gauche(doubleSupplier.getAsDouble());
}
else if(grimpeur.getpitch()<-15){
grimpeur.gauche(doubleSupplier.getAsDouble());
}
@ -43,10 +43,12 @@ public class GrimpeurGauche extends Command {
else{
grimpeur.gauche(0);
}
if(grimpeur.encoderd()>0){
if(grimpeur.encoderg()<0){
grimpeur.gauche(doubleSupplier.getAsDouble());
}
else{
grimpeur.resetencodeurg();
grimpeur.gauche(0);
}
}

View File

@ -19,7 +19,7 @@ public class PistonFerme extends Command {
// Called when the command is initially scheduled.
@Override
public void initialize() {
grimpeur.pistonferme();
grimpeur.pistonouvre();
}
// Called every time the scheduler runs while the command is scheduled.
@ -28,7 +28,9 @@ public class PistonFerme extends Command {
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}
public void end(boolean interrupted) {
grimpeur.pistonferme();
}
// Returns true when the command should end.
@Override

View File

@ -28,7 +28,7 @@ public class Grimpeur extends SubsystemBase {
final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless);
final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless);
// limit switch
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre);
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.REVPH, Constants.pistondroiteouvre);
//fonction
public Grimpeur() {
pistonouvre();