From 6fc583ad4c9729a6dac37fca08b71b15c06c219d Mon Sep 17 00:00:00 2001 From: blazeboy75 <> Date: Thu, 25 Nov 2021 19:38:17 -0700 Subject: [PATCH] Milo is very picky --- .../ftc/teamcode/StarterTeleOp.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/StarterTeleOp.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/StarterTeleOp.java index 30db15d6ba9a..042720542962 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/StarterTeleOp.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/StarterTeleOp.java @@ -32,17 +32,10 @@ import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; -//import com.qualcomm.robotcore.hardware.DcMotorController; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; -//import com.qualcomm.robotcore.eventloop.opmode.Disabled; -//import com.qualcomm.robotcore.eventloop.opmode.OpMode; -//import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -//import com.qualcomm.robotcore.hardware.DcMotor; -//import com.qualcomm.robotcore.hardware.DcMotorSimple; -//import com.qualcomm.robotcore.util.ElapsedTime; -//import com.qualcomm.robotcore.util.Range; + /** This file contains an example of an iterative (Non-Linear) "OpMode". * An OpMode is a 'program' that runs in either the autonomous or the teleop period of an FTC match. @@ -56,8 +49,10 @@ * Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. */ + @TeleOp(name="Starter TeleOp", group="Iterative Opmode") + // @Disabled public class StarterTeleOp extends OpMode { @@ -68,6 +63,8 @@ public class StarterTeleOp extends OpMode private DcMotor backL = null; private DcMotor backR = null; + + /** Code to run ONCE when the driver hits INIT. */ @Override public void init() { @@ -100,17 +97,24 @@ public void init() { telemetry.addData("Status", "Initialized"); } + + /** Code to run REPEATEDLY after the driver hits INIT, but before they hit PLAY. */ @Override public void init_loop() { } + + + /** Code to run ONCE when the driver hits PLAY. */ @Override public void start() { runtime.reset(); } + + /** Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP. */ @Override public void loop() { @@ -120,6 +124,8 @@ public void loop() { double leftBPower ; double rightBPower; + + /**POV Mode uses right stick to go forward, and left stick to turn * will be combined in later release. * This uses basic math to combine motions and is easier to drive straight. */ @@ -127,6 +133,8 @@ public void loop() { double turn = gamepad1.right_stick_x; double strafe = gamepad1.left_stick_x; + + if (strafe !=0){ /** Untested on the robot. May need to be reversed or changed entirely. */ leftFPower = -strafe; @@ -134,12 +142,16 @@ public void loop() { leftBPower = strafe; rightBPower = -strafe; } + + else if(drive !=0 || turn !=0) { leftFPower = Range.clip(drive + turn, -1.0, 1.0); rightFPower = Range.clip(drive - turn, -1.0, 1.0); leftBPower = Range.clip(drive + turn, -1.0, 1.0); rightBPower = Range.clip(drive - turn, -1.0, 1.0); } + + else{ leftFPower = 0; rightFPower = 0; @@ -147,12 +159,14 @@ else if(drive !=0 || turn !=0) { rightBPower = 0; } + /**Send calculated power to wheels. */ frontL.setPower(leftFPower); backL.setPower(leftBPower); frontR.setPower(rightFPower); backR.setPower(rightBPower); + /** Show the elapsed game time and wheel power. */ telemetry.addData("Status", "Run Time: " + runtime.toString()); telemetry.addData("Motors", "left (%.2f), right (%.2f)", leftFPower, rightFPower);