League meet one Code, not tuned for practice fields or anything

This commit is contained in:
sihan 2023-11-10 23:43:03 -06:00
parent 58212ff9d2
commit 514b02acd4
4 changed files with 37 additions and 2 deletions

View File

@ -9,6 +9,8 @@ import static org.firstinspires.ftc.teamcode.util.Configurables.LOCK;
import static org.firstinspires.ftc.teamcode.util.Configurables.LOCKSPEED;
import static org.firstinspires.ftc.teamcode.util.Configurables.OPEN;
import static org.firstinspires.ftc.teamcode.util.Configurables.PICKUP;
import static org.firstinspires.ftc.teamcode.util.Configurables.PLANELAUNCH;
import static org.firstinspires.ftc.teamcode.util.Configurables.PLANELOCK;
import static org.firstinspires.ftc.teamcode.util.Configurables.UNLOCK;
import static org.firstinspires.ftc.teamcode.util.Configurables.UNLOCKSPEED;
import static org.firstinspires.ftc.teamcode.util.Configurables.WRISTPICKUP;
@ -16,6 +18,7 @@ import static org.firstinspires.ftc.teamcode.util.Configurables.WRISTSCORE;
import static org.firstinspires.ftc.teamcode.util.Constants.CLAW;
import static org.firstinspires.ftc.teamcode.util.Constants.LEFTARM;
import static org.firstinspires.ftc.teamcode.util.Constants.LEFTHANG;
import static org.firstinspires.ftc.teamcode.util.Constants.PLANE;
import static org.firstinspires.ftc.teamcode.util.Constants.RIGHTARM;
import static org.firstinspires.ftc.teamcode.util.Constants.RIGHTHANG;
import static org.firstinspires.ftc.teamcode.util.Constants.WRIST;
@ -45,6 +48,8 @@ public class Robot {
private Hang hang;
@Getter
private Camera camera;
@Getter
private Plane plane;
public Robot init(HardwareMap hardwareMap) {
this.drive = new MecanumDrive(hardwareMap);
@ -54,6 +59,7 @@ public class Robot {
this.wrist = new Wrist().init(hardwareMap);
this.claw = new Claw().init(hardwareMap);
this.camera = new Camera(hardwareMap);
this.plane = new Plane().init(hardwareMap);
return this;
}
@ -178,4 +184,23 @@ public class Robot {
this.claw.setPosition(BIGOPEN);
}
}
public static class Plane {
private Servo plane;
public Plane init(HardwareMap hardwareMap) {
this.plane = hardwareMap.get(Servo.class, PLANE);
this.plane.setPosition(PLANELOCK);
return this;
}
public void planeLock() {
this.plane.setPosition(PLANELOCK);
}
public void planeLaunch() {
this.plane.setPosition(PLANELAUNCH);
}
}
}

View File

@ -23,8 +23,9 @@ public class MainTeleOp extends OpMode {
boolean scoreArm = gamepad2.dpad_left || gamepad2.a;
boolean accurateScoreArm = gamepad2.right_bumper;
boolean claw = gamepad2.b;
boolean pickupWrist = gamepad2.left_bumper || gamepad2.x;
boolean scoreWrist = gamepad2.a;
boolean pickupWrist = gamepad2.x;
boolean scoreWrist = gamepad2.a || gamepad2.left_bumper;
boolean launch = gamepad2.y;
//Drive
robot.getDrive().setInput(gamepad1, gamepad2);
//Hang
@ -53,5 +54,11 @@ public class MainTeleOp extends OpMode {
} else if (scoreWrist) {
this.robot.getWrist().wristScore();
}
//Plane
if (launch) {
this.robot.getPlane().planeLaunch();
} else {
this.robot.getPlane().planeLock();
}
}
}

View File

@ -27,6 +27,8 @@ public class Configurables {
public static double OPEN = 0.53;
public static double BIGOPEN = 0.45;
public static double CLOSE = 0.6;
public static double PLANELOCK = 0.1;
public static double PLANELAUNCH = 0.9;
//Drive Speed
public static double SPEED = 1;

View File

@ -56,4 +56,5 @@ public class Constants {
public static final String LEFTARM = "leftArm";
public static final String RIGHTARM = "rightArm";
public static final String WRIST = "wrist";
public static final String PLANE = "plane";
}