mettre en 2026

This commit is contained in:
samuel desharnais
2026-03-26 17:45:25 -04:00
parent 69fe4a58d0
commit 0492c9a2c6
21 changed files with 798 additions and 121 deletions

View File

@@ -4,10 +4,8 @@
package frc.robot.commands;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Balayeuse;
import frc.robot.subsystems.Led;
/* 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 Aspirer extends Command {

View File

@@ -7,9 +7,7 @@ package frc.robot.commands;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Balayeuse;
import frc.robot.subsystems.Lanceur;
import frc.robot.subsystems.Led;
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 */
@@ -18,15 +16,12 @@ public class Lancer extends Command {
private PIDController pidController;
private Limelight3G limeLight3G;
private Timer timer;
private double temp;
/** Creates a new Lancer. */
public Lancer(Lanceur lanceur, Limelight3G limeLight3G) {
this.lanceur = lanceur;
this.timer = new Timer();
this.limeLight3G = new Limelight3G();
addRequirements(lanceur, limeLight3G);
this.temp = 0;
// Use addRequirements() here to declare subsystem dependencies.
}
@@ -34,8 +29,7 @@ public class Lancer extends Command {
@Override
public void initialize() {
pidController = new PIDController(0.0007, 0,0, 0.001);
timer.reset();
temp = lanceur.Amp();
timer.reset();
}
// Called every time the scheduler runs while the command is scheduled.

View File

@@ -7,8 +7,6 @@ package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import frc.robot.subsystems.Balayeuse;
import frc.robot.subsystems.Lanceur;
import frc.robot.subsystems.Led;
import frc.robot.subsystems.LimeLight3;
import frc.robot.subsystems.Limelight3G;

View File

@@ -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);
}
// }
}
}

View File

@@ -7,7 +7,6 @@ package frc.robot.commands;
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
import com.ctre.phoenix6.swerve.SwerveRequest;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.generated.TunerConstants;
import frc.robot.subsystems.CommandSwerveDrivetrain;
@@ -16,7 +15,6 @@ import static edu.wpi.first.units.Units.*;
/* 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 Limelighter extends Command {
Timer timer;
Limelight3G limelight3g;
CommandSwerveDrivetrain drivetrain;
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
@@ -34,20 +32,18 @@ public class Limelighter extends Command {
this.limelight3g = limelight3g;
this.drivetrain = drivetrain;
addRequirements(drivetrain, limelight3g);
timer = new Timer();
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
timer.reset();
}
public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
double[] BotPose = new double[6];
System.out.println("e");
if (limelight3g.getV()) {
BotPose = limelight3g.getBotPoseBlue();
botx = BotPose[1];
@@ -61,12 +57,6 @@ public class Limelighter extends Command {
drive.withVelocityX(0).withVelocityY(0).withRotationalRate(calcul));
System.out.println(calcul);
if (calcul < 0.2 && calcul > -0.2) {
// timer.start();
// } else {
// timer.reset();
// }
// } else {
// timer.stop();
drivetrain.setControl(drive.withRotationalRate(0));
}
}
@@ -80,7 +70,6 @@ public class Limelighter extends Command {
@Override
public void end(boolean interrupted) {
drivetrain.setControl(drive.withRotationalRate(0));
timer.stop();
}
// Returns true when the command should end.

View File

@@ -50,18 +50,12 @@ public class RetourMilieuDroite extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
double[] BotPose = new double[6];
BotPose = limelight3g.getBotPoseBlue();
botx = BotPose[0];
boty = BotPose[1];
if(alliance.get() == Alliance.Blue){
angle = 0;
}
else{
angle = 180;
}
if(pigeon2.getYaw().getValueAsDouble() <355 || pigeon2.getYaw().getValueAsDouble() > 5){
if(pigeon2.getYaw().getValueAsDouble() >0 && pigeon2.getYaw().getValueAsDouble() <180){
drivetrain.setControl(drive.withRotationalRate(0.5));
}
@@ -69,9 +63,6 @@ public class RetourMilieuDroite extends Command {
drivetrain.setControl(drive.withRotationalRate(-0.5));
}
}
else{
}
}
// Called once the command ends or is interrupted.
@Override

View File

@@ -6,7 +6,6 @@ package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Balayeuse;
import frc.robot.subsystems.Lanceur;
/* 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 ModeOposerBalayeuse extends Command {
private Balayeuse balayeuse;