Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TeleOp.java
  • Loading branch information
powerfulHermes committed Dec 15, 2023
2 parents 8d147d4 + 4c67545 commit 072484f
Showing 1 changed file with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@com.qualcomm.robotcore.eventloop.opmode.TeleOp
public class TeleOp extends LinearOpMode {
DcMotorEx barHangMotor;
DcMotorEx flipperMotor;

@Override
public void runOpMode() throws InterruptedException {
GlobalOpMode.opMode = this;
Expand All @@ -34,8 +36,13 @@ public void runOpMode() throws InterruptedException {
// cameras[1] = new AprilTagCamera(hardwareMap.get(WebcamName.class, "Center"), 7, Math.toRadians(90), Math.toRadians(0));
// cameras[2] = new AprilTagCamera(hardwareMap.get(WebcamName.class, "Right"), 8, Math.toRadians(-70), Math.toRadians(45));

flipperMotor = hardwareMap.get( DcMotorEx.class,"flipper");
flipperMotor.setTargetPosition(flipperMotor.getCurrentPosition());
flipperMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);

waitForStart();


while (!isStopRequested()) {
drive.update(); // MUST be called every loop cycle so that RoadRunner calculates the pose correctly
// Read pose
Expand Down Expand Up @@ -63,8 +70,13 @@ public void runOpMode() throws InterruptedException {
if (gamepad1.b) {
// Move pixel hand servo to release 1 pixel
// TODO: Do we need to debounce and count presses? Svit mentioned a "pixel cassette" that drops multiple pixels
throwPixel();
} else {
// Close pixel hand servo
//resetFlipper();
}
if (gamepad1.a) {
resetFlipper();
}
if (gamepad1.right_bumper && gamepad1.left_bumper && getRuntime() >= 85) { // technically endgame is 90sec, we let them launch a little early just in case
// Launch the airplane
Expand All @@ -91,5 +103,31 @@ void barHang() {
barHangMotor.setTargetPosition(538);
barHangMotor.setPower(0.2);


}
}
int startFlipperTicks=0;

void throwPixel() {
int flipperTicks = flipperMotor.getCurrentPosition();
if (startFlipperTicks==0) {
startFlipperTicks=flipperTicks;
}
flipperMotor.setTargetPosition(flipperTicks-475);
flipperMotor.setPower(0.1);
//flipperMotor.
telemetry.addData("flipper ticks", flipperTicks);
telemetry.update();

}
void resetFlipper() {
flipperMotor.setTargetPosition(startFlipperTicks);
}
//alelluia deus omnipotens confitor deo omnipotenti

//in nomine patris, et fili, et spiritu sancti



}


0 comments on commit 072484f

Please sign in to comment.