debug de samedi
This commit is contained in:
@@ -18,17 +18,13 @@ public class Lancer extends Command {
|
||||
private PIDController pidController;
|
||||
private Limelight3G limeLight3G;
|
||||
private Timer timer;
|
||||
private Balayeuse balayeuse;
|
||||
private Led led;
|
||||
private double temp;
|
||||
/** Creates a new Lancer. */
|
||||
public Lancer(Lanceur lanceur, Limelight3G limeLight3G, Balayeuse balayeuse,Led led) {
|
||||
public Lancer(Lanceur lanceur, Limelight3G limeLight3G) {
|
||||
this.lanceur = lanceur;
|
||||
this.balayeuse = balayeuse;
|
||||
this.led = led;
|
||||
this.timer = new Timer();
|
||||
this.limeLight3G = new Limelight3G();
|
||||
addRequirements(lanceur, balayeuse, led, limeLight3G);
|
||||
addRequirements(lanceur, limeLight3G);
|
||||
this.temp = 0;
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
@@ -36,9 +32,8 @@ public class Lancer extends Command {
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
pidController = new PIDController(1, 0,0, 0);
|
||||
pidController = new PIDController(0.0007, 0,0, 0.001);
|
||||
timer.reset();
|
||||
timer.start();
|
||||
temp = lanceur.Amp();
|
||||
}
|
||||
|
||||
@@ -52,40 +47,22 @@ public class Lancer extends Command {
|
||||
BotPose = limeLight3G.getBotPoseBlue();
|
||||
botx = BotPose[0];
|
||||
boty = BotPose[1];
|
||||
}
|
||||
int nbFois = 0;
|
||||
|
||||
double moyenneAmp = 0;
|
||||
if(timer.get() < 3){
|
||||
nbFois++;
|
||||
moyenneAmp += balayeuse.Amp() / nbFois;
|
||||
}
|
||||
else{
|
||||
nbFois++;
|
||||
moyenneAmp -= temp;
|
||||
moyenneAmp += balayeuse.Amp() / nbFois;
|
||||
temp = balayeuse.Amp();
|
||||
}
|
||||
// if(moyenneAmp > lanceur.AmpBas() && nbFois > 10){
|
||||
timer.reset();
|
||||
balayeuse.Balayer(-0.5);
|
||||
// led.Jaune2();
|
||||
// }
|
||||
// else{
|
||||
|
||||
}
|
||||
double vitesse = 0.5;
|
||||
if(limeLight3G.getV()){
|
||||
//pythagore |
|
||||
// \/
|
||||
vitesse = Math.sqrt(Math.pow(Math.abs(4.625594-botx), 2) + Math.pow(Math.abs(4.034536-boty), 2));
|
||||
}
|
||||
double output = vitesse; /*pidController.calculate(lanceur.Vitesse(),vitesse);*/
|
||||
lanceur.Lancer(output);
|
||||
if(lanceur.Vitesse() >= vitesse){
|
||||
lanceur.Demeler(0.1);
|
||||
}
|
||||
// }
|
||||
vitesse = 3100 + 475 * ((Math.sqrt(Math.pow(Math.abs(4.625594-botx), 2) + Math.pow(Math.abs(4.034536-boty), 2))) - 2);
|
||||
System.out.println(vitesse);
|
||||
|
||||
double output = pidController.calculate(lanceur.Vitesse(),vitesse);
|
||||
lanceur.Lancer(output);
|
||||
if(lanceur.Vitesse() >= vitesse-800){
|
||||
timer.start();
|
||||
if(timer.get() >0.5){
|
||||
lanceur.Demeler(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@@ -93,7 +70,8 @@ public class Lancer extends Command {
|
||||
public void end(boolean interrupted) {
|
||||
lanceur.Demeler(0);
|
||||
lanceur.Lancer(0);
|
||||
balayeuse.Pivoter(0);
|
||||
timer.reset();
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
|
||||
Reference in New Issue
Block a user