oui
This commit is contained in:
@@ -42,19 +42,21 @@ public class TournerVersReservoir extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(alliance.get() == Alliance.Blue){
|
||||
if(alliance.isPresent()){
|
||||
if(alliance.get() == Alliance.Blue){
|
||||
force = 0.5;
|
||||
angle = 180;
|
||||
}
|
||||
else{
|
||||
force = -0.5;
|
||||
angle = 0;
|
||||
}
|
||||
}
|
||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||
drivetrain.setControl(drive.withRotationalRate(-force));
|
||||
drivetrain.setControl(drive.withRotationalRate(-force*180/Math.PI));
|
||||
}
|
||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||
drivetrain.setControl(drive.withRotationalRate(force));
|
||||
drivetrain.setControl(drive.withRotationalRate(force*180/Math.PI));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +67,6 @@ public class TournerVersReservoir extends Command {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return drivetrain.getPigeon2().getYaw().getValueAsDouble() > angle && drivetrain.getPigeon2().getYaw().getValueAsDouble() < angle + 5;
|
||||
return drivetrain.getPigeon2().getYaw().getValueAsDouble() > angle && drivetrain.getPigeon2().getYaw().getValueAsDouble() < angle + 10;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user