pigeon
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user