pigeon
This commit is contained in:
@@ -33,7 +33,6 @@ public class GrimperMur extends Command {
|
||||
double angle;
|
||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond);
|
||||
Pigeon2 pigeon2;
|
||||
Optional<Alliance> alliance = DriverStation.getAlliance();
|
||||
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
|
||||
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1)
|
||||
@@ -63,14 +62,14 @@ public class GrimperMur extends Command {
|
||||
y = 2.961328;
|
||||
x = 1.11;
|
||||
angle = 0;
|
||||
if(pigeon2.getYaw().getValueAsDouble() > 355 || pigeon2.getYaw().getValueAsDouble() < 5){
|
||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 355 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 5){
|
||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
||||
}
|
||||
else{
|
||||
if(pigeon2.getYaw().getValueAsDouble() >0 && pigeon2.getYaw().getValueAsDouble() <180){
|
||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||
drivetrain.setControl(drive.withRotationalRate(-0.5));
|
||||
}
|
||||
else if(pigeon2.getYaw().getValueAsDouble() >180){
|
||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||
drivetrain.setControl(drive.withRotationalRate(0.5));
|
||||
}
|
||||
}
|
||||
@@ -79,14 +78,14 @@ public class GrimperMur extends Command {
|
||||
x = 11.45966;
|
||||
y = 6.959326;
|
||||
angle = 180;
|
||||
if(pigeon2.getYaw().getValueAsDouble() > 175 && pigeon2.getYaw().getValueAsDouble() < 185){
|
||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 175 && drivetrain.getPigeon2().getYaw().getValueAsDouble() < 185){
|
||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
||||
}
|
||||
else{
|
||||
if(pigeon2.getYaw().getValueAsDouble() >0 && pigeon2.getYaw().getValueAsDouble() <180){
|
||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||
drivetrain.setControl(drive.withRotationalRate(0.5));
|
||||
}
|
||||
else if(pigeon2.getYaw().getValueAsDouble() >180){
|
||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||
drivetrain.setControl(drive.withRotationalRate(-0.5));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user