mettre en 2026
This commit is contained in:
@@ -5,25 +5,22 @@
|
||||
package frc.robot.commands;
|
||||
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.DriverStation;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Lanceur;
|
||||
import frc.robot.subsystems.LimeLight3;
|
||||
import frc.robot.subsystems.Limelight3G;
|
||||
|
||||
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
|
||||
public class LancerBaseVitesse extends Command {
|
||||
private Lanceur lanceur;
|
||||
private PIDController pidController;
|
||||
private Limelight3G limeLight3G;
|
||||
private Timer timer;
|
||||
private double temp;
|
||||
double tempsDebut = 0;
|
||||
/** Creates a new Lancer. */
|
||||
public LancerBaseVitesse(Lanceur lanceur, Limelight3G limeLight3G) {
|
||||
public LancerBaseVitesse(Lanceur lanceur) {
|
||||
this.lanceur = lanceur;
|
||||
this.timer = new Timer();
|
||||
this.limeLight3G = new Limelight3G();
|
||||
addRequirements(lanceur, limeLight3G);
|
||||
addRequirements(lanceur);
|
||||
//this.temp = 0;
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
@@ -34,38 +31,18 @@ public class LancerBaseVitesse extends Command {
|
||||
pidController = new PIDController(0.0007, 0,0, 0.001);
|
||||
timer.reset();
|
||||
timer.start();
|
||||
//temp = lanceur.Amp();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
// 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 > 30 && nbFois > 10){
|
||||
// timer.reset();
|
||||
// balayeuse.Balayer(0.5);
|
||||
// led.Jaune2();
|
||||
// }
|
||||
// else{
|
||||
System.out.println(DriverStation.getMatchTime());
|
||||
double vitesse = lanceur.vitesseDemander();
|
||||
double output = pidController.calculate(lanceur.Vitesse(),vitesse);
|
||||
lanceur.Lancer(output);
|
||||
if(timer.get() >1){
|
||||
if(timer.get() > 1){
|
||||
lanceur.Demeler(1);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user