Compare commits
No commits in common. "807649c9965b0b386a8b456496dcb5742f0abbc3" and "fa375056cd3bb17e7822bbfe6c49baa1b149564e" have entirely different histories.
807649c996
...
fa375056cd
1 changed files with 20 additions and 26 deletions
|
@ -6,15 +6,10 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
|||
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||
|
||||
@TeleOp(name="WeRobot: FGC2023 OpMode", group="WeRobot")
|
||||
@TeleOp
|
||||
public class DualDrive extends LinearOpMode {
|
||||
private DcMotor flm;
|
||||
private DcMotor frm;
|
||||
private DcMotor brm;
|
||||
private DcMotor blm;
|
||||
private DcMotor moissonmotor;
|
||||
private DcMotor launchermotor;
|
||||
private DcMotor mountmotor;
|
||||
private DcMotor rightmotor;
|
||||
private DcMotor leftmotor;
|
||||
|
||||
@Override
|
||||
public void runOpMode() {
|
||||
|
@ -22,23 +17,23 @@ public class DualDrive extends LinearOpMode {
|
|||
double y;
|
||||
float g2x;
|
||||
boolean ismoissonactive=false;
|
||||
boolean ga;
|
||||
boolean gy;
|
||||
boolean a;
|
||||
boolean y;
|
||||
boolean preva =false;
|
||||
flm = hardwareMap.get(DcMotor.class, "flm");
|
||||
frm = hardwareMap.get(DcMotor.class, "frm");
|
||||
blm = hardwareMap.get(DcMotor.class, "blm");
|
||||
brm = hardwareMap.get(DcMotor.class, "brm");
|
||||
moissonmotor = hardwareMap.get(DcMotor.class, "msn");
|
||||
launchermotor = hardwareMap.get(DcMotor.class, "lnc");
|
||||
mountmotor = hardwareMap.get(DcMotor.class, "mnt");
|
||||
flm = hardwareMap.get(DcMotor.class, "0");
|
||||
frm = hardwareMap.get(DcMotor.class, "1");
|
||||
blm = hardwareMap.get(DcMotor.class, "2");
|
||||
brm = hardwareMap.get(DcMotor.class, "3");
|
||||
moissonmotor = hardwareMap.get(DcMotor.class, "4");
|
||||
launchermotor = hardwareMap.get(DcMotor.class, "5");
|
||||
mountmotor = hardwareMap.get(DcMotor.class, "6");
|
||||
waitForStart();
|
||||
|
||||
while (opModeIsActive()) {
|
||||
x = gamepad1.left_stick_x;
|
||||
y = -gamepad1.left_stick_y;
|
||||
a = gamepad1.a;
|
||||
gy = gamepad1.y;
|
||||
gy = gamepad.y;
|
||||
if(a & !preva){
|
||||
ismoissonactive=!ismoissonactive;
|
||||
preva=true;
|
||||
|
@ -72,7 +67,7 @@ public class DualDrive extends LinearOpMode {
|
|||
}
|
||||
}
|
||||
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;
|
||||
boolean xnozero = (x<-approx || x>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(y>0){
|
||||
// North East
|
||||
Robot.movement(flm,frm,blm,brm,[1,0,0,1]);
|
||||
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
//South East
|
||||
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){
|
||||
Robot.movement(flm,frm,blm,brm,[1,-1,-1,1]);
|
||||
}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){
|
||||
Robot.movement(flm,frm,blm,brm,[1,1,1,1]);
|
||||
}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]);
|
||||
frm.setPower(list[1]);
|
||||
blm.setPower(list[2]);
|
||||
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;
|
||||
boolean xnozero = (g2x<-approx || g2x>approx);
|
||||
if(xnozero){
|
||||
|
|
Loading…
Reference in a new issue