This commit is contained in:
samuel desharnais
2026-03-31 19:11:09 -04:00
parent ae9a6bd046
commit 9d09af20b0
13 changed files with 232 additions and 49 deletions

View File

@@ -22,10 +22,14 @@ import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.numbers.N1;
import edu.wpi.first.math.numbers.N3;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.Notifier;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Subsystem;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
@@ -54,8 +58,10 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
/* Swerve requests to apply during SysId characterization */
private final SwerveRequest.SysIdSwerveTranslation m_translationCharacterization = new SwerveRequest.SysIdSwerveTranslation();
private final SwerveRequest.SysIdSwerveSteerGains m_steerCharacterization = new SwerveRequest.SysIdSwerveSteerGains();
ShuffleboardTab teb = Shuffleboard.getTab("teb");
private final SwerveRequest.SysIdSwerveRotation m_rotationCharacterization = new SwerveRequest.SysIdSwerveRotation();
private GenericEntry equipe =
teb.add("equipe commence (bleu = ouvert, rouge = fermé)", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
/* SysId routine for characterizing translation. This is used to find PID gains for the drive motors. */
private final SysIdRoutine m_sysIdRoutineTranslation = new SysIdRoutine(
new SysIdRoutine.Config(
@@ -221,7 +227,9 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
}
configureAutoBuilder();
}
public boolean Equipe(){
return equipe.getBoolean(false);
}
/**
* Returns a command that applies the specified control request to this swerve drivetrain.
*
@@ -254,7 +262,6 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
else if(getPigeon2().getYaw().getValueAsDouble() < 0){
getPigeon2().setYaw(getPigeon2().getYaw().getValueAsDouble()+360);
}
/*
* Periodically try to apply the operator perspective.
* If we haven't applied the operator perspective before, then we should apply it regardless of DS state.

View File

@@ -16,8 +16,6 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Led extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
private GenericEntry equipe =
teb.add("equipe commence (bleu = ouvert, rouge = fermé)", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
@SuppressWarnings("removal")
CANdle CANDle = new CANdle(17);
@SuppressWarnings("removal")
@@ -91,9 +89,6 @@ public class Led extends SubsystemBase {
public void RainBowStop(){
CANDle.animate(null);
}
public boolean Equipe(){
return equipe.getBoolean(true);
}
/** Creates a new Led. */
public Led() {}
@@ -104,7 +99,7 @@ public class Led extends SubsystemBase {
if(temps > 20 && temps < 30){
Vert1();
}
if(Equipe()){
// if(Equipe()){
if(temps > 30 && temps < 55){
bleu();
}
@@ -120,8 +115,8 @@ public class Led extends SubsystemBase {
else{
RainBow();
}
}
else{
// }
// else{
if(temps > 30 && temps < 55){
Rouge();
}
@@ -140,6 +135,6 @@ public class Led extends SubsystemBase {
}
// This method will be called once per scheduler run
}
// }
}

View File

@@ -72,7 +72,7 @@ NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight-tag")
return Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI) - angle;
}
else{
return Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI)-360 - angle;
return -Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI) - angle;
}
}
@Override