Actualiser WeRobot-Code.java

This commit is contained in:
Gzod01 2023-09-26 15:57:42 +00:00
parent 65844de4cb
commit d5ead592cb

View file

@ -103,28 +103,28 @@ public class Robot{
if(x>0){ if(x>0){
if(y>0){ if(y>0){
// North East // North East
Robot.movement(flm,frm,blm,brm,{1,0,0,1}); Robot.movement(flm,frm,blm,brm,new int[]{1,0,0,1});
}else{ }else{
//South East //South East
Robot.movement(flm,frm,blm,brm,{0,-1,-1,0}); Robot.movement(flm,frm,blm,brm,new int[]{0,-1,-1,0});
} }
}else{ }else{
if(y>0){ if(y>0){
//North West //North West
Robot.movement(flm,frm,blm,brm,{0,1,1,0}); Robot.movement(flm,frm,blm,brm,new int[]{0,1,1,0});
} }
else{ else{
//South West //South West
Robot.movement(flm,frm,blm,brm,{-1,0,0,-1}); Robot.movement(flm,frm,blm,brm,new int[]{-1,0,0,-1});
} }
} }
} }
public static void horizontal(float x,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){ public static void horizontal(float x,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){
if(x>0){ if(x>0){
Robot.movement(flm,frm,blm,brm,{1,-1,-1,1}); Robot.movement(flm,frm,blm,brm,new int[]{1,-1,-1,1});
}else{ }else{
Robot.movement(flm,frm,blm,brm,;{-1,1,1,-1}); Robot.movement(flm,frm,blm,brm,new int[]{-1,1,1,-1});
} }
@ -132,9 +132,9 @@ public class Robot{
} }
public static void vertical(double y,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){ public static void vertical(double y,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){
if(y>0){ if(y>0){
Robot.movement(flm,frm,blm,brm,{1,1,1,1}); Robot.movement(flm,frm,blm,brm,new int[]{1,1,1,1});
}else{ }else{
Robot.movement(flm,frm,blm,brm,{-1,-1,-1,-1}); Robot.movement(flm,frm,blm,brm,new int[]{-1,-1,-1,-1});
} }
} }
@ -149,9 +149,9 @@ public class Robot{
boolean xnozero = (g2x<-approx || g2x>approx); boolean xnozero = (g2x<-approx || g2x>approx);
if(xnozero){ if(xnozero){
if(x>0){ if(x>0){
Robot.movement(flm,frm,blm,brm,{1,-1,1,-1}); Robot.movement(flm,frm,blm,brm,new int[]{1,-1,1,-1});
}else{ }else{
Robot.movement(flm,frm,blm,brm,{-1,1,-1,1}); Robot.movement(flm,frm,blm,brm,new int[]{-1,1,-1,1});
} }
} }
} }