Code composante fini

This commit is contained in:
Samuel
2026-02-03 19:26:06 -05:00
parent 50a686a5d6
commit 952545efae
11 changed files with 1749 additions and 20 deletions

View File

@@ -4,28 +4,37 @@
package frc.robot.commands;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Lanceur;
import frc.robot.subsystems.LimeLight3;
/* 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 Lancer extends Command {
Lanceur lanceur;
private Lanceur lanceur;
private PIDController pidController;
private LimeLight3 limeLight3;
private double output;
/** Creates a new Lancer. */
public Lancer(Lanceur lanceur) {
public Lancer(Lanceur lanceur, LimeLight3 limeLight3) {
this.lanceur = lanceur;
this.limeLight3 = new LimeLight3();
addRequirements(lanceur);
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {}
public void initialize() {
pidController = new PIDController(0, 0,0, 0);
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
double vitesse = 0.8;
lanceur.Lancer(vitesse);
double vitesse = (100-limeLight3.getTA())/100;
double output = pidController.calculate(lanceur.Vitesse(),vitesse);
lanceur.Lancer(output);
if(lanceur.Vitesse() >= vitesse){
lanceur.Demeler(0.5);
}