This commit is contained in:
Antoine PerreaultE
2026-03-28 13:21:30 -04:00
parent 79568a58b9
commit a92a7a0ea1
6 changed files with 29 additions and 35 deletions

View File

@@ -23,7 +23,6 @@ public class TournerVersMur extends Command {
Optional<Alliance> alliance = DriverStation.getAlliance();
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond);
Pigeon2 pigeon2;
double force;
double angle;
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
@@ -51,10 +50,10 @@ public class TournerVersMur extends Command {
force = -0.5;
angle = 180;
}
if(pigeon2.getYaw().getValueAsDouble() >0 && pigeon2.getYaw().getValueAsDouble() <180){
if(drivetrain.getPigeon2().getYaw().getValueAsDouble()>0 && drivetrain.getPigeon2().getYaw().getValueAsDouble()<180){
drivetrain.setControl(drive.withRotationalRate(force));
}
else if(pigeon2.getYaw().getValueAsDouble() >180){
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble()>180){
drivetrain.setControl(drive.withRotationalRate(-force));
}
}
@@ -66,6 +65,6 @@ public class TournerVersMur extends Command {
// Returns true when the command should end.
@Override
public boolean isFinished() {
return pigeon2.getYaw().getValueAsDouble() > angle && pigeon2.getYaw().getValueAsDouble() < angle + 5;
return drivetrain.getPigeon2().getYaw().getValueAsDouble()> angle && drivetrain.getPigeon2().getYaw().getValueAsDouble()< angle + 5;
}
}