Compare commits

..

No commits in common. "807649c9965b0b386a8b456496dcb5742f0abbc3" and "fa375056cd3bb17e7822bbfe6c49baa1b149564e" have entirely different histories.

View file

@ -6,15 +6,10 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.hardware.DcMotorSimple;
@TeleOp(name="WeRobot: FGC2023 OpMode", group="WeRobot") @TeleOp
public class DualDrive extends LinearOpMode { public class DualDrive extends LinearOpMode {
private DcMotor flm; private DcMotor rightmotor;
private DcMotor frm; private DcMotor leftmotor;
private DcMotor brm;
private DcMotor blm;
private DcMotor moissonmotor;
private DcMotor launchermotor;
private DcMotor mountmotor;
@Override @Override
public void runOpMode() { public void runOpMode() {
@ -22,23 +17,23 @@ public class DualDrive extends LinearOpMode {
double y; double y;
float g2x; float g2x;
boolean ismoissonactive=false; boolean ismoissonactive=false;
boolean ga; boolean a;
boolean gy; boolean y;
boolean preva =false; boolean preva =false;
flm = hardwareMap.get(DcMotor.class, "flm"); flm = hardwareMap.get(DcMotor.class, "0");
frm = hardwareMap.get(DcMotor.class, "frm"); frm = hardwareMap.get(DcMotor.class, "1");
blm = hardwareMap.get(DcMotor.class, "blm"); blm = hardwareMap.get(DcMotor.class, "2");
brm = hardwareMap.get(DcMotor.class, "brm"); brm = hardwareMap.get(DcMotor.class, "3");
moissonmotor = hardwareMap.get(DcMotor.class, "msn"); moissonmotor = hardwareMap.get(DcMotor.class, "4");
launchermotor = hardwareMap.get(DcMotor.class, "lnc"); launchermotor = hardwareMap.get(DcMotor.class, "5");
mountmotor = hardwareMap.get(DcMotor.class, "mnt"); mountmotor = hardwareMap.get(DcMotor.class, "6");
waitForStart(); waitForStart();
while (opModeIsActive()) { while (opModeIsActive()) {
x = gamepad1.left_stick_x; x = gamepad1.left_stick_x;
y = -gamepad1.left_stick_y; y = -gamepad1.left_stick_y;
a = gamepad1.a; a = gamepad1.a;
gy = gamepad1.y; gy = gamepad.y;
if(a & !preva){ if(a & !preva){
ismoissonactive=!ismoissonactive; ismoissonactive=!ismoissonactive;
preva=true; preva=true;
@ -72,7 +67,7 @@ public class DualDrive extends LinearOpMode {
} }
} }
public class Robot{ public class Robot{
public void moves(float x, double y, DcMotor flm, DcMotor frm, DcMotor blm, DcMotor brm){ public void moves(x,y,flm,frm,blm,brm){
float approx = 0.15; float approx = 0.15;
boolean xnozero = (x<-approx || x>approx); boolean xnozero = (x<-approx || x>approx);
boolean ynozero = (y<-approx || y>approx); boolean ynozero = (y<-approx || y>approx);
@ -98,14 +93,13 @@ public class Robot{
} }
} }
public void diagonal(float x, double y, DcMotor flm, DcMotor frm,DcMotor blm,DcMotor brm){ public void diagonal(x,y,flm,frm,blm,brm){
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,[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,[0,-1,-1,0]);
} }
@ -120,7 +114,7 @@ public class Robot{
} }
} }
} }
public void horizontal(float x,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){ public void horizontal(x,flm,frm,blm,brm){
if(x>0){ if(x>0){
Robot.movement(flm,frm,blm,brm,[1,-1,-1,1]); Robot.movement(flm,frm,blm,brm,[1,-1,-1,1]);
}else{ }else{
@ -130,7 +124,7 @@ public class Robot{
} }
public void vertical(double y,DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){ public void vertical(y,flm,frm,blm,brm){
if(y>0){ if(y>0){
Robot.movement(flm,frm,blm,brm,[1,1,1,1]); Robot.movement(flm,frm,blm,brm,[1,1,1,1]);
}else{ }else{
@ -138,13 +132,13 @@ public class Robot{
} }
} }
public void movement(DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm,int[] list){ public void movement(flm,frm,blm,brm,list){
flm.setPower(list[0]); flm.setPower(list[0]);
frm.setPower(list[1]); frm.setPower(list[1]);
blm.setPower(list[2]); blm.setPower(list[2]);
brm.setPower(list[3]); brm.setPower(list[3]);
} }
public void Rotations(float g2x, DcMotor flm,DcMotor frm,DcMotor blm,DcMotor brm){ public void Rotations(g2x,flm,frm,blm,brm){
float approx = 0.15; float approx = 0.15;
boolean xnozero = (g2x<-approx || g2x>approx); boolean xnozero = (g2x<-approx || g2x>approx);
if(xnozero){ if(xnozero){