From 4ae779f993312ae45891ccc14155790359df3873 Mon Sep 17 00:00:00 2001 From: "truman.eustace" Date: Wed, 2 Oct 2024 20:54:32 -0400 Subject: [PATCH 1/5] workin on strafing --- .../teamcode/opmode/TrumanLearnsTeleOP.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java index 3e47577..9b13b1b 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java @@ -17,6 +17,7 @@ public class TrumanLearnsTeleOP extends LinearOpMode { private CRServo tail; @Override public void runOpMode() throws InterruptedException { + System.out.println("trumans code"); float ly; float lx; float rx; @@ -32,15 +33,28 @@ public void runOpMode() throws InterruptedException { double motorSpeed = 0.3; waitForStart(); while (opModeIsActive()){ - lx=gamepad1.left_stick_x; - ly=gamepad1.left_stick_y; - rx=gamepad1.right_stick_x; - ry=gamepad1.right_stick_y; + lx=gamepad1.right_stick_y; + ly=gamepad1.right_stick_y; + rx=gamepad1.left_stick_y; + ry=gamepad1.left_stick_y; + + if (Math.abs(gamepad1.left_trigger)>0) { + ly=-1; + lx=1; + ly=-1; + lx=1; + } + if (Math.abs(gamepad1.right_trigger)>0) { + ly=1; + lx=-1; + ly=1; + lx=-1; + } topLeftMotor.setPower(ly); bottomLeftMotor.setPower(lx); topRightMotor.setPower(rx); - bottomRightMotor.setPower(rx); + bottomRightMotor.setPower(ry); } } } From 00b9b021ae9d4d4bf04464f011126c648ed341ac Mon Sep 17 00:00:00 2001 From: "truman.eustace" Date: Mon, 7 Oct 2024 20:29:34 -0400 Subject: [PATCH 2/5] you can press a to switch drive modes --- .../teamcode/opmode/TrumanLearnsTeleOP.java | 86 ++++++++++++------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java index 9b13b1b..02e8e84 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TrumanLearnsTeleOP.java @@ -1,15 +1,17 @@ package org.firstinspires.ftc.teamcode.opmode; + import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.CRServo; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; +import org.firstinspires.ftc.teamcode.util.Toggle; @TeleOp - public class TrumanLearnsTeleOP extends LinearOpMode { + private DcMotor topLeftMotor; private DcMotor topRightMotor; private DcMotor bottomLeftMotor; @@ -17,11 +19,13 @@ public class TrumanLearnsTeleOP extends LinearOpMode { private CRServo tail; @Override public void runOpMode() throws InterruptedException { - System.out.println("trumans code"); - float ly; - float lx; - float rx; - float ry; + Toggle myToggleButton = new Toggle(); + double ly; + double lx; + double rx; + double ry; + boolean leftBumper; + boolean rightBumper; //why? just use if statements topLeftMotor = hardwareMap.get(DcMotor.class,"FL"); topRightMotor = hardwareMap.get(DcMotor.class,"FR"); bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL"); @@ -29,33 +33,57 @@ public void runOpMode() throws InterruptedException { topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); //tail = hardwareMap.get(CRServo.class,"servo"); ONLY FOR DOG - int tailAngle = 1; - double motorSpeed = 0.3; + //double tailAngle = 1; + double motorSpeed = 0.3; //^^ waitForStart(); + while (opModeIsActive()){ - lx=gamepad1.right_stick_y; - ly=gamepad1.right_stick_y; - rx=gamepad1.left_stick_y; - ry=gamepad1.left_stick_y; - - if (Math.abs(gamepad1.left_trigger)>0) { - ly=-1; - lx=1; - ly=-1; - lx=1; - } - if (Math.abs(gamepad1.right_trigger)>0) { - ly=1; - lx=-1; - ly=1; - lx=-1; + + myToggleButton.update(gamepad1.a); + + if (myToggleButton.state){ + lx=gamepad1.right_stick_y; + ly=gamepad1.right_stick_y; + rx=gamepad1.left_stick_y; + ry=gamepad1.left_stick_y; + leftBumper=gamepad1.left_bumper; + rightBumper=gamepad1.right_bumper; + if (leftBumper) { + ly=-1; + lx=1; + } + if (rightBumper) { + rx=1; + ry=-1; + + } + topLeftMotor.setPower(ly); + bottomLeftMotor.setPower(lx); + topRightMotor.setPower(rx); + bottomRightMotor.setPower(ry); + telemetry.addData("Ly", ly); + telemetry.addData("Lx", lx); + telemetry.addData("Rx", rx); + telemetry.addData("Ry", ry); + telemetry.update(); } + else{ + double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed! + double x = gamepad1.left_stick_x; + double rx2 = gamepad1.right_stick_x; - topLeftMotor.setPower(ly); - bottomLeftMotor.setPower(lx); - topRightMotor.setPower(rx); - bottomRightMotor.setPower(ry); + topLeftMotor.setPower(y+ x + rx2); + bottomLeftMotor.setPower(y - x + rx2); + topRightMotor.setPower(y - x - rx2); + bottomRightMotor.setPower(y + x - rx2); + } + + //while(!check){ + //put the other stuff that isn't t-bar steering here + } } - } } + + + From 58efb8b9ee8854735eb4299f7f5f655924e7fe04 Mon Sep 17 00:00:00 2001 From: "brennan.nepomuceno" Date: Mon, 7 Oct 2024 20:47:39 -0400 Subject: [PATCH 3/5] stuff or the new bot --- .../samples/BasicOmniOpMode_Linear.java | 2 +- .../samples/BasicOpMode_Iterative.java | 2 +- .../external/samples/BasicOpMode_Linear.java | 2 +- .../ConceptAprilTagOptimizeExposure.java | 2 +- .../samples/ConceptExternalHardwareClass.java | 8 +- .../external/samples/ConceptNullOp.java | 2 +- .../external/samples/ConceptRevSPARKMini.java | 2 +- .../samples/ConceptSoundsOnBotJava.java | 6 +- .../samples/ConceptSoundsSKYSTONE.java | 2 +- .../RobotAutoDriveByEncoder_Linear.java | 2 +- .../samples/RobotAutoDriveByTime_Linear.java | 2 +- .../samples/RobotAutoDriveToAprilTagOmni.java | 2 +- .../samples/RobotAutoDriveToAprilTagTank.java | 2 +- .../external/samples/SensorKLNavxMicro.java | 2 +- .../external/samples/SensorMRColor.java | 4 +- .../external/samples/SensorMRGyro.java | 2 +- .../internal/FtcRobotControllerActivity.java | 36 ++++---- .../meepmeeptesting/PurplePixelComponent.java | 2 +- .../drive/TrackingWheelLocalizer.java | 3 +- .../ftc/teamcode/drive/TrajectoryDrive.java | 12 +-- .../drive/tuning/ManualFeedforwardTuner.java | 2 +- .../drive/tuning/MaxAngularVeloTuner.java | 2 +- .../drive/tuning/MaxVelocityTuner.java | 2 +- .../ftc/teamcode/opmode/LearningTeleOp.java | 51 +++++++----- .../ftc/teamcode/opmode/THEONE.java | 83 +++++++++++++++++++ .../TrajectorySequenceRunner.java | 7 +- .../sequencesegment/TurnSegment.java | 4 +- .../ftc/teamcode/util/Blinker.java | 2 +- .../ftc/teamcode/util/Encoder.java | 8 +- .../teamcode/vision/PropellerDetection1.java | 2 +- .../teamcode/vision/PropellerDetection2.java | 2 +- .../teamcode/vision/PropellerDetection3.java | 2 +- .../teamcode/vision/TensorFlowDetection.java | 6 +- build.common.gradle | 4 +- 34 files changed, 181 insertions(+), 93 deletions(-) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/THEONE.java diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOmniOpMode_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOmniOpMode_Linear.java index 940b527..737a3a6 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOmniOpMode_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOmniOpMode_Linear.java @@ -68,7 +68,7 @@ public class BasicOmniOpMode_Linear extends LinearOpMode { // Declare OpMode members for each of the 4 motors. - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); private DcMotor leftFrontDrive = null; private DcMotor leftBackDrive = null; private DcMotor rightFrontDrive = null; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Iterative.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Iterative.java index 7c10408..85e2177 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Iterative.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Iterative.java @@ -55,7 +55,7 @@ public class BasicOpMode_Iterative extends OpMode { // Declare OpMode members. - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); private DcMotor leftDrive = null; private DcMotor rightDrive = null; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Linear.java index 9fe0bb6..f2a62ab 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Linear.java @@ -55,7 +55,7 @@ public class BasicOpMode_Linear extends LinearOpMode { // Declare OpMode members. - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); private DcMotor leftDrive = null; private DcMotor rightDrive = null; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagOptimizeExposure.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagOptimizeExposure.java index 3792992..362ad98 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagOptimizeExposure.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagOptimizeExposure.java @@ -198,7 +198,7 @@ private boolean setManualExposure(int exposureMS, int gain) { exposureControl.setMode(ExposureControl.Mode.Manual); sleep(50); } - exposureControl.setExposure((long)exposureMS, TimeUnit.MILLISECONDS); + exposureControl.setExposure(exposureMS, TimeUnit.MILLISECONDS); sleep(20); // Set Gain. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExternalHardwareClass.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExternalHardwareClass.java index 2fe4154..c558569 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExternalHardwareClass.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExternalHardwareClass.java @@ -103,9 +103,9 @@ public void runOpMode() { // Each time around the loop, the servos will move by a small amount. // Limit the total offset to half of the full travel range if (gamepad1.right_bumper) - handOffset += robot.HAND_SPEED; + handOffset += RobotHardware.HAND_SPEED; else if (gamepad1.left_bumper) - handOffset -= robot.HAND_SPEED; + handOffset -= RobotHardware.HAND_SPEED; handOffset = Range.clip(handOffset, -0.5, 0.5); // Move both servos to new position. Use RobotHardware class @@ -114,9 +114,9 @@ else if (gamepad1.left_bumper) // Use gamepad buttons to move arm up (Y) and down (A) // Use the MOTOR constants defined in RobotHardware class. if (gamepad1.y) - arm = robot.ARM_UP_POWER; + arm = RobotHardware.ARM_UP_POWER; else if (gamepad1.a) - arm = robot.ARM_DOWN_POWER; + arm = RobotHardware.ARM_DOWN_POWER; else arm = 0; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptNullOp.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptNullOp.java index 7ea4683..d37c758 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptNullOp.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptNullOp.java @@ -41,7 +41,7 @@ @Disabled public class ConceptNullOp extends OpMode { - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); /** * This method will be called once, when the INIT button is pressed. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRevSPARKMini.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRevSPARKMini.java index e710662..97eaa3a 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRevSPARKMini.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRevSPARKMini.java @@ -52,7 +52,7 @@ public class ConceptRevSPARKMini extends LinearOpMode { // Declare OpMode members. - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); private DcMotorSimple leftDrive = null; private DcMotorSimple rightDrive = null; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsOnBotJava.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsOnBotJava.java index fbb7416..74e446b 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsOnBotJava.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsOnBotJava.java @@ -65,9 +65,9 @@ public class ConceptSoundsOnBotJava extends LinearOpMode { // Point to sound files on the phone's drive - private String soundPath = "/FIRST/blocks/sounds"; - private File goldFile = new File("/sdcard" + soundPath + "/gold.wav"); - private File silverFile = new File("/sdcard" + soundPath + "/silver.wav"); + private final String soundPath = "/FIRST/blocks/sounds"; + private final File goldFile = new File("/sdcard" + soundPath + "/gold.wav"); + private final File silverFile = new File("/sdcard" + soundPath + "/silver.wav"); // Declare OpMode members. private boolean isX = false; // Gamepad button state variables diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsSKYSTONE.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsSKYSTONE.java index 983e434..9492e37 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsSKYSTONE.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsSKYSTONE.java @@ -52,7 +52,7 @@ public class ConceptSoundsSKYSTONE extends LinearOpMode { // List of available sound resources - String sounds[] = {"ss_alarm", "ss_bb8_down", "ss_bb8_up", "ss_darth_vader", "ss_fly_by", + String[] sounds = {"ss_alarm", "ss_bb8_down", "ss_bb8_up", "ss_darth_vader", "ss_fly_by", "ss_mf_fail", "ss_laser", "ss_laser_burst", "ss_light_saber", "ss_light_saber_long", "ss_light_saber_short", "ss_light_speed", "ss_mine", "ss_power_up", "ss_r2d2_up", "ss_roger_roger", "ss_siren", "ss_wookie" }; boolean soundPlaying = false; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByEncoder_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByEncoder_Linear.java index be2e218..666ee2c 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByEncoder_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByEncoder_Linear.java @@ -69,7 +69,7 @@ public class RobotAutoDriveByEncoder_Linear extends LinearOpMode { private DcMotor leftDrive = null; private DcMotor rightDrive = null; - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); // Calculate the COUNTS_PER_INCH for your specific drive train. // Go to your motor vendor website to determine your motor's COUNTS_PER_MOTOR_REV diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByTime_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByTime_Linear.java index b449258..8e09054 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByTime_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByTime_Linear.java @@ -62,7 +62,7 @@ public class RobotAutoDriveByTime_Linear extends LinearOpMode { private DcMotor leftDrive = null; private DcMotor rightDrive = null; - private ElapsedTime runtime = new ElapsedTime(); + private final ElapsedTime runtime = new ElapsedTime(); static final double FORWARD_SPEED = 0.6; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagOmni.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagOmni.java index 21def8a..9a98f1e 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagOmni.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagOmni.java @@ -311,7 +311,7 @@ private void setManualExposure(int exposureMS, int gain) { exposureControl.setMode(ExposureControl.Mode.Manual); sleep(50); } - exposureControl.setExposure((long)exposureMS, TimeUnit.MILLISECONDS); + exposureControl.setExposure(exposureMS, TimeUnit.MILLISECONDS); sleep(20); GainControl gainControl = visionPortal.getCameraControl(GainControl.class); gainControl.setGain(gain); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagTank.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagTank.java index 58bbaa6..dbc1502 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagTank.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToAprilTagTank.java @@ -286,7 +286,7 @@ private void setManualExposure(int exposureMS, int gain) { exposureControl.setMode(ExposureControl.Mode.Manual); sleep(50); } - exposureControl.setExposure((long)exposureMS, TimeUnit.MILLISECONDS); + exposureControl.setExposure(exposureMS, TimeUnit.MILLISECONDS); sleep(20); GainControl gainControl = visionPortal.getCameraControl(GainControl.class); gainControl.setGain(gain); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorKLNavxMicro.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorKLNavxMicro.java index ccc945f..b5e90cf 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorKLNavxMicro.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorKLNavxMicro.java @@ -70,7 +70,7 @@ public class SensorKLNavxMicro extends LinearOpMode { // Get a reference to a Modern Robotics GyroSensor object. We use several interfaces // on this object to illustrate which interfaces support which functionality. navxMicro = hardwareMap.get(NavxMicroNavigationSensor.class, "navx"); - gyro = (IntegratingGyroscope)navxMicro; + gyro = navxMicro; // If you're only interested int the IntegratingGyroscope interface, the following will suffice. // gyro = hardwareMap.get(IntegratingGyroscope.class, "navx"); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRColor.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRColor.java index 32b37e0..e19f079 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRColor.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRColor.java @@ -61,10 +61,10 @@ public class SensorMRColor extends LinearOpMode { public void runOpMode() { // hsvValues is an array that will hold the hue, saturation, and value information. - float hsvValues[] = {0F,0F,0F}; + float[] hsvValues = {0F,0F,0F}; // values is a reference to the hsvValues array. - final float values[] = hsvValues; + final float[] values = hsvValues; // get a reference to the RelativeLayout so we can change the background // color of the Robot Controller app to match the hue detected by the RGB sensor. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRGyro.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRGyro.java index 91c0062..f4d5b28 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRGyro.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRGyro.java @@ -75,7 +75,7 @@ public void runOpMode() { // Get a reference to a Modern Robotics gyro object. We use several interfaces // on this object to illustrate which interfaces support which functionality. modernRoboticsI2cGyro = hardwareMap.get(ModernRoboticsI2cGyro.class, "gyro"); - gyro = (IntegratingGyroscope)modernRoboticsI2cGyro; + gyro = modernRoboticsI2cGyro; // If you're only interested int the IntegratingGyroscope interface, the following will suffice. // gyro = hardwareMap.get(IntegratingGyroscope.class, "gyro"); // A similar approach will work for the Gyroscope interface, if that's all you need. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java index 3f1f77c..f6eaa2c 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java @@ -318,8 +318,8 @@ protected void onCreate(Bundle savedInstanceState) { preferencesHelper.writeBooleanPrefIfDifferent(getString(R.string.pref_warn_about_incorrect_clocks), true); } - entireScreenLayout = (LinearLayout) findViewById(R.id.entire_screen); - buttonMenu = (ImageButton) findViewById(R.id.menu_buttons); + entireScreenLayout = findViewById(R.id.entire_screen); + buttonMenu = findViewById(R.id.menu_buttons); buttonMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -339,7 +339,7 @@ public boolean onMenuItemClick(MenuItem item) { updateMonitorLayout(getResources().getConfiguration()); - BlocksOpMode.setActivityAndWebView(this, (WebView) findViewById(R.id.webViewBlocksRuntime)); + BlocksOpMode.setActivityAndWebView(this, findViewById(R.id.webViewBlocksRuntime)); ExternalLibraries.getInstance().onCreate(); onBotJavaHelper = new OnBotJavaHelperImpl(); @@ -365,13 +365,13 @@ public boolean onMenuItemClick(MenuItem item) { cfgFileMgr.setActiveConfig(false, configFile); } - textDeviceName = (TextView) findViewById(R.id.textDeviceName); - textNetworkConnectionStatus = (TextView) findViewById(R.id.textNetworkConnectionStatus); - textRobotStatus = (TextView) findViewById(R.id.textRobotStatus); - textOpMode = (TextView) findViewById(R.id.textOpMode); - textErrorMessage = (TextView) findViewById(R.id.textErrorMessage); - textGamepad[0] = (TextView) findViewById(R.id.textGamepad1); - textGamepad[1] = (TextView) findViewById(R.id.textGamepad2); + textDeviceName = findViewById(R.id.textDeviceName); + textNetworkConnectionStatus = findViewById(R.id.textNetworkConnectionStatus); + textRobotStatus = findViewById(R.id.textRobotStatus); + textOpMode = findViewById(R.id.textOpMode); + textErrorMessage = findViewById(R.id.textErrorMessage); + textGamepad[0] = findViewById(R.id.textGamepad1); + textGamepad[1] = findViewById(R.id.textGamepad2); immersion = new ImmersiveMode(getWindow().getDecorView()); dimmer = new Dimmer(this); dimmer.longBright(); @@ -501,7 +501,7 @@ protected void unbindFromService() { protected void readNetworkType() { // Control hubs are always running the access point model. Everything else, for the time // being always runs the Wi-Fi Direct model. - if (Device.isRevControlHub() == true) { + if (Device.isRevControlHub()) { networkType = NetworkType.RCWIRELESSAP; } else { networkType = NetworkType.fromString(preferencesHelper.readString(context.getString(R.string.pref_pairing_kind), NetworkType.globalDefaultAsString())); @@ -541,11 +541,7 @@ private boolean isRobotRunning() { RobotState robotState = robot.eventLoopManager.state; - if (robotState != RobotState.RUNNING) { - return false; - } else { - return true; - } + return robotState == RobotState.RUNNING; } @Override @@ -629,7 +625,7 @@ public void onConfigurationChanged(Configuration newConfig) { * based on the given configuration. Makes the children split the space. */ private void updateMonitorLayout(Configuration configuration) { - LinearLayout monitorContainer = (LinearLayout) findViewById(R.id.monitorContainer); + LinearLayout monitorContainer = findViewById(R.id.monitorContainer); if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { // When the phone is landscape, lay out the monitor views horizontally. monitorContainer.setOrientation(LinearLayout.HORIZONTAL); @@ -803,11 +799,7 @@ protected class SharedPreferencesListener implements SharedPreferences.OnSharedP if (key.equals(context.getString(R.string.pref_app_theme))) { ThemedActivity.restartForAppThemeChange(getTag(), getString(R.string.appThemeChangeRestartNotifyRC)); } else if (key.equals(context.getString(R.string.pref_wifi_automute))) { - if (preferencesHelper.readBoolean(context.getString(R.string.pref_wifi_automute), false)) { - initWifiMute(true); - } else { - initWifiMute(false); - } + initWifiMute(preferencesHelper.readBoolean(context.getString(R.string.pref_wifi_automute), false)); } } } diff --git a/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/PurplePixelComponent.java b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/PurplePixelComponent.java index cc2d8c6..1d9563f 100644 --- a/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/PurplePixelComponent.java +++ b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/PurplePixelComponent.java @@ -7,7 +7,7 @@ public class PurplePixelComponent extends Component { - private TensorFlowDetection.PropPosition propPosition; + private final TensorFlowDetection.PropPosition propPosition; public PurplePixelComponent(Robot robot, TensorFlowDetection.PropPosition propPosition) { super(robot); this.propPosition = propPosition; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrackingWheelLocalizer.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrackingWheelLocalizer.java index 212bbfb..488136d 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrackingWheelLocalizer.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrackingWheelLocalizer.java @@ -38,7 +38,8 @@ public class TrackingWheelLocalizer extends ThreeTrackingWheelLocalizer { public Encoder leftEncoder, rightEncoder, frontEncoder; public final double X_MULTIPLIER;// = 1.009485424; // Multiplier in the X direction public final double Y_MULTIPLIER;// = 1.017838563; // Multiplier in the Y direction - private List lastEncPositions, lastEncVels; + private final List lastEncPositions; + private final List lastEncVels; public TrackingWheelLocalizer(HardwareMap hardwareMap, List lastTrackingEncPositions, List lastTrackingEncVels, String leftEncoderName, diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrajectoryDrive.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrajectoryDrive.java index 0a96fd2..247a18c 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrajectoryDrive.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/TrajectoryDrive.java @@ -62,20 +62,20 @@ public class TrajectoryDrive extends MecanumDrive { public static double VY_WEIGHT = 1; public static double OMEGA_WEIGHT = 1; - private TrajectorySequenceRunner trajectorySequenceRunner; + private final TrajectorySequenceRunner trajectorySequenceRunner; - private TrajectoryFollower follower; + private final TrajectoryFollower follower; public DcMotorEx leftFront, leftRear, rightRear, rightFront; - private List motors; + private final List motors; private IMU imu; - private VoltageSensor batteryVoltageSensor; + private final VoltageSensor batteryVoltageSensor; - private List lastEncPositions = new ArrayList<>(); - private List lastEncVels = new ArrayList<>(); + private final List lastEncPositions = new ArrayList<>(); + private final List lastEncVels = new ArrayList<>(); private final TrajectoryAccelerationConstraint accelerationConstraint; private final TrajectoryVelocityConstraint velocityConstraint; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/ManualFeedforwardTuner.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/ManualFeedforwardTuner.java index fffed0d..84f5872 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/ManualFeedforwardTuner.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/ManualFeedforwardTuner.java @@ -50,7 +50,7 @@ public class ManualFeedforwardTuner extends LinearOpMode { public static double DISTANCE = 72; // in - private FtcDashboard dashboard = FtcDashboard.getInstance(); + private final FtcDashboard dashboard = FtcDashboard.getInstance(); //private PantheraDrive drive; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxAngularVeloTuner.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxAngularVeloTuner.java index 73d0132..1cbf8dd 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxAngularVeloTuner.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxAngularVeloTuner.java @@ -21,7 +21,7 @@ public class MaxAngularVeloTuner extends LinearOpMode { public static double RUNTIME = 4.0; private ElapsedTime timer; - private double maxAngVelocity = 0.0; + private final double maxAngVelocity = 0.0; @Override public void runOpMode() throws InterruptedException { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxVelocityTuner.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxVelocityTuner.java index e821725..06b483b 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxVelocityTuner.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/tuning/MaxVelocityTuner.java @@ -22,7 +22,7 @@ public class MaxVelocityTuner extends LinearOpMode { public static double RUNTIME = 2.0; private ElapsedTime timer; - private double maxVelocity = 0.0; + private final double maxVelocity = 0.0; private VoltageSensor batteryVoltageSensor; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LearningTeleOp.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LearningTeleOp.java index 865a4c5..30488e7 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LearningTeleOp.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LearningTeleOp.java @@ -13,9 +13,6 @@ public class LearningTeleOp extends LinearOpMode { - - - private DcMotor leftFrontMotor; private DcMotor rightFrontMotor; private DcMotor leftBackMotor; @@ -32,24 +29,36 @@ public void runOpMode() throws InterruptedException { Grabber = hardwareMap.get(CRServo.class, "Grabber"); waitForStart(); - while(opModeIsActive()) { - leftFrontMotor.setDirection(DcMotorSimple.Direction.REVERSE); - leftBackMotor.setDirection(DcMotorSimple.Direction.REVERSE); - double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed! - double x = gamepad1.left_stick_x; - double rx = gamepad1.right_stick_x; - - leftFrontMotor.setPower(y + x + rx); - leftBackMotor.setPower(y - x + rx); - rightFrontMotor.setPower(y - x - rx); - rightBackMotor.setPower(y + x - rx);} - if (gamepad1.left_bumper){ - Grabber.setPower(1.0);} - else if(gamepad1.right_bumper){ - Grabber.setPower(-1.0);} - else { - Grabber.setPower(0.0); - } + while (opModeIsActive()) { + leftFrontMotor.setDirection(DcMotorSimple.Direction.REVERSE); + leftBackMotor.setDirection(DcMotorSimple.Direction.REVERSE); + double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed! + double x = gamepad1.left_stick_x; + double rx = gamepad1.right_stick_x; + + leftFrontMotor.setPower(y + x + rx); + leftBackMotor.setPower(y - x + rx); + rightFrontMotor.setPower(y - x - rx); + rightBackMotor.setPower(y + x - rx); + if (gamepad1.a){ + leftBackMotor.setPower(2); + rightBackMotor.setPower(2); + leftFrontMotor.setPower(2); + rightFrontMotor.setPower(2);} + + + + if (gamepad1.left_bumper) + Grabber.setPower(1); + else if (gamepad1.right_bumper) + Grabber.setPower(-1); + else Grabber.setPower(0); + //3 hours for 1 bracket... always remember to click code->reformat code + + //TODO: Mess with servo in slot 2 in order to make the dog's arm rotate + } + } +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/THEONE.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/THEONE.java new file mode 100644 index 0000000..c1cf981 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/THEONE.java @@ -0,0 +1,83 @@ +package org.firstinspires.ftc.teamcode.opmode; + +import com.acmerobotics.dashboard.config.Config; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.CRServo; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DcMotorSimple; + +@Config +@TeleOp +public class THEONE extends LinearOpMode { + + + private DcMotor leftFrontMotor; + private DcMotor rightFrontMotor; + private DcMotor leftBackMotor; + private DcMotor rightBackMotor; + private DcMotor Arm; + + @Override + public void runOpMode() throws InterruptedException { + + leftFrontMotor = hardwareMap.get(DcMotor.class, "front_left"); + rightFrontMotor = hardwareMap.get(DcMotor.class, "front_right"); + leftBackMotor = hardwareMap.get(DcMotor.class, "back_left"); + rightBackMotor = hardwareMap.get(DcMotor.class, "back_right"); + Arm = hardwareMap.get(DcMotor.class, "arm"); + + waitForStart(); + while (opModeIsActive()) { + leftFrontMotor.setDirection(DcMotorSimple.Direction.REVERSE); + leftBackMotor.setDirection(DcMotorSimple.Direction.REVERSE); + double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed! + double x = gamepad1.left_stick_x; + double rx = gamepad1.right_stick_x; + + leftFrontMotor.setPower(y + x + rx); + leftBackMotor.setPower(y - x + rx); + rightFrontMotor.setPower(y - x - rx); + rightBackMotor.setPower(y + x - rx); + if (gamepad1.a) { + leftBackMotor.setPower(2); + rightBackMotor.setPower(2); + leftFrontMotor.setPower(2); + rightFrontMotor.setPower(2); + } + + + if (gamepad1.left_bumper) { + Arm.setPower(.3); + } else if (gamepad1.right_bumper) { + Arm.setPower(-.3); + } else { + /*current_time = get_current_time() + current_error = desire_position-current_position + + p = k_p * current_error + + i += k_i * (current_error * (current_time - previous_time)) + + if i > max_i: + i = max_i + elif i < -max_i: + i = -max_i + + D = k_d * (current_error - previous_error) / (current_time - previous_time) + + output = p + i + d + + previous_error = current_error + previous_time = current_time + Arm.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); + Arm.setPower(0); + } + //3 hours for 1 bracket... always remember to click code->reformat code + + + } + + } +} + diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunner.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunner.java index 9f3cc0c..dc0eae7 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunner.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunner.java @@ -59,9 +59,12 @@ public class TrajectorySequenceRunner { private final FtcDashboard dashboard; private final LinkedList poseHistory = new LinkedList<>(); - private VoltageSensor voltageSensor; + private final VoltageSensor voltageSensor; - private List lastDriveEncPositions, lastDriveEncVels, lastTrackingEncPositions, lastTrackingEncVels; + private final List lastDriveEncPositions; + private final List lastDriveEncVels; + private final List lastTrackingEncPositions; + private final List lastTrackingEncVels; public TrajectorySequenceRunner( TrajectoryFollower follower, PIDCoefficients headingPIDCoefficients, VoltageSensor voltageSensor, diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/sequencesegment/TurnSegment.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/sequencesegment/TurnSegment.java index 11995db..c9f2139 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/sequencesegment/TurnSegment.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/trajectorysequence/sequencesegment/TurnSegment.java @@ -26,11 +26,11 @@ public TurnSegment(Pose2d startPose, double totalRotation, MotionProfile motionP this.motionProfile = motionProfile; } - public final double getTotalRotation() { + public double getTotalRotation() { return this.totalRotation; } - public final MotionProfile getMotionProfile() { + public MotionProfile getMotionProfile() { return this.motionProfile; } } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Blinker.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Blinker.java index d5599e9..381d5d8 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Blinker.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Blinker.java @@ -63,7 +63,7 @@ public void identify() { public static class Pattern { public static final int MAX_STEPS = 16; - private List steps = new ArrayList<>(); + private final List steps = new ArrayList<>(); /** * Add a step to the pattern. You can have a maximum of 16 steps. diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Encoder.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Encoder.java index f724c52..9b5cd0d 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Encoder.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/Encoder.java @@ -26,7 +26,7 @@ public enum Direction { FORWARD(1), REVERSE(-1); - private int multiplier; + private final int multiplier; Direction(int multiplier) { this.multiplier = multiplier; @@ -37,14 +37,14 @@ public int getMultiplier() { } } - private DcMotorEx motor; - private NanoClock clock; + private final DcMotorEx motor; + private final NanoClock clock; private Direction direction; private int lastPosition; private int velocityEstimateIdx; - private double[] velocityEstimates; + private final double[] velocityEstimates; private double lastUpdateTime; public Encoder(DcMotorEx motor, NanoClock clock) { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection1.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection1.java index 1f8d56d..1f0efc1 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection1.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection1.java @@ -106,7 +106,7 @@ public void runOpMode() { //private static String TFOD_MODEL_ASSET = "model_20231116_151933.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231121_104059.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231127_143238.tflite"; - private static String TFOD_MODEL_ASSET = "model_20231207_153054.tflite"; + private static final String TFOD_MODEL_ASSET = "model_20231207_153054.tflite"; private static final String[] LABELS = { "prop", }; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection2.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection2.java index cd9f446..d8af267 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection2.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection2.java @@ -108,7 +108,7 @@ public void runOpMode() { //private static String TFOD_MODEL_ASSET = "model_20231106_171216.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231116_151933.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231121_104059.tflite"; - private static String TFOD_MODEL_ASSET = "model_20231127_143238.tflite"; + private static final String TFOD_MODEL_ASSET = "model_20231127_143238.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231207_153054.tflite"; private static final String[] LABELS = { "prop", diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection3.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection3.java index f670278..479f0e0 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection3.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/PropellerDetection3.java @@ -110,7 +110,7 @@ public void runOpMode() { //private static String TFOD_MODEL_ASSET = "model_20231121_104059.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231127_143238.tflite"; //private static String TFOD_MODEL_ASSET = "model_20231207_153054.tflite"; - private static String TFOD_MODEL_ASSET = "model_20231209_095349.tflite"; + private static final String TFOD_MODEL_ASSET = "model_20231209_095349.tflite"; private static final String[] LABELS = { "prop", }; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/TensorFlowDetection.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/TensorFlowDetection.java index 99a3a34..08d0425 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/TensorFlowDetection.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/vision/TensorFlowDetection.java @@ -17,16 +17,16 @@ public class TensorFlowDetection { /** * The variable to store our instance of the TensorFlow Object Detection processor. */ - private TfodProcessor tfod; + private final TfodProcessor tfod; /** * The variable to store our instance of the vision portal. */ - private VisionPortal visionPortal; + private final VisionPortal visionPortal; //private static String TFOD_MODEL_ASSET = "model_20231127_143238.tflite"; //model without negatives //private static String TFOD_MODEL_ASSET = "model_20231209_095349.tflite"; //model with negatives //private static String TFOD_MODEL_ASSET = "model_20240309_150637.tflite"; - private static String TFOD_MODEL_ASSET = "goodModel.tflite"; + private static final String TFOD_MODEL_ASSET = "goodModel.tflite"; private static final String[] LABELS = { "prop", }; diff --git a/build.common.gradle b/build.common.gradle index c85d18a..a587ce7 100644 --- a/build.common.gradle +++ b/build.common.gradle @@ -70,7 +70,7 @@ android { * @see Configure Your Build * @see Versioning Your App */ - def manifestFile = project(':FtcRobotController').file('src/main/AndroidManifest.xml'); + def manifestFile = project(':FtcRobotController').file('src/main/AndroidManifest.xml') def manifestText = manifestFile.getText() // def vCodePattern = Pattern.compile("versionCode=\"(\\d+(\\.\\d+)*)\"") @@ -79,7 +79,7 @@ android { def vCode = Integer.parseInt(matcher.group(1)) // def vNamePattern = Pattern.compile("versionName=\"(.*)\"") - matcher = vNamePattern.matcher(manifestText); + matcher = vNamePattern.matcher(manifestText) matcher.find() def vName = matcher.group(1) // From 5268a63ddffacf963d886ef264d292ffaea00e3c Mon Sep 17 00:00:00 2001 From: "luke.evans" Date: Wed, 2 Oct 2024 20:51:04 -0400 Subject: [PATCH 4/5] Luke does stuff --- .../ftc/teamcode/opmode/LukeSpecifically.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LukeSpecifically.java diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LukeSpecifically.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LukeSpecifically.java new file mode 100644 index 0000000..412bc03 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LukeSpecifically.java @@ -0,0 +1,60 @@ +package org.firstinspires.ftc.teamcode.opmode; + +import com.acmerobotics.dashboard.config.Config; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.CRServo; +import com.qualcomm.robotcore.hardware.DcMotor; + +@Config +@TeleOp +public class LukeSpecifically extends LinearOpMode { + + + private DcMotor front_left; + private DcMotor front_right; + private DcMotor back_left; + private DcMotor back_right; + private CRServo servo_dog; + private CRServo grabber_dog; + + + @Override + public void runOpMode() throws InterruptedException { + waitForStart(); + + front_left = hardwareMap.get(DcMotor.class, "left_front_left_dw"); + front_right = hardwareMap.get(DcMotor.class, "right_front"); + back_left = hardwareMap.get(DcMotor.class, "left_back"); + back_right = hardwareMap.get(DcMotor.class, "right_back_right_dw"); + servo_dog = hardwareMap.get(CRServo.class, "servo"); + grabber_dog = hardwareMap.get(CRServo.class, "Grabber"); + while (opModeIsActive()) { + + double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed! + double x = gamepad1.left_stick_x; + double rx = gamepad1.right_stick_x; + + front_left.setPower(-(y + x + rx)); + back_left.setPower(-(y - x + rx)); + front_right.setPower(y - x - rx); + back_right.setPower(y + x - rx); + + if (gamepad1.right_bumper) { + servo_dog.setPower(1); + }//use if else and else statements before i kill you + if (gamepad1.left_bumper) { + servo_dog.setPower(0); + } + if (gamepad1.dpad_left) { + grabber_dog.setPower(-1); + }//make it stop + if (gamepad1.dpad_right) { + grabber_dog.setPower(1); + } + } + + + } + +} From 465bf44328fce8c24d92de39dd6c602fb4f84b1f Mon Sep 17 00:00:00 2001 From: "luke.evans" Date: Wed, 9 Oct 2024 19:34:44 -0400 Subject: [PATCH 5/5] Patrick Teleop --- .../ftc/teamcode/opmode/PatrickTeleOP.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/PatrickTeleOP.java diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/PatrickTeleOP.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/PatrickTeleOP.java new file mode 100644 index 0000000..49a10f7 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/PatrickTeleOP.java @@ -0,0 +1,34 @@ +package org.firstinspires.ftc.teamcode.opmode; + +import com.acmerobotics.dashboard.config.Config; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.DcMotor; + +@Config +@TeleOp +public class PatrickTeleOP extends LinearOpMode { + + private DcMotor front_left; + private DcMotor front_right; + private DcMotor back_left; + private DcMotor back_right; + + @Override + public void runOpMode() throws InterruptedException { + waitForStart(); + front_left = hardwareMap.get(DcMotor.class, "left_front_left_dw"); + front_right = hardwareMap.get(DcMotor.class, "right_front"); + back_left = hardwareMap.get(DcMotor.class, "left_back"); + back_right = hardwareMap.get(DcMotor.class, "right_back_right_dw"); + + while (opModeIsActive()) { + if (gamepad1.left_stick_x > 0) { + } + } + + } + + +} +