oui
This commit is contained in:
@@ -64,7 +64,7 @@ public class GrimperMur extends Command {
|
|||||||
x = 1.11;
|
x = 1.11;
|
||||||
angle = 0;
|
angle = 0;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
||||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
@@ -80,7 +80,7 @@ public class GrimperMur extends Command {
|
|||||||
y = 6.959326;
|
y = 6.959326;
|
||||||
angle = 180;
|
angle = 180;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170 && drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170 && drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190){
|
||||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class GrimperReservoir extends Command {
|
|||||||
x = 13.57966;
|
x = 13.57966;
|
||||||
angle = 180;
|
angle = 180;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190 && drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190 && drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170){
|
||||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
@@ -80,7 +80,7 @@ public class GrimperReservoir extends Command {
|
|||||||
x = 1.11;
|
x = 1.11;
|
||||||
angle = 0;
|
angle = 0;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
||||||
drivetrain.setControl(drive.withVelocityX(y-boty).withVelocityY(x-botx));
|
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ public class LimelighterAuto extends Command {
|
|||||||
if(angle >180){
|
if(angle >180){
|
||||||
angle -= 360;
|
angle -= 360;
|
||||||
}
|
}
|
||||||
calcul = limelight3g.Calcule(botx, 4, boty, 4.6, angle) / 3;
|
calcul = limelight3g.Calcule(botx, 4, boty, 4.6, angle) / 5;
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(
|
||||||
drive.withVelocityX(0).withVelocityY(0).withRotationalRate(calcul));
|
drive.withVelocityX(0).withVelocityY(0).withRotationalRate(calcul));
|
||||||
System.out.println(calcul);
|
System.out.println(calcul);
|
||||||
if (calcul < 0.2 && calcul > -0.2) {
|
if (calcul < 0.1 && calcul > -0.1) {
|
||||||
drivetrain.setControl(drive.withRotationalRate(0));
|
drivetrain.setControl(drive.withRotationalRate(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ public class LimelighterAuto extends Command {
|
|||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
return calcul < 0.2 && calcul > -0.2;
|
return calcul < 0.1 && calcul > -0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ public class TournerVersMur extends Command {
|
|||||||
angle = 180;
|
angle = 180;
|
||||||
}
|
}
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble()>0 && drivetrain.getPigeon2().getYaw().getValueAsDouble()<180){
|
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){
|
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble()>180){
|
||||||
drivetrain.setControl(drive.withRotationalRate(-force));
|
drivetrain.setControl(drive.withRotationalRate(-force*180/Math.PI));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +65,6 @@ public class TournerVersMur extends Command {
|
|||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,19 +42,21 @@ public class TournerVersReservoir extends Command {
|
|||||||
// Called every time the scheduler runs while the command is scheduled.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if(alliance.get() == Alliance.Blue){
|
if(alliance.isPresent()){
|
||||||
|
if(alliance.get() == Alliance.Blue){
|
||||||
force = 0.5;
|
force = 0.5;
|
||||||
angle = 180;
|
angle = 180;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
force = -0.5;
|
force = -0.5;
|
||||||
angle = 0;
|
angle = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
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){
|
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.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
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