diff --git a/FtcRobotController/src/main/AndroidManifest.xml b/FtcRobotController/src/main/AndroidManifest.xml index 79cbfa1..3cced1d 100644 --- a/FtcRobotController/src/main/AndroidManifest.xml +++ b/FtcRobotController/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="51" + android:versionName="9.0"> diff --git a/FtcRobotController/src/main/assets/FTC_2016-17.dat b/FtcRobotController/src/main/assets/FTC_2016-17.dat deleted file mode 100644 index d15d80a..0000000 Binary files a/FtcRobotController/src/main/assets/FTC_2016-17.dat and /dev/null differ diff --git a/FtcRobotController/src/main/assets/FTC_2016-17.xml b/FtcRobotController/src/main/assets/FTC_2016-17.xml deleted file mode 100644 index f75b930..0000000 --- a/FtcRobotController/src/main/assets/FTC_2016-17.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/FtcRobotController/src/main/assets/RelicVuMark.dat b/FtcRobotController/src/main/assets/RelicVuMark.dat deleted file mode 100644 index e873bcf..0000000 Binary files a/FtcRobotController/src/main/assets/RelicVuMark.dat and /dev/null differ diff --git a/FtcRobotController/src/main/assets/RelicVuMark.xml b/FtcRobotController/src/main/assets/RelicVuMark.xml deleted file mode 100644 index b644913..0000000 --- a/FtcRobotController/src/main/assets/RelicVuMark.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FtcRobotController/src/main/assets/StonesAndChips.dat b/FtcRobotController/src/main/assets/StonesAndChips.dat deleted file mode 100644 index 8ab481a..0000000 Binary files a/FtcRobotController/src/main/assets/StonesAndChips.dat and /dev/null differ diff --git a/FtcRobotController/src/main/assets/StonesAndChips.xml b/FtcRobotController/src/main/assets/StonesAndChips.xml deleted file mode 100644 index 2c6da5e..0000000 --- a/FtcRobotController/src/main/assets/StonesAndChips.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/FtcRobotController/src/main/assets/UltimateGoal.dat b/FtcRobotController/src/main/assets/UltimateGoal.dat deleted file mode 100644 index ff47f62..0000000 Binary files a/FtcRobotController/src/main/assets/UltimateGoal.dat and /dev/null differ diff --git a/FtcRobotController/src/main/assets/UltimateGoal.tflite b/FtcRobotController/src/main/assets/UltimateGoal.tflite deleted file mode 100644 index 489a96a..0000000 Binary files a/FtcRobotController/src/main/assets/UltimateGoal.tflite and /dev/null differ diff --git a/FtcRobotController/src/main/assets/UltimateGoal.xml b/FtcRobotController/src/main/assets/UltimateGoal.xml deleted file mode 100644 index bb743b0..0000000 --- a/FtcRobotController/src/main/assets/UltimateGoal.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/FtcRobotController/src/main/assets/qcar_config.xsd b/FtcRobotController/src/main/assets/qcar_config.xsd deleted file mode 100644 index e69de29..0000000 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 2790db4..940b527 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 @@ -35,7 +35,7 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.ElapsedTime; -/** +/* * This file contains an example of a Linear "OpMode". * An OpMode is a 'program' that runs in either the autonomous or the teleop period of an FTC match. * The names of OpModes appear on the menu of the FTC Driver Station. @@ -60,10 +60,10 @@ import com.qualcomm.robotcore.util.ElapsedTime; * the direction of all 4 motors (see code below). * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ -@TeleOp(name="Basic: Omni Linear OpMode", group="Linear Opmode") +@TeleOp(name="Basic: Omni Linear OpMode", group="Linear OpMode") @Disabled public class BasicOmniOpMode_Linear extends LinearOpMode { 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 e2cf965..7c10408 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 @@ -36,7 +36,7 @@ import com.qualcomm.robotcore.hardware.DcMotor; 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. * The names of OpModes appear on the menu of the FTC Driver Station. @@ -47,10 +47,10 @@ import com.qualcomm.robotcore.util.Range; * It includes all the skeletal structure that all iterative OpModes contain. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ -@TeleOp(name="Basic: Iterative OpMode", group="Iterative Opmode") +@TeleOp(name="Basic: Iterative OpMode", group="Iterative OpMode") @Disabled public class BasicOpMode_Iterative extends OpMode { 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 277be2c..9fe0bb6 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 @@ -29,15 +29,15 @@ package org.firstinspires.ftc.robotcontroller.external.samples; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; -/** +/* * This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either * the autonomous or the teleop period of an FTC match. The names of OpModes appear on the menu * of the FTC Driver Station. When a selection is made from the menu, the corresponding OpMode @@ -47,10 +47,10 @@ import com.qualcomm.robotcore.util.Range; * It includes all the skeletal structure that all linear OpModes contain. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ -@TeleOp(name="Basic: Linear OpMode", group="Linear Opmode") +@TeleOp(name="Basic: Linear OpMode", group="Linear OpMode") @Disabled public class BasicOpMode_Linear extends LinearOpMode { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTag.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTag.java index e1a53f1..3a7aa93 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTag.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTag.java @@ -32,19 +32,16 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; -import android.util.Size; import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; -import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; -import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.apriltag.AprilTagDetection; import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; -import org.firstinspires.ftc.vision.apriltag.AprilTagGameDatabase; -/** - * This 2023-2024 OpMode illustrates the basics of AprilTag recognition and pose estimation, +import java.util.List; + +/* + * This OpMode illustrates the basics of AprilTag recognition and pose estimation, * including Java Builder structures for specifying Vision parameters. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -57,12 +54,12 @@ public class ConceptAprilTag extends LinearOpMode { private static final boolean USE_WEBCAM = true; // true for webcam, false for phone camera /** - * {@link #aprilTag} is the variable to store our instance of the AprilTag processor. + * The variable to store our instance of the AprilTag processor. */ private AprilTagProcessor aprilTag; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -162,7 +159,7 @@ public class ConceptAprilTag extends LinearOpMode { /** - * Function to add telemetry about AprilTag detections. + * Add telemetry about AprilTag detections. */ private void telemetryAprilTag() { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagEasy.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagEasy.java index 4913a10..24d8284 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagEasy.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagEasy.java @@ -32,15 +32,16 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.apriltag.AprilTagDetection; import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of AprilTag recognition and pose estimation, using +import java.util.List; + +/* + * This OpMode illustrates the basics of AprilTag recognition and pose estimation, using * the easy way. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -53,12 +54,12 @@ public class ConceptAprilTagEasy extends LinearOpMode { private static final boolean USE_WEBCAM = true; // true for webcam, false for phone camera /** - * {@link #aprilTag} is the variable to store our instance of the AprilTag processor. + * The variable to store our instance of the AprilTag processor. */ private AprilTagProcessor aprilTag; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -118,7 +119,7 @@ public class ConceptAprilTagEasy extends LinearOpMode { } // end method initAprilTag() /** - * Function to add telemetry about AprilTag detections. + * Add telemetry about AprilTag detections. */ private void telemetryAprilTag() { 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 b36e4b5..3792992 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 @@ -33,11 +33,9 @@ import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.Range; - import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.hardware.camera.controls.ExposureControl; import org.firstinspires.ftc.robotcore.external.hardware.camera.controls.GainControl; - import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.apriltag.AprilTagDetection; import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; @@ -45,7 +43,7 @@ import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; import java.util.List; import java.util.concurrent.TimeUnit; -/** +/* * This OpMode determines the best Exposure for minimizing image motion-blur on a Webcam * Note that it is not possible to control the exposure for a Phone Camera, so if you are using a Phone for the Robot Controller * this OpMode/Feature only applies to an externally connected Webcam diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagSwitchableCameras.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagSwitchableCameras.java index d87e753..9285224 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagSwitchableCameras.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptAprilTagSwitchableCameras.java @@ -32,7 +32,6 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; @@ -41,8 +40,10 @@ import org.firstinspires.ftc.vision.VisionPortal.CameraState; import org.firstinspires.ftc.vision.apriltag.AprilTagDetection; import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of AprilTag recognition and pose estimation, using +import java.util.List; + +/* + * This OpMode illustrates the basics of AprilTag recognition and pose estimation, using * two webcams. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -52,7 +53,7 @@ import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; @Disabled public class ConceptAprilTagSwitchableCameras extends LinearOpMode { - /** + /* * Variables used for switching cameras. */ private WebcamName webcam1, webcam2; @@ -60,12 +61,12 @@ public class ConceptAprilTagSwitchableCameras extends LinearOpMode { private boolean oldRightBumper; /** - * {@link #aprilTag} is the variable to store our instance of the AprilTag processor. + * The variable to store our instance of the AprilTag processor. */ private AprilTagProcessor aprilTag; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -130,7 +131,7 @@ public class ConceptAprilTagSwitchableCameras extends LinearOpMode { } // end method initAprilTag() /** - * Function to add telemetry about camera switching. + * Add telemetry about camera switching. */ private void telemetryCameraSwitching() { @@ -145,7 +146,7 @@ public class ConceptAprilTagSwitchableCameras extends LinearOpMode { } // end method telemetryCameraSwitching() /** - * Function to add telemetry about AprilTag detections. + * Add telemetry about AprilTag detections. */ private void telemetryAprilTag() { @@ -173,7 +174,7 @@ public class ConceptAprilTagSwitchableCameras extends LinearOpMode { } // end method telemetryAprilTag() /** - * Function to set the active camera according to input from the gamepad. + * Set the active camera according to input from the gamepad. */ private void doCameraSwitching() { if (visionPortal.getCameraState() == CameraState.STREAMING) { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptCompassCalibration.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptCompassCalibration.java deleted file mode 100644 index 45dac81..0000000 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptCompassCalibration.java +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (c) 2017 FIRST. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted (subject to the limitations in the disclaimer below) provided that - * the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * Neither the name of FIRST nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS - * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.firstinspires.ftc.robotcontroller.external.samples; - -import com.qualcomm.robotcore.eventloop.opmode.Disabled; -import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; -import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.hardware.CompassSensor; -import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.util.ElapsedTime; - -/** - * This file illustrates the concept of calibrating a MR Compass - * This code assumes there is a compass configured with the name "compass" - * - * This code will put the compass into calibration mode, wait three seconds and then attempt - * to rotate two full turns clockwise. This will allow the compass to do a magnetic calibration. - * - * Once compete, the program will put the compass back into measurement mode and check to see if the - * calibration was successful. - * - * Use Android Studio 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="Concept: Compass Calibration", group="Concept") -@Disabled -public class ConceptCompassCalibration extends LinearOpMode { - - /* Declare OpMode members. */ - public DcMotor leftDrive = null; - public DcMotor rightDrive = null; - private ElapsedTime runtime = new ElapsedTime(); - CompassSensor compass; - - final static double MOTOR_POWER = 0.2; // scale from 0 to 1 - static final long HOLD_TIME_MS = 3000; - static final double CAL_TIME_SEC = 20; - - @Override - public void runOpMode() { - - // Initialize the drive system variables. - leftDrive = hardwareMap.get(DcMotor.class, "left_drive"); - rightDrive = hardwareMap.get(DcMotor.class, "right_drive"); - - // To drive forward, most robots need the motor on one side to be reversed, because the axles point in opposite directions. - // Pushing the left stick forward MUST make robot go forward. So adjust these two lines based on your first test drive. - // Note: The settings here assume direct drive on left and right wheels. Gear Reduction or 90 Deg drives may require direction flips - leftDrive.setDirection(DcMotor.Direction.REVERSE); - rightDrive.setDirection(DcMotor.Direction.FORWARD); - - // get a reference to our Compass Sensor object. - compass = hardwareMap.get(CompassSensor.class, "compass"); - - // Send telemetry message to signify robot waiting; - telemetry.addData("Status", "Ready to cal"); // - telemetry.update(); - - // Wait for the game to start (driver presses PLAY) - waitForStart(); - - // Set the compass to calibration mode - compass.setMode(CompassSensor.CompassMode.CALIBRATION_MODE); - telemetry.addData("Compass", "Compass in calibration mode"); - telemetry.update(); - - sleep(HOLD_TIME_MS); // Just do a sleep while we switch modes - - // Start the robot rotating clockwise - telemetry.addData("Compass", "Calibration mode. Turning the robot..."); - telemetry.update(); - leftDrive.setPower(MOTOR_POWER); - rightDrive.setPower(-MOTOR_POWER); - - // run until time expires OR the driver presses STOP; - runtime.reset(); - while (opModeIsActive() && (runtime.time() < CAL_TIME_SEC)) { - idle(); - } - - // Stop all motors and turn off claibration - leftDrive.setPower(0); - rightDrive.setPower(0); - compass.setMode(CompassSensor.CompassMode.MEASUREMENT_MODE); - telemetry.addData("Compass", "Returning to measurement mode"); - telemetry.update(); - - sleep(HOLD_TIME_MS); // Just do a sleep while we switch modes - - // Report whether the Calibration was successful or not. - if (compass.calibrationFailed()) - telemetry.addData("Compass", "Calibrate Failed. Try Again!"); - else - telemetry.addData("Compass", "Calibrate Passed."); - telemetry.update(); - } -} diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptDoubleVision.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptDoubleVision.java index 3bb6dcd..1d50049 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptDoubleVision.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptDoubleVision.java @@ -32,7 +32,6 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; @@ -41,8 +40,10 @@ import org.firstinspires.ftc.vision.apriltag.AprilTagDetection; import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; import org.firstinspires.ftc.vision.tfod.TfodProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of using both AprilTag recognition and TensorFlow +import java.util.List; + +/* + * This OpMode illustrates the basics of using both AprilTag recognition and TensorFlow * Object Detection. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -54,17 +55,17 @@ public class ConceptDoubleVision extends LinearOpMode { private static final boolean USE_WEBCAM = true; // true for webcam, false for phone camera /** - * {@link #aprilTag} is the variable to store our instance of the AprilTag processor. + * The variable to store our instance of the AprilTag processor. */ private AprilTagProcessor aprilTag; /** - * {@link #tfod} is the variable to store our instance of the TensorFlow Object Detection processor. + * The variable to store our instance of the TensorFlow Object Detection processor. */ private TfodProcessor tfod; /** - * {@link #myVisionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal myVisionPortal; @@ -122,7 +123,7 @@ public class ConceptDoubleVision extends LinearOpMode { /** - * Function to initialize AprilTag and TFOD. + * Initialize AprilTag and TFOD. */ private void initDoubleVision() { // ----------------------------------------------------------------------------------------- @@ -157,7 +158,7 @@ public class ConceptDoubleVision extends LinearOpMode { } // end initDoubleVision() /** - * Function to add telemetry about AprilTag detections. + * Add telemetry about AprilTag detections. */ private void telemetryAprilTag() { List currentDetections = aprilTag.getDetections(); @@ -179,7 +180,7 @@ public class ConceptDoubleVision extends LinearOpMode { } // end method telemetryAprilTag() /** - * Function to add telemetry about TensorFlow Object Detection (TFOD) recognitions. + * Add telemetry about TensorFlow Object Detection (TFOD) recognitions. */ private void telemetryTfod() { List currentRecognitions = tfod.getRecognitions(); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExploringIMUOrientation.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExploringIMUOrientation.java index e19d021..751d54f 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExploringIMUOrientation.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExploringIMUOrientation.java @@ -37,36 +37,35 @@ import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.IMU; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity; import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles; -/** - * This file demonstrates the impact of setting the IMU orientation correctly or incorrectly. This +/* + * This OpMode demonstrates the impact of setting the IMU orientation correctly or incorrectly. This * code assumes there is an IMU configured with the name "imu". - *

+ * * Note: This OpMode is more of a tool than a code sample. The User Interface portion of this code * goes beyond simply showing how to interface to the IMU.
* For a minimal example of interfacing to an IMU, please see the SensorIMUOrthogonal or SensorIMUNonOrthogonal sample OpModes. - *

- * This sample enables you to re-specify the Hub Mounting orientation dynamically by using gamepad controls. + * + * This OpMode enables you to re-specify the Hub Mounting orientation dynamically by using gamepad controls. * While doing so, the sample will display how Pitch, Roll and Yaw angles change as the hub is moved. - *

+ * * The gamepad controls let you change the two parameters that specify how the Control/Expansion Hub is mounted.
* The first parameter specifies which direction the printed logo on the Hub is pointing.
* The second parameter specifies which direction the USB connector on the Hub is pointing.
* All directions are relative to the robot, and left/right is as viewed from behind the robot. - *

+ * * How will you know if you have chosen the correct Orientation? With the correct orientation * parameters selected, pitch/roll/yaw should act as follows: - *

+ * * Pitch value should INCREASE as the robot is tipped UP at the front. (Rotation about X)
* Roll value should INCREASE as the robot is tipped UP at the left side. (Rotation about Y)
* Yaw value should INCREASE as the robot is rotated Counter Clockwise. (Rotation about Z)
- *

+ * * The Yaw can be reset (to zero) by pressing the Y button on the gamepad (Triangle on a PS4 controller) - *

+ * * The rotational velocities should follow the change in corresponding axes. */ @@ -79,7 +78,7 @@ public class ConceptExploringIMUOrientation extends LinearOpMode { = RevHubOrientationOnRobot.UsbFacingDirection.values(); static int LAST_DIRECTION = logoFacingDirections.length - 1; static float TRIGGER_THRESHOLD = 0.2f; - + IMU imu; int logoFacingDirectionPosition; int usbFacingDirectionPosition; 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 6607fb6..2fe4154 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 @@ -34,8 +34,8 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.Range; -/** - * This OpMode Sample illustrates how to use an external "hardware" class to modularize all the robot's sensors and actuators. +/* + * This OpMode illustrates how to use an external "hardware" class to modularize all the robot's sensors and actuators. * This approach is very efficient because the same hardware class can be used by all of your teleop and autonomous OpModes * without requiring many copy & paste operations. Once you have defined and tested the hardware class with one OpMode, * it is instantly available to other OpModes. @@ -53,15 +53,15 @@ import com.qualcomm.robotcore.util.Range; * must also be copied to the same location (maintaining its name). * * For comparison purposes, this sample and its accompanying hardware class duplicates the functionality of the - * RobotTelopPOV_Linear opmode. It assumes three motors (left_drive, right_drive and arm) and two servos (left_hand and right_hand) + * RobotTelopPOV_Linear OpMode. It assumes three motors (left_drive, right_drive and arm) and two servos (left_hand and right_hand) * * View the RobotHardware.java class file for more details * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list * - * In OnBot Java, add a new OpMode, drawing from this Sample; select TeleOp. - * Also add another new file named RobotHardware.java, drawing from the Sample with that name; select Not an OpMode. + * In OnBot Java, add a new OpMode, select this sample, and select TeleOp. + * Also add another new file named RobotHardware.java, select the sample with that name, and select Not an OpMode. */ @TeleOp(name="Concept: Robot Hardware Class", group="Robot") diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadRumble.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadRumble.java index 929fdaa..cf846e1 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadRumble.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadRumble.java @@ -6,13 +6,13 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.Gamepad; import com.qualcomm.robotcore.util.ElapsedTime; -/** - * This sample illustrates using the rumble feature of many gamepads. +/* + * This OpMode illustrates using the rumble feature of many gamepads. * * Note: Some gamepads "rumble" better than others. * The Xbox & PS4 have a left (rumble1) and right (rumble2) rumble motor. * These two gamepads have two distinct rumble modes: Large on the left, and small on the right - * The ETpark gamepad may only respond to rumble1, and may only run at full power. + * The Etpark gamepad may only respond to rumble1, and may only run at full power. * The Logitech F310 gamepad does not have *any* rumble ability. * * Moral: You should use this sample to experiment with your specific gamepads to explore their rumble features. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadTouchpad.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadTouchpad.java index dc1795a..84d8cec 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadTouchpad.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptGamepadTouchpad.java @@ -1,13 +1,12 @@ package org.firstinspires.ftc.robotcontroller.external.samples; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.eventloop.opmode.Disabled; - import org.firstinspires.ftc.robotcore.external.Telemetry; -/** - * This sample illustrates using the touchpad feature found on some gamepads. +/* + * This OpMode illustrates using the touchpad feature found on some gamepads. * * The Sony PS4 gamepad can detect two distinct touches on the central touchpad. * Other gamepads with different touchpads may provide mixed results. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptMotorBulkRead.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptMotorBulkRead.java index e0c5a75..3bade8b 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptMotorBulkRead.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptMotorBulkRead.java @@ -36,51 +36,49 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotorEx; import com.qualcomm.robotcore.util.ElapsedTime; -import java.util.Iterator; import java.util.List; - /* - This sample illustrates how to use the Expansion Hub's Bulk-Read feature to speed up control cycle times. - In this example there are 4 motors that need their encoder positions, and velocities read. - The sample is written to work with one or two expansion hubs, with no assumption as to where the motors are located. - - Three scenarios are tested: - Cache Mode = OFF This is the normal default, where no cache is used, and every read produces a discrete transaction with - an expansion hub, which is the slowest approach, but guarentees that the value is as fresh (recent) as possible.. - - Cache Mode = AUTO This mode will attempt to minimize the number of discrete read commands, by performing bulk-reads - and then returning values that have been cached. The cache is updated automatically whenever any specific encoder is re-read. - This mode will always return new data, but it may perform more bulk-reads than absolutely required. - Extra reads will be performed if multiple encoder/velocity reads are performed on the same encoder in one control cycle. - This mode is a good compromise between the OFF and MANUAL modes. - Note: If there are significant user-program delays between encoder reads, the cached value may not be fresh (recent). - You can issue a clearBulkCache() call at any time force a fresh bulk-read on the next encoder read. - - Cache Mode = MANUAL This mode requires the user's code to determine the best time to clear the cached bulk-read data. - Well organized code will reset the cache once at the beginning of the control cycle, and then immediately read and store all the encoder values. - This approach will produce the shortest cycle times, but it does require the user to manually clear the cache. - Since NO automatic Bulk-Reads are performed, neglecting to clear the bulk cache will result in the same values being returned - each time an encoder read is performed. - - ------------------------------------- - - General tip to speed up your control cycles: - - No matter what method you use to read encoders and other inputs, you should try to - avoid reading the same encoder input multiple times around a control loop. - Under normal conditions, this will slow down the control loop. - The preferred method is to read all the required inputs ONCE at the beginning of the loop, - and save the values in variable that can be used by other parts of the control code. - - eg: if you are sending encoder positions to your telemetry display, putting a getCurrentPosition() - call in the telemetry statement will force the code to go and get another copy which will take time. - It's much better read the position into a variable once, and use that variable for control AND display. - Reading saved variables takes no time at all. - - Once you put all your sensor reads at the beginning of the control cycle, it's very easy to use - the bulk-read AUTO mode to streamline your cycle timing. - - */ +/* + * This OpMode illustrates how to use the Expansion Hub's Bulk-Read feature to speed up control cycle times. + * In this example there are 4 motors that need their encoder positions, and velocities read. + * The sample is written to work with one or two expansion hubs, with no assumption as to where the motors are located. + * + * Three scenarios are tested: + * Cache Mode = OFF This is the normal default, where no cache is used, and every read produces a discrete transaction with + * an expansion hub, which is the slowest approach, but guarentees that the value is as fresh (recent) as possible.. + * + * Cache Mode = AUTO This mode will attempt to minimize the number of discrete read commands, by performing bulk-reads + * and then returning values that have been cached. The cache is updated automatically whenever any specific encoder is re-read. + * This mode will always return new data, but it may perform more bulk-reads than absolutely required. + * Extra reads will be performed if multiple encoder/velocity reads are performed on the same encoder in one control cycle. + * This mode is a good compromise between the OFF and MANUAL modes. + * Note: If there are significant user-program delays between encoder reads, the cached value may not be fresh (recent). + * You can issue a clearBulkCache() call at any time force a fresh bulk-read on the next encoder read. + * + * Cache Mode = MANUAL This mode requires the user's code to determine the best time to clear the cached bulk-read data. + * Well organized code will reset the cache once at the beginning of the control cycle, and then immediately read and store all the encoder values. + * This approach will produce the shortest cycle times, but it does require the user to manually clear the cache. + * Since NO automatic Bulk-Reads are performed, neglecting to clear the bulk cache will result in the same values being returned + * each time an encoder read is performed. + * + * ------------------------------------- + * + * General tip to speed up your control cycles: + * + * No matter what method you use to read encoders and other inputs, you should try to + * avoid reading the same encoder input multiple times around a control loop. + * Under normal conditions, this will slow down the control loop. + * The preferred method is to read all the required inputs ONCE at the beginning of the loop, + * and save the values in variable that can be used by other parts of the control code. + * + * eg: if you are sending encoder positions to your telemetry display, putting a getCurrentPosition() + * call in the telemetry statement will force the code to go and get another copy which will take time. + * It's much better read the position into a variable once, and use that variable for control AND display. + * Reading saved variables takes no time at all. + * + * Once you put all your sensor reads at the beginning of the control cycle, it's very easy to use + * the bulk-read AUTO mode to streamline your cycle timing. + */ @TeleOp (name = "Motor Bulk Reads", group = "Tests") @Disabled public class ConceptMotorBulkRead extends LinearOpMode { 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 2f84695..7ea4683 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 @@ -34,11 +34,8 @@ import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Demonstrates empty OpMode +/* + * Demonstrates an empty iterative OpMode */ @TeleOp(name = "Concept: NullOp", group = "Concept") @Disabled @@ -46,34 +43,47 @@ public class ConceptNullOp extends OpMode { private ElapsedTime runtime = new ElapsedTime(); + /** + * This method will be called once, when the INIT button is pressed. + */ @Override public void init() { telemetry.addData("Status", "Initialized"); } - /* - * Code to run when the op mode is first enabled goes here - * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#start() - */ + /** + * This method will be called repeatedly during the period between when + * the init button is pressed and when the play button is pressed (or the + * OpMode is stopped). + */ @Override public void init_loop() { } - /* - * This method will be called ONCE when start is pressed - * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#loop() + /** + * This method will be called once, when the play button is pressed. */ @Override public void start() { runtime.reset(); } - /* - * This method will be called repeatedly in a loop - * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#loop() + /** + * This method will be called repeatedly during the period between when + * the play button is pressed and when the OpMode is stopped. */ @Override public void loop() { telemetry.addData("Status", "Run Time: " + runtime.toString()); } + + /** + * This method will be called once, when this OpMode is stopped. + *

+ * Your ability to control hardware from this method will be limited. + */ + @Override + public void stop() { + + } } diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRampMotorSpeed.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRampMotorSpeed.java index f891142..6e0be37 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRampMotorSpeed.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptRampMotorSpeed.java @@ -34,7 +34,7 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; -/** +/* * This OpMode ramps a single motor speed up and down repeatedly until Stop is pressed. * The code is structured as a LinearOpMode * @@ -44,7 +44,7 @@ import com.qualcomm.robotcore.hardware.DcMotor; * CYCLE_MS sets the update period. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name = "Concept: Ramp Motor Speed", group = "Concept") @Disabled 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 6f2aa70..e710662 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 @@ -37,8 +37,7 @@ import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; -/** - * +/* * This OpMode executes a basic Tank Drive Teleop for a two wheeled robot using two REV SPARKminis. * To use this example, connect two REV SPARKminis into servo ports on the Expansion Hub. On the * robot configuration, use the drop down list under 'Servos' to select 'REV SPARKmini Controller' diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptScanServo.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptScanServo.java index 38c7eb0..2b8ad33 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptScanServo.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptScanServo.java @@ -34,7 +34,7 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.Servo; -/** +/* * This OpMode scans a single servo back and forward until Stop is pressed. * The code is structured as a LinearOpMode * INCREMENT sets how much to increase/decrease the servo position each cycle @@ -46,7 +46,7 @@ import com.qualcomm.robotcore.hardware.Servo; * connected servos are able to move freely before running this test. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name = "Concept: Scan Servo", group = "Concept") @Disabled diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsASJava.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsASJava.java index 5c961ad..f0a855f 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsASJava.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptSoundsASJava.java @@ -34,17 +34,15 @@ import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.io.File; - -/** - * This file demonstrates how to play simple sounds on both the RC and DS phones. +/* + * This OpMode demonstrates how to play simple sounds on both the RC and DS phones. * It illustrates how to build sounds into your application as a resource. * This technique is best suited for use with Android Studio since it assumes you will be creating a new application * * If you are using OnBotJava, please see the ConceptSoundsOnBotJava sample * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list * * Operation: * 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 bacb66e..fbb7416 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 @@ -33,10 +33,11 @@ import com.qualcomm.ftccommon.SoundPlayer; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; + import java.io.File; -/** - * This file demonstrates how to play simple sounds on both the RC and DS phones. +/* + * This OpMode demonstrates how to play simple sounds on both the RC and DS phones. * It illustrates how to play sound files that have been copied to the RC Phone * This technique is best suited for use with OnBotJava since it does not require the app to be modified. * 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 8832957..983e434 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 @@ -30,14 +30,13 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import android.content.Context; - import com.qualcomm.ftccommon.SoundPlayer; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.eventloop.opmode.Disabled; -/** - * This file demonstrates how to play one of the several SKYSTONE/Star Wars sounds loaded into the SDK. +/* + * This OpMode demonstrates how to play one of the several SKYSTONE/Star Wars sounds loaded into the SDK. * It does this by creating a simple "chooser" controlled by the gamepad Up Down buttons. * This code also prevents sounds from stacking up by setting a "playing" flag, which is cleared when the sound finishes playing. * diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTelemetry.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTelemetry.java index d3b4682..f2c6097 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTelemetry.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTelemetry.java @@ -34,26 +34,25 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.VoltageSensor; import com.qualcomm.robotcore.util.ElapsedTime; - import org.firstinspires.ftc.robotcore.external.Func; import org.firstinspires.ftc.robotcore.external.Telemetry; -/** - * {@link ConceptTelemetry} illustrates various ways in which telemetry can be +/* + * This OpMode illustrates various ways in which telemetry can be * transmitted from the robot controller to the driver station. The sample illustrates * numeric and text data, formatted output, and optimized evaluation of expensive-to-acquire - * information. The telemetry {@link Telemetry#log() log} is illustrated by scrolling a poem + * information. The telemetry log is illustrated by scrolling a poem * to the driver station. * - * @see Telemetry + * Also see the Telemetry javadocs. */ @TeleOp(name = "Concept: Telemetry", group = "Concept") @Disabled public class ConceptTelemetry extends LinearOpMode { - /** keeps track of the line of the poem which is to be emitted next */ + /** Keeps track of the line of the poem which is to be emitted next */ int poemLine = 0; - /** keeps track of how long it's been since we last emitted a line of poetry */ + /** Keeps track of how long it's been since we last emitted a line of poetry */ ElapsedTime poemElapsed = new ElapsedTime(); static final String[] poem = new String[] { @@ -94,10 +93,10 @@ public class ConceptTelemetry extends LinearOpMode { // The interval between lines of poetry, in seconds double sPoemInterval = 0.6; - /** + /* * Wait until we've been given the ok to go. For something to do, we emit the * elapsed time as we sit here and wait. If we didn't want to do anything while - * we waited, we would just call {@link #waitForStart()}. + * we waited, we would just call waitForStart(). */ while (!isStarted()) { telemetry.addData("time", "%.1f seconds", opmodeRunTime.seconds()); @@ -107,10 +106,10 @@ public class ConceptTelemetry extends LinearOpMode { // Ok, we've been given the ok to go - /** + /* * As an illustration, the first line on our telemetry display will display the battery voltage. * The idea here is that it's expensive to compute the voltage (at least for purposes of illustration) - * so you don't want to do it unless the data is actually going to make it to the + * so you don't want to do it unless the data is _actually_ going to make it to the * driver station (recall that telemetry transmission is throttled to reduce bandwidth use. * Note that getBatteryVoltage() below returns 'Infinity' if there's no voltage sensor attached. * @@ -122,7 +121,7 @@ public class ConceptTelemetry extends LinearOpMode { } }); - // Reset to keep some timing stats for the post-'start' part of the opmode + // Reset to keep some timing stats for the post-'start' part of the OpMode opmodeRunTime.reset(); int loopCount = 1; @@ -146,13 +145,13 @@ public class ConceptTelemetry extends LinearOpMode { .addData("x", gamepad1.right_stick_x) .addData("y", gamepad1.right_stick_y); - /** + /* * Transmit the telemetry to the driver station, subject to throttling. - * @see Telemetry#getMsTransmissionInterval() + * See the documentation for Telemetry.getMsTransmissionInterval() for more information. */ telemetry.update(); - /** Update loop info and play nice with the rest of the {@link Thread}s in the system */ + // Update loop info loopCount++; } } diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetection.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetection.java index 01f423f..c5e7e30 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetection.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetection.java @@ -32,15 +32,16 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.tfod.TfodProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of TensorFlow Object Detection, +import java.util.List; + +/* + * This OpMode illustrates the basics of TensorFlow Object Detection, * including Java Builder structures for specifying Vision parameters. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -53,12 +54,12 @@ public class ConceptTensorFlowObjectDetection extends LinearOpMode { private static final boolean USE_WEBCAM = true; // true for webcam, false for phone camera /** - * {@link #tfod} is the variable to store our instance of the TensorFlow Object Detection processor. + * The variable to store our instance of the TensorFlow Object Detection processor. */ private TfodProcessor tfod; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -158,7 +159,7 @@ public class ConceptTensorFlowObjectDetection extends LinearOpMode { } // end method initTfod() /** - * Function to add telemetry about TensorFlow Object Detection (TFOD) recognitions. + * Add telemetry about TensorFlow Object Detection (TFOD) recognitions. */ private void telemetryTfod() { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionEasy.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionEasy.java index f397b0e..5c1b712 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionEasy.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionEasy.java @@ -32,15 +32,16 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.tfod.TfodProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of TensorFlow Object Detection, using +import java.util.List; + +/* + * This OpMode illustrates the basics of TensorFlow Object Detection, using * the easiest way. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -53,12 +54,12 @@ public class ConceptTensorFlowObjectDetectionEasy extends LinearOpMode { private static final boolean USE_WEBCAM = true; // true for webcam, false for phone camera /** - * {@link #tfod} is the variable to store our instance of the TensorFlow Object Detection processor. + * The variable to store our instance of the TensorFlow Object Detection processor. */ private TfodProcessor tfod; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -118,7 +119,7 @@ public class ConceptTensorFlowObjectDetectionEasy extends LinearOpMode { } // end method initTfod() /** - * Function to add telemetry about TensorFlow Object Detection (TFOD) recognitions. + * Add telemetry about TensorFlow Object Detection (TFOD) recognitions. */ private void telemetryTfod() { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.java index 3440c18..1c0ed77 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.java @@ -32,7 +32,6 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import java.util.List; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; @@ -41,8 +40,10 @@ import org.firstinspires.ftc.vision.VisionPortal; import org.firstinspires.ftc.vision.VisionPortal.CameraState; import org.firstinspires.ftc.vision.tfod.TfodProcessor; -/** - * This 2023-2024 OpMode illustrates the basics of TensorFlow Object Detection, using +import java.util.List; + +/* + * This OpMode illustrates the basics of TensorFlow Object Detection, using * two webcams. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -60,12 +61,12 @@ public class ConceptTensorFlowObjectDetectionSwitchableCameras extends LinearOpM private boolean oldRightBumper; /** - * {@link #tfod} is the variable to store our instance of the TensorFlow Object Detection processor. + * The variable to store our instance of the TensorFlow Object Detection processor. */ private TfodProcessor tfod; /** - * {@link #visionPortal} is the variable to store our instance of the vision portal. + * The variable to store our instance of the vision portal. */ private VisionPortal visionPortal; @@ -130,7 +131,7 @@ public class ConceptTensorFlowObjectDetectionSwitchableCameras extends LinearOpM } // end method initTfod() /** - * Function to add telemetry about camera switching. + * Add telemetry about camera switching. */ private void telemetryCameraSwitching() { if (visionPortal.getActiveCamera().equals(webcam1)) { @@ -143,7 +144,7 @@ public class ConceptTensorFlowObjectDetectionSwitchableCameras extends LinearOpM } // end method telemetryCameraSwitching() /** - * Function to add telemetry about TensorFlow Object Detection (TFOD) recognitions. + * Add telemetry about TensorFlow Object Detection (TFOD) recognitions. */ private void telemetryTfod() { @@ -164,7 +165,7 @@ public class ConceptTensorFlowObjectDetectionSwitchableCameras extends LinearOpM } // end method telemetryTfod() /** - * Function to set the active camera according to input from the gamepad. + * Set the active camera according to input from the gamepad. */ private void doCameraSwitching() { if (visionPortal.getCameraState() == CameraState.STREAMING) { 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 ff7a878..be2e218 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 @@ -33,11 +33,10 @@ import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.hardware.Servo; import com.qualcomm.robotcore.util.ElapsedTime; -/** - * This file illustrates the concept of driving a path based on encoder counts. +/* + * This OpMode illustrates the concept of driving a path based on encoder counts. * The code is structured as a LinearOpMode * * The code REQUIRES that you DO have encoders on the wheels, @@ -59,7 +58,7 @@ import com.qualcomm.robotcore.util.ElapsedTime; * This code uses the RUN_TO_POSITION mode to enable the Motor controllers to generate the run profile * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @Autonomous(name="Robot: Auto Drive By Encoder", group="Robot") @@ -131,7 +130,7 @@ public class RobotAutoDriveByEncoder_Linear extends LinearOpMode { * Move will stop if any of three conditions occur: * 1) Move gets to the desired position * 2) Move runs out of time - * 3) Driver stops the opmode running. + * 3) Driver stops the OpMode running. */ public void encoderDrive(double speed, double leftInches, double rightInches, @@ -139,7 +138,7 @@ public class RobotAutoDriveByEncoder_Linear extends LinearOpMode { int newLeftTarget; int newRightTarget; - // Ensure that the opmode is still active + // Ensure that the OpMode is still active if (opModeIsActive()) { // Determine new target position, and pass to motor controller diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByGyro_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByGyro_Linear.java index b52ab47..7885fe4 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByGyro_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveByGyro_Linear.java @@ -29,21 +29,19 @@ package org.firstinspires.ftc.robotcontroller.external.samples; -import com.qualcomm.hardware.bosch.BNO055IMU; +import com.qualcomm.hardware.rev.RevHubOrientationOnRobot; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.IMU; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; -import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; -import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; -import org.firstinspires.ftc.robotcore.external.navigation.Orientation; +import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles; -/** - * This file illustrates the concept of driving an autonomous path based on Gyro heading and encoder counts. +/* + * This OpMode illustrates the concept of driving an autonomous path based on Gyro (IMU) heading and encoder counts. * The code is structured as a LinearOpMode * * The path to be followed by the robot is built from a series of drive, turn or pause steps. @@ -51,9 +49,10 @@ import org.firstinspires.ftc.robotcore.external.navigation.Orientation; * * The code REQUIRES that you have encoders on the drive motors, otherwise you should use: RobotAutoDriveByTime; * - * This code ALSO requires that you have a BOSCH BNO055 IMU, otherwise you would use: RobotAutoDriveByEncoder; - * This IMU is found in REV Control/Expansion Hubs shipped prior to July 2022, and possibly also on later models. + * This code uses the Universal IMU interface so it will work with either the BNO055, or BHI260 IMU. * To run as written, the Control/Expansion hub should be mounted horizontally on a flat part of the robot chassis. + * The REV Logo should be facing UP, and the USB port should be facing forward. + * If this is not the configuration of your REV Control Hub, then the code should be modified to reflect the correct orientation. * * This sample requires that the drive Motors have been configured with names : left_drive and right_drive. * It also requires that a positive power command moves both motors forward, and causes the encoders to count UP. @@ -61,7 +60,7 @@ import org.firstinspires.ftc.robotcore.external.navigation.Orientation; * See the beginning of runOpMode() to set the FORWARD/REVERSE option for each motor. * * This code uses RUN_TO_POSITION mode for driving straight, and RUN_USING_ENCODER mode for turning and holding. - * Note: You must call setTargetPosition() at least once before switching to RUN_TO_POSITION mode. + * Note: This code implements the requirement of calling setTargetPosition() at least once before switching to RUN_TO_POSITION mode. * * Notes: * @@ -96,10 +95,8 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { /* Declare OpMode members. */ private DcMotor leftDrive = null; private DcMotor rightDrive = null; - private BNO055IMU imu = null; // Control/Expansion Hub IMU + private IMU imu = null; // Control/Expansion Hub IMU - private double robotHeading = 0; - private double headingOffset = 0; private double headingError = 0; // These variable are declared here (as class members) so they can be updated in various methods, @@ -151,11 +148,19 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { leftDrive.setDirection(DcMotor.Direction.REVERSE); rightDrive.setDirection(DcMotor.Direction.FORWARD); - // define initialization values for IMU, and then initialize it. - BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); - parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES; - imu = hardwareMap.get(BNO055IMU.class, "imu"); - imu.initialize(parameters); + /* The next two lines define Hub orientation. + * The Default Orientation (shown) is when a hub is mounted horizontally with the printed logo pointing UP and the USB port pointing FORWARD. + * + * To Do: EDIT these two lines to match YOUR mounting configuration. + */ + RevHubOrientationOnRobot.LogoFacingDirection logoDirection = RevHubOrientationOnRobot.LogoFacingDirection.UP; + RevHubOrientationOnRobot.UsbFacingDirection usbDirection = RevHubOrientationOnRobot.UsbFacingDirection.FORWARD; + RevHubOrientationOnRobot orientationOnRobot = new RevHubOrientationOnRobot(logoDirection, usbDirection); + + // Now initialize the IMU with this mounting orientation + // This sample expects the IMU to be in a REV Hub and named "imu". + imu = hardwareMap.get(IMU.class, "imu"); + imu.initialize(new IMU.Parameters(orientationOnRobot)); // Ensure the robot is stationary. Reset the encoders and set the motors to BRAKE mode leftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); @@ -165,14 +170,14 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { // Wait for the game to start (Display Gyro value while waiting) while (opModeInInit()) { - telemetry.addData(">", "Robot Heading = %4.0f", getRawHeading()); + telemetry.addData(">", "Robot Heading = %4.0f", getHeading()); telemetry.update(); } // Set the encoders for closed loop speed control, and reset the heading. leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); - resetHeading(); + imu.resetYaw(); // Step through each leg of the path, // Notes: Reverse movement is obtained by setting a negative distance (not speed) @@ -208,10 +213,10 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { // ********** HIGH Level driving functions. ******************** /** - * Method to drive in a straight line, on a fixed compass heading (angle), based on encoder counts. + * Drive in a straight line, on a fixed compass heading (angle), based on encoder counts. * Move will stop if either of these conditions occur: * 1) Move gets to the desired position - * 2) Driver stops the opmode running. + * 2) Driver stops the OpMode running. * * @param maxDriveSpeed MAX Speed for forward/rev motion (range 0 to +1.0) . * @param distance Distance (in inches) to move from current position. Negative distance means move backward. @@ -223,7 +228,7 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { double distance, double heading) { - // Ensure that the opmode is still active + // Ensure that the OpMode is still active if (opModeIsActive()) { // Determine new target position, and pass to motor controller @@ -269,10 +274,13 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { } /** - * Method to spin on central axis to point in a new direction. + * Spin on the central axis to point in a new direction. + *

* Move will stop if either of these conditions occur: + *

* 1) Move gets to the heading (angle) - * 2) Driver stops the opmode running. + *

+ * 2) Driver stops the OpMode running. * * @param maxTurnSpeed Desired MAX speed of turn. (range 0 to +1.0) * @param heading Absolute Heading Angle (in Degrees) relative to last gyro reset. @@ -305,8 +313,10 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { } /** - * Method to obtain & hold a heading for a finite amount of time + * Obtain & hold a heading for a finite amount of time + *

* Move will stop once the requested time has elapsed + *

* This function is useful for giving the robot a moment to stabilize it's heading between movements. * * @param maxTurnSpeed Maximum differential turn speed (range 0 to +1.0) @@ -342,7 +352,7 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { // ********** LOW Level driving functions. ******************** /** - * This method uses a Proportional Controller to determine how much steering correction is required. + * Use a Proportional Controller to determine how much steering correction is required. * * @param desiredHeading The desired absolute heading (relative to last heading reset) * @param proportionalGain Gain factor applied to heading error to obtain turning power. @@ -351,11 +361,8 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { public double getSteeringCorrection(double desiredHeading, double proportionalGain) { targetHeading = desiredHeading; // Save for telemetry - // Get the robot heading by applying an offset to the IMU heading - robotHeading = getRawHeading() - headingOffset; - // Determine the heading current error - headingError = targetHeading - robotHeading; + headingError = targetHeading - getHeading(); // Normalize the error to be within +/- 180 degrees while (headingError > 180) headingError -= 360; @@ -366,7 +373,7 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { } /** - * This method takes separate drive (fwd/rev) and turn (right/left) requests, + * Take separate drive (fwd/rev) and turn (right/left) requests, * combines them, and applies the appropriate speed commands to the left and right wheel motors. * @param drive forward motor speed * @param turn clockwise turning motor speed. @@ -406,26 +413,17 @@ public class RobotAutoDriveByGyro_Linear extends LinearOpMode { telemetry.addData("Motion", "Turning"); } - telemetry.addData("Angle Target:Current", "%5.2f:%5.0f", targetHeading, robotHeading); - telemetry.addData("Error:Steer", "%5.1f:%5.1f", headingError, turnSpeed); - telemetry.addData("Wheel Speeds L:R.", "%5.2f : %5.2f", leftSpeed, rightSpeed); + telemetry.addData("Heading- Target : Current", "%5.2f : %5.0f", targetHeading, getHeading()); + telemetry.addData("Error : Steer Pwr", "%5.1f : %5.1f", headingError, turnSpeed); + telemetry.addData("Wheel Speeds L : R", "%5.2f : %5.2f", leftSpeed, rightSpeed); telemetry.update(); } /** - * read the raw (un-offset Gyro heading) directly from the IMU + * read the Robot heading directly from the IMU (in degrees) */ - public double getRawHeading() { - Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); - return angles.firstAngle; - } - - /** - * Reset the "offset" heading back to zero - */ - public void resetHeading() { - // Save a new heading offset equal to the current raw heading. - headingOffset = getRawHeading(); - robotHeading = 0; + public double getHeading() { + YawPitchRollAngles orientation = imu.getRobotYawPitchRollAngles(); + return orientation.getYaw(AngleUnit.DEGREES); } } 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 e27c9c7..b449258 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 @@ -35,8 +35,8 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.ElapsedTime; -/** - * This file illustrates the concept of driving a path based on time. +/* + * This OpMode illustrates the concept of driving a path based on time. * The code is structured as a LinearOpMode * * The code assumes that you do NOT have encoders on the wheels, 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 c1f642a..ab21e96 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 @@ -34,7 +34,6 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.Range; - import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.hardware.camera.controls.ExposureControl; @@ -46,7 +45,7 @@ import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; import java.util.List; import java.util.concurrent.TimeUnit; -/** +/* * This OpMode illustrates using a camera to locate and drive towards a specific AprilTag. * The code assumes a Holonomic (Mecanum or X Drive) Robot. * @@ -151,11 +150,13 @@ public class RobotAutoDriveToAprilTagOmni extends LinearOpMode // Step through the list of detected tags and look for a matching tag List currentDetections = aprilTag.getDetections(); for (AprilTagDetection detection : currentDetections) { - if ((detection.metadata != null) - && ((DESIRED_TAG_ID >= 0) || (detection.id == DESIRED_TAG_ID)) ){ + if ((detection.metadata != null) && + ((DESIRED_TAG_ID < 0) || (detection.id == DESIRED_TAG_ID)) ){ targetFound = true; desiredTag = detection; break; // don't look any further. + } else { + telemetry.addData("Unknown Target", "Tag ID %d is not in TagLibrary\n", detection.id); } } @@ -167,7 +168,7 @@ public class RobotAutoDriveToAprilTagOmni extends LinearOpMode telemetry.addData("Bearing","%3.0f degrees", desiredTag.ftcPose.bearing); telemetry.addData("Yaw","%3.0f degrees", desiredTag.ftcPose.yaw); } else { - telemetry.addData(">","Drive using joystick to find target\n"); + telemetry.addData(">","Drive using joysticks to find valid target\n"); } // If Left Bumper is being pressed, AND we have found the desired target, Drive to target Automatically . @@ -202,8 +203,11 @@ public class RobotAutoDriveToAprilTagOmni extends LinearOpMode /** * Move robot according to desired axes motions + *

* Positive X is forward + *

* Positive Y is strafe left + *

* Positive Yaw is counter-clockwise */ public void moveRobot(double x, double y, double yaw) { 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 da6097c..657bc3b 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 @@ -34,7 +34,6 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.Range; - import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.hardware.camera.controls.ExposureControl; @@ -46,7 +45,7 @@ import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor; import java.util.List; import java.util.concurrent.TimeUnit; -/** +/* * This OpMode illustrates using a camera to locate and drive towards a specific AprilTag. * The code assumes a basic two-wheel (Tank) Robot Drivetrain * @@ -141,11 +140,13 @@ public class RobotAutoDriveToAprilTagTank extends LinearOpMode // Step through the list of detected tags and look for a matching tag List currentDetections = aprilTag.getDetections(); for (AprilTagDetection detection : currentDetections) { - if ((detection.metadata != null) - && ((DESIRED_TAG_ID >= 0) || (detection.id == DESIRED_TAG_ID)) ){ + if ((detection.metadata != null) && + ((DESIRED_TAG_ID < 0) || (detection.id == DESIRED_TAG_ID)) ){ targetFound = true; desiredTag = detection; break; // don't look any further. + } else { + telemetry.addData("Unknown Target", "Tag ID %d is not in TagLibrary\n", detection.id); } } @@ -156,7 +157,7 @@ public class RobotAutoDriveToAprilTagTank extends LinearOpMode telemetry.addData("Range", "%5.1f inches", desiredTag.ftcPose.range); telemetry.addData("Bearing","%3.0f degrees", desiredTag.ftcPose.bearing); } else { - telemetry.addData(">","Drive using joystick to find target\n"); + telemetry.addData(">","Drive using joysticks to find valid target\n"); } // If Left Bumper is being pressed, AND we have found the desired target, Drive to target Automatically . @@ -188,7 +189,9 @@ public class RobotAutoDriveToAprilTagTank extends LinearOpMode /** * Move robot according to desired axes motions + *

* Positive X is forward + *

* Positive Yaw is counter-clockwise */ public void moveRobot(double x, double yaw) { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToLine_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToLine_Linear.java index 9ddf6ad..e5076c0 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToLine_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotAutoDriveToLine_Linear.java @@ -32,15 +32,13 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; -import com.qualcomm.robotcore.hardware.ColorSensor; import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.hardware.LightSensor; import com.qualcomm.robotcore.hardware.NormalizedColorSensor; import com.qualcomm.robotcore.hardware.NormalizedRGBA; import com.qualcomm.robotcore.hardware.SwitchableLight; -/** - * This file illustrates the concept of driving up to a line and then stopping. +/* + * This OpMode illustrates the concept of driving up to a line and then stopping. * The code is structured as a LinearOpMode * * The Sensor used here can be a REV Color Sensor V2 or V3. Make sure the white LED is turned on. @@ -70,7 +68,7 @@ public class RobotAutoDriveToLine_Linear extends LinearOpMode { private DcMotor leftDrive = null; private DcMotor rightDrive = null; - /** The colorSensor field will contain a reference to our color sensor hardware object */ + /** The variable to store a reference to our color sensor hardware object */ NormalizedColorSensor colorSensor; static final double WHITE_THRESHOLD = 0.5; // spans between 0.0 - 1.0 from dark to light diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotHardware.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotHardware.java index 71b8e0c..b1c8de6 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotHardware.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotHardware.java @@ -34,7 +34,7 @@ import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.Servo; import com.qualcomm.robotcore.util.Range; -/** +/* * This file works in conjunction with the External Hardware Class sample called: ConceptExternalHardwareClass.java * Please read the explanations in that Sample about how to use this class definition. * @@ -48,8 +48,8 @@ import com.qualcomm.robotcore.util.Range; * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with *exactly the same name*. * - * Or.. In OnBot Java, add a new file named RobotHardware.java, drawing from this Sample; select Not an OpMode. - * Also add a new OpMode, drawing from the Sample ConceptExternalHardwareClass.java; select TeleOp. + * Or... In OnBot Java, add a new file named RobotHardware.java, select this sample, and select Not an OpMode. + * Also add a new OpMode, select the sample ConceptExternalHardwareClass.java, and select TeleOp. * */ @@ -79,7 +79,7 @@ public class RobotHardware { /** * Initialize all the robot's hardware. * This method must be called ONCE when the OpMode is initialized. - * + *

* All of the hardware devices are accessed via the hardware map, and initialized. */ public void init() { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopPOV_Linear.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopPOV_Linear.java index d4fac1d..454d5a7 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopPOV_Linear.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopPOV_Linear.java @@ -36,8 +36,8 @@ import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.Servo; import com.qualcomm.robotcore.util.Range; -/** - * This particular OpMode executes a POV Game style Teleop for a direct drive robot +/* + * This OpMode executes a POV Game style Teleop for a direct drive robot * The code is structured as a LinearOpMode * * In this mode the left stick moves the robot FWD and back, the Right stick turns left and right. @@ -45,7 +45,7 @@ import com.qualcomm.robotcore.util.Range; * It also opens and closes the claws slowly using the left and right Bumper buttons. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name="Robot: Teleop POV", group="Robot") diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopTank_Iterative.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopTank_Iterative.java index 9f1aa7c..b9f4fcf 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopTank_Iterative.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotTeleopTank_Iterative.java @@ -36,8 +36,8 @@ import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.Servo; import com.qualcomm.robotcore.util.Range; -/** - * This particular OpMode executes a Tank Drive control TeleOp a direct drive robot +/* + * This OpMode executes a Tank Drive control TeleOp a direct drive robot * The code is structured as an Iterative OpMode * * In this mode, the left and right joysticks control the left and right motors respectively. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SampleRevBlinkinLedDriver.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SampleRevBlinkinLedDriver.java index 337b703..bcf5b80 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SampleRevBlinkinLedDriver.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SampleRevBlinkinLedDriver.java @@ -33,14 +33,13 @@ import com.qualcomm.hardware.rev.RevBlinkinLedDriver; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; - import org.firstinspires.ftc.robotcore.external.Telemetry; import org.firstinspires.ftc.robotcore.internal.system.Deadline; import java.util.concurrent.TimeUnit; /* - * Display patterns of a REV Robotics Blinkin LED Driver. + * This OpMode demonstrates use of the REV Robotics Blinkin LED Driver. * AUTO mode cycles through all of the patterns. * MANUAL mode allows the user to manually change patterns using the * left and right bumpers of a gamepad. diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMU.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMU.java index e0022d6..405da1e 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMU.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMU.java @@ -34,7 +34,6 @@ import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; - import org.firstinspires.ftc.robotcore.external.Func; import org.firstinspires.ftc.robotcore.external.navigation.Acceleration; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; @@ -46,19 +45,19 @@ import org.firstinspires.ftc.robotcore.external.navigation.Velocity; import java.util.Locale; -/** - * {@link SensorBNO055IMU} gives a short demo on how to use the BNO055 Inertial Motion Unit (IMU) from AdaFruit. +/* + * This OpMode gives a short demo on how to use the BNO055 Inertial Motion Unit (IMU) from AdaFruit. * * Note: this is a Legacy example that will not work with newer Control/Expansion Hubs that use a different IMU * Please use the new SensorIMUOrthogonal or SensorIMUNonOrthogonal samples for a more universal IMU interface. * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list * * @see Adafruit IMU */ @TeleOp(name = "Sensor: BNO055 IMU", group = "Sensor") -@Disabled // Comment this out to add to the opmode list +@Disabled // Comment this out to add to the OpMode list public class SensorBNO055IMU extends LinearOpMode { //---------------------------------------------------------------------------------------------- @@ -84,7 +83,7 @@ public class SensorBNO055IMU extends LinearOpMode BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES; parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC; - parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode + parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample OpMode parameters.loggingEnabled = true; parameters.loggingTag = "IMU"; parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator(); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMUCalibration.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMUCalibration.java index 9daa9f7..93f1789 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMUCalibration.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorBNO055IMUCalibration.java @@ -29,13 +29,11 @@ package org.firstinspires.ftc.robotcontroller.external.samples; -import com.qualcomm.hardware.adafruit.AdafruitBNO055IMU; import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ReadWriteFile; - import org.firstinspires.ftc.robotcore.external.Func; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; @@ -46,63 +44,60 @@ import org.firstinspires.ftc.robotcore.internal.system.AppUtil; import java.io.File; import java.util.Locale; -/** - * {@link SensorBNO055IMUCalibration} calibrates the IMU accelerometer per +/* + * This OpMode calibrates a BNO055 IMU per * "Section 3.11 Calibration" of the BNO055 specification. * * Note: this is a Legacy example that will not work with newer Control/Expansion Hubs that use a different IMU * Please use the new SensorIMUOrthogonal or SensorIMUNonOrthogonal samples for a more universal IMU interface. * - *

Manual calibration of the IMU is definitely NOT necessary: except for the magnetometer - * (which is not used by the default {@link BNO055IMU.SensorMode#IMU - * SensorMode#IMU}), the BNO055 is internally self-calibrating and thus can be very successfully - * used without manual intervention. That said, performing a one-time calibration, saving the - * results persistently, then loading them again at each run can help reduce the time that automatic - * calibration requires.

+ * Manual calibration of the IMU is definitely NOT necessary: except for the magnetometer (which is not used by the + * default "IMU" SensorMode), the BNO055 is internally self-calibrating and thus can be very successfully used without + * manual intervention. That said, performing a one-time calibration, saving the results persistently, then loading them + * again at each run can help reduce the time that automatic calibration requires. * - *

This summary of the calibration process, from - * Intel, is informative:

+ * This summary of the calibration process from Intel is informative: + * http://iotdk.intel.com/docs/master/upm/classupm_1_1_b_n_o055.html * - *

"This device requires calibration in order to operate accurately. [...] Calibration data is + * "This device requires calibration in order to operate accurately. [...] Calibration data is * lost on a power cycle. See one of the examples for a description of how to calibrate the device, - * but in essence:

+ * but in essence: * - *

There is a calibration status register available [...] that returns the calibration status + * There is a calibration status register available [...] that returns the calibration status * of the accelerometer (ACC), magnetometer (MAG), gyroscope (GYR), and overall system (SYS). * Each of these values range from 0 (uncalibrated) to 3 (fully calibrated). Calibration [ideally] * involves certain motions to get all 4 values at 3. The motions are as follows (though see the - * datasheet for more information):

+ * datasheet for more information): * - *
  • - *
      GYR: Simply let the sensor sit flat for a few seconds.
    - *
      ACC: Move the sensor in various positions. Start flat, then rotate slowly by 45 - * degrees, hold for a few seconds, then continue rotating another 45 degrees and - * hold, etc. 6 or more movements of this type may be required. You can move through - * any axis you desire, but make sure that the device is lying at least once - * perpendicular to the x, y, and z axis.
    - *
      MAG: Move slowly in a figure 8 pattern in the air, until the calibration values reaches 3.
    - *
      SYS: This will usually reach 3 when the other items have also reached 3. If not, continue - * slowly moving the device though various axes until it does."
    - *
  • + * 1. GYR: Simply let the sensor sit flat for a few seconds. + * 2. ACC: Move the sensor in various positions. Start flat, then rotate slowly by 45 + * degrees, hold for a few seconds, then continue rotating another 45 degrees and + * hold, etc. 6 or more movements of this type may be required. You can move through + * any axis you desire, but make sure that the device is lying at least once + * perpendicular to the x, y, and z axis. + * 3. MAG: Move slowly in a figure 8 pattern in the air, until the calibration values reaches 3. + * 4. SYS: This will usually reach 3 when the other items have also reached 3. If not, continue + * slowly moving the device though various axes until it does." * - *

    To calibrate the IMU, run this sample opmode with a gamepad attached to the driver station. + * To calibrate the IMU, run this sample OpMode with a gamepad attached to the driver station. * Once the IMU has reached sufficient calibration as reported on telemetry, press the 'A' * button on the gamepad to write the calibration to a file. That file can then be indicated - * later when running an opmode which uses the IMU.

    + * later when running an OpMode which uses the IMU. * - *

    Note: if your intended uses of the IMU do not include use of all its sensors (for exmaple, + * Note: if your intended uses of the IMU do not include use of all its sensors (for example, * you might not use the magnetometer), then it makes little sense for you to wait for full * calibration of the sensors you are not using before saving the calibration data. Indeed, * it appears that in a SensorMode that doesn't use the magnetometer (for example), the - * magnetometer cannot actually be calibrated.

    + * magnetometer cannot actually be calibrated. * - * @see AdafruitBNO055IMU - * @see BNO055IMU.Parameters#calibrationDataFile - * @see BNO055 product page - * @see BNO055 specification + * References: + * The AdafruitBNO055IMU Javadoc + * The BNO055IMU.Parameters.calibrationDataFile Javadoc + * The BNO055 product page: https://www.bosch-sensortec.com/bst/products/all_products/bno055 + * The BNO055 datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bno055-ds000.pdf */ @TeleOp(name = "Sensor: BNO055 IMU Calibration", group = "Sensor") -@Disabled // Uncomment this to add to the opmode list +@Disabled // Uncomment this to add to the OpMode list public class SensorBNO055IMUCalibration extends LinearOpMode { //---------------------------------------------------------------------------------------------- @@ -125,7 +120,7 @@ public class SensorBNO055IMUCalibration extends LinearOpMode telemetry.log().add(""); telemetry.log().add("Please refer to the calibration instructions"); telemetry.log().add("contained in the Adafruit IMU calibration"); - telemetry.log().add("sample opmode."); + telemetry.log().add("sample OpMode."); telemetry.log().add(""); telemetry.log().add("When sufficient calibration has been reached,"); telemetry.log().add("press the 'A' button to write the current"); @@ -159,7 +154,7 @@ public class SensorBNO055IMUCalibration extends LinearOpMode // Save the calibration data to a file. You can choose whatever file // name you wish here, but you'll want to indicate the same file name - // when you initialize the IMU in an opmode in which it is used. If you + // when you initialize the IMU in an OpMode in which it is used. If you // have more than one IMU on your robot, you'll of course want to use // different configuration file names for each. String filename = "AdafruitIMUCalibration.json"; @@ -232,4 +227,4 @@ public class SensorBNO055IMUCalibration extends LinearOpMode String formatDegrees(double degrees){ return String.format(Locale.getDefault(), "%.1f", AngleUnit.DEGREES.normalize(degrees)); } -} \ No newline at end of file +} diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorColor.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorColor.java index 8209b83..7546c9d 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorColor.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorColor.java @@ -32,7 +32,6 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import android.app.Activity; import android.graphics.Color; import android.view.View; - import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; @@ -40,12 +39,11 @@ import com.qualcomm.robotcore.hardware.DistanceSensor; import com.qualcomm.robotcore.hardware.NormalizedColorSensor; import com.qualcomm.robotcore.hardware.NormalizedRGBA; import com.qualcomm.robotcore.hardware.SwitchableLight; - import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; -/** - * This is an example LinearOpMode that shows how to use a color sensor in a generic - * way, regardless of which particular make or model of color sensor is used. The Op Mode +/* + * This OpMode shows how to use a color sensor in a generic + * way, regardless of which particular make or model of color sensor is used. The OpMode * assumes that the color sensor is configured with a name of "sensor_color". * * There will be some variation in the values measured depending on the specific sensor you are using. @@ -64,7 +62,7 @@ import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; * and surface reflectivity. You should use a different sensor if you need precise distance measurements. * * Use Android Studio 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 Op Mode to the Driver Station OpMode list + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name = "Sensor: Color", group = "Sensor") @Disabled @@ -78,13 +76,13 @@ public class SensorColor extends LinearOpMode { * robot. Note that you won't see anything change on the Driver Station, only on the Robot Controller. */ View relativeLayout; - /** - * The runOpMode() method is the root of this Op Mode, as it is in all LinearOpModes. + /* + * The runOpMode() method is the root of this OpMode, as it is in all LinearOpModes. * Our implementation here, though is a bit unusual: we've decided to put all the actual work * in the runSample() method rather than directly in runOpMode() itself. The reason we do that is * that in this sample we're changing the background color of the robot controller screen as the - * Op Mode runs, and we want to be able to *guarantee* that we restore it to something reasonable - * and palatable when the Op Mode ends. The simplest way to do that is to use a try...finally + * OpMode runs, and we want to be able to *guarantee* that we restore it to something reasonable + * and palatable when the OpMode ends. The simplest way to do that is to use a try...finally * block around the main, core logic, and an easy way to make that all clear was to separate * the former from the latter in separate methods. */ diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorHuskyLens.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorHuskyLens.java new file mode 100644 index 0000000..1ec1f55 --- /dev/null +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorHuskyLens.java @@ -0,0 +1,149 @@ +/* +Copyright (c) 2023 FIRST + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted (subject to the limitations in the disclaimer below) provided that +the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +Neither the name of FIRST nor the names of its contributors may be used to +endorse or promote products derived from this software without specific prior +written permission. + +NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS +LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package org.firstinspires.ftc.robotcontroller.external.samples; + +import com.qualcomm.hardware.dfrobot.HuskyLens; +import com.qualcomm.hardware.rev.Rev2mDistanceSensor; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.DistanceSensor; + +import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; +import org.firstinspires.ftc.robotcore.internal.system.Deadline; + +import java.util.concurrent.TimeUnit; + +/* + * This OpMode illustrates how to use the DFRobot HuskyLens. + * + * The HuskyLens is a Vision Sensor with a built-in object detection model. It can + * detect a number of predefined objects and AprilTags in the 36h11 family, can + * recognize colors, and can be trained to detect custom objects. See this website for + * documentation: https://wiki.dfrobot.com/HUSKYLENS_V1.0_SKU_SEN0305_SEN0336 + * + * This sample illustrates how to detect AprilTags, but can be used to detect other types + * of objects by changing the algorithm. It assumes that the HuskyLens is configured with + * a name of "huskylens". + * + * Use Android Studio 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 = "Sensor: HuskyLens", group = "Sensor") +@Disabled +public class SensorHuskyLens extends LinearOpMode { + + private final int READ_PERIOD = 1; + + private HuskyLens huskyLens; + + @Override + public void runOpMode() + { + huskyLens = hardwareMap.get(HuskyLens.class, "huskylens"); + + /* + * This sample rate limits the reads solely to allow a user time to observe + * what is happening on the Driver Station telemetry. Typical applications + * would not likely rate limit. + */ + Deadline rateLimit = new Deadline(READ_PERIOD, TimeUnit.SECONDS); + + /* + * Immediately expire so that the first time through we'll do the read. + */ + rateLimit.expire(); + + /* + * Basic check to see if the device is alive and communicating. This is not + * technically necessary here as the HuskyLens class does this in its + * doInitialization() method which is called when the device is pulled out of + * the hardware map. However, sometimes it's unclear why a device reports as + * failing on initialization. In the case of this device, it's because the + * call to knock() failed. + */ + if (!huskyLens.knock()) { + telemetry.addData(">>", "Problem communicating with " + huskyLens.getDeviceName()); + } else { + telemetry.addData(">>", "Press start to continue"); + } + + /* + * The device uses the concept of an algorithm to determine what types of + * objects it will look for and/or what mode it is in. The algorithm may be + * selected using the scroll wheel on the device, or via software as shown in + * the call to selectAlgorithm(). + * + * The SDK itself does not assume that the user wants a particular algorithm on + * startup, and hence does not set an algorithm. + * + * Users, should, in general, explicitly choose the algorithm they want to use + * within the OpMode by calling selectAlgorithm() and passing it one of the values + * found in the enumeration HuskyLens.Algorithm. + */ + huskyLens.selectAlgorithm(HuskyLens.Algorithm.TAG_RECOGNITION); + + telemetry.update(); + waitForStart(); + + /* + * Looking for AprilTags per the call to selectAlgorithm() above. A handy grid + * for testing may be found at https://wiki.dfrobot.com/HUSKYLENS_V1.0_SKU_SEN0305_SEN0336#target_20. + * + * Note again that the device only recognizes the 36h11 family of tags out of the box. + */ + while(opModeIsActive()) { + if (!rateLimit.hasExpired()) { + continue; + } + rateLimit.reset(); + + /* + * All algorithms, except for LINE_TRACKING, return a list of Blocks where a + * Block represents the outline of a recognized object along with its ID number. + * ID numbers allow you to identify what the device saw. See the HuskyLens documentation + * referenced in the header comment above for more information on IDs and how to + * assign them to objects. + * + * Returns an empty array if no objects are seen. + */ + HuskyLens.Block[] blocks = huskyLens.blocks(); + telemetry.addData("Block count", blocks.length); + for (int i = 0; i < blocks.length; i++) { + telemetry.addData("Block", blocks[i].toString()); + } + + telemetry.update(); + } + } +} \ No newline at end of file diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUNonOrthogonal.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUNonOrthogonal.java index 78cdbab..eb1c7ca 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUNonOrthogonal.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUNonOrthogonal.java @@ -29,46 +29,44 @@ package org.firstinspires.ftc.robotcontroller.external.samples; -import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.xyzOrientation; - import com.qualcomm.hardware.rev.RevHubOrientationOnRobot; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.IMU; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles; -/** - * {@link SensorIMUNonOrthogonal} shows how to use the new universal {@link IMU} interface. This +import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.xyzOrientation; + +/* + * This OpMode shows how to use the new universal IMU interface. This * interface may be used with the BNO055 IMU or the BHI260 IMU. It assumes that an IMU is configured * on the robot with the name "imu". - *

    + * * The sample will display the current Yaw, Pitch and Roll of the robot.
    * With the correct orientation parameters selected, pitch/roll/yaw should act as follows: - *

    - * Pitch value should INCREASE as the robot is tipped UP at the front. (Rotation about X)
    - * Roll value should INCREASE as the robot is tipped UP at the left side. (Rotation about Y)
    - * Yaw value should INCREASE as the robot is rotated Counter Clockwise. (Rotation about Z)
    - *

    + * Pitch value should INCREASE as the robot is tipped UP at the front. (Rotation about X) + * Roll value should INCREASE as the robot is tipped UP at the left side. (Rotation about Y) + * Yaw value should INCREASE as the robot is rotated Counter Clockwise. (Rotation about Z) + * * The yaw can be reset (to zero) by pressing the Y button on the gamepad (Triangle on a PS4 controller) - *

    + * * This specific sample DOES NOT assume that the Hub is mounted on one of the three orthogonal * planes (X/Y, X/Z or Y/Z) OR that the Hub has only been rotated in a range of 90 degree increments. - *

    + * * Note: if your Hub is mounted Orthogonally (on a orthogonal surface, angled at some multiple of * 90 Degrees) then you should use the simpler SensorImuOrthogonal sample in this folder. - *

    + * * But... If your Hub is mounted Non-Orthogonally, you must specify one or more rotational angles * that transform a "Default" Hub orientation into your desired orientation. That is what is * illustrated here. - *

    + * * Use Android Studio 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. - *

    + * * Finally, edit this OpMode to use at least one angle around an axis to orient your Hub. */ @TeleOp(name = "Sensor: IMU Non-Orthogonal", group = "Sensor") diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUOrthogonal.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUOrthogonal.java index 151a3ef..d92ce3e 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUOrthogonal.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorIMUOrthogonal.java @@ -34,46 +34,44 @@ import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.IMU; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity; import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles; -/** - * {@link SensorIMUOrthogonal} shows how to use the new universal {@link IMU} interface. This +/* + * This OpMode shows how to use the new universal IMU interface. This * interface may be used with the BNO055 IMU or the BHI260 IMU. It assumes that an IMU is configured * on the robot with the name "imu". - *

    + * * The sample will display the current Yaw, Pitch and Roll of the robot.
    * With the correct orientation parameters selected, pitch/roll/yaw should act as follows: - *

    * Pitch value should INCREASE as the robot is tipped UP at the front. (Rotation about X)
    * Roll value should INCREASE as the robot is tipped UP at the left side. (Rotation about Y)
    * Yaw value should INCREASE as the robot is rotated Counter Clockwise. (Rotation about Z)
    - *

    + * * The yaw can be reset (to zero) by pressing the Y button on the gamepad (Triangle on a PS4 controller) - *

    + * * This specific sample assumes that the Hub is mounted on one of the three orthogonal planes * (X/Y, X/Z or Y/Z) and that the Hub has only been rotated in a range of 90 degree increments. - *

    + * * Note: if your Hub is mounted on a surface angled at some non-90 Degree multiple (like 30) look at * the alternative SensorImuNonOrthogonal sample in this folder. - *

    + * * This "Orthogonal" requirement means that: - *

    + * * 1) The Logo printed on the top of the Hub can ONLY be pointing in one of six directions: * FORWARD, BACKWARD, UP, DOWN, LEFT and RIGHT. - *

    + * * 2) The USB ports can only be pointing in one of the same six directions:
    * FORWARD, BACKWARD, UP, DOWN, LEFT and RIGHT. - *

    + * * So, To fully define how your Hub is mounted to the robot, you must simply specify:
    * logoFacingDirection
    * usbFacingDirection - *

    + * * Use Android Studio 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. - *

    + * * Finally, choose the two correct parameters to define how your Hub is mounted and edit this OpMode * to use those parameters. */ 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 583f525..ccc945f 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 @@ -36,7 +36,6 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.Gyroscope; import com.qualcomm.robotcore.hardware.IntegratingGyroscope; import com.qualcomm.robotcore.util.ElapsedTime; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; @@ -44,11 +43,11 @@ import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; /* - * This is an example LinearOpMode that shows how to use Kauai Labs navX Micro Robotics Navigation + * This OpMode shows how to use Kauai Labs navX Micro Robotics Navigation * Sensor. It assumes that the sensor is configured with a name of "navx". * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name = "Sensor: KL navX Micro", group = "Sensor") @Disabled 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 efba7d1..32b37e0 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 @@ -32,7 +32,6 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import android.app.Activity; import android.graphics.Color; import android.view.View; - import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; @@ -40,10 +39,10 @@ import com.qualcomm.robotcore.hardware.ColorSensor; /* * - * This is an example LinearOpMode that shows how to use + * This OpMode that shows how to use * a Modern Robotics Color Sensor. * - * The op mode assumes that the color sensor + * The OpMode assumes that the color sensor * is configured with a name of "sensor_color". * * You can use the X button on gamepad1 to toggle the LED on and off. @@ -88,7 +87,7 @@ public class SensorMRColor extends LinearOpMode { // wait for the start button to be pressed. waitForStart(); - // while the op mode is active, loop and read the RGB data. + // while the OpMode is active, loop and read the RGB data. // Note we use opModeIsActive() as our loop condition because it is an interruptible method. while (opModeIsActive()) { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRCompass.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRCompass.java deleted file mode 100644 index 583ac1a..0000000 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRCompass.java +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (c) 2017 FIRST. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted (subject to the limitations in the disclaimer below) provided that - * the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * Neither the name of FIRST nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS - * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.firstinspires.ftc.robotcontroller.external.samples; - -import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cCompassSensor; -import com.qualcomm.robotcore.eventloop.opmode.Disabled; -import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; -import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.hardware.CompassSensor; -import com.qualcomm.robotcore.util.ElapsedTime; - -import org.firstinspires.ftc.robotcore.external.navigation.Acceleration; - -/** - * The {@link SensorMRCompass} op mode provides a demonstration of the - * functionality provided by the Modern Robotics compass sensor. - * - * The op mode assumes that the MR compass is configured with a name of "compass". - * - * Use Android Studio 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 - * - * @see MR Compass Sensor - */ -@TeleOp(name = "Sensor: MR compass", group = "Sensor") -@Disabled // comment out or remove this line to enable this opmode -public class SensorMRCompass extends LinearOpMode { - - ModernRoboticsI2cCompassSensor compass; - ElapsedTime timer = new ElapsedTime(); - - @Override public void runOpMode() { - - // get a reference to our compass - compass = hardwareMap.get(ModernRoboticsI2cCompassSensor.class, "compass"); - - telemetry.log().setCapacity(20); - telemetry.log().add("The compass sensor operates quite well out-of-the"); - telemetry.log().add("box, as shipped by the manufacturer. Precision can"); - telemetry.log().add("however be somewhat improved with calibration."); - telemetry.log().add(""); - telemetry.log().add("To calibrate the compass once the opmode is"); - telemetry.log().add("started, make sure the compass is level, then"); - telemetry.log().add("press 'A' on the gamepad. Next, slowly rotate the "); - telemetry.log().add("compass in a full 360 degree circle while keeping"); - telemetry.log().add("it level. When complete, press 'B'."); - - // wait for the start button to be pressed - waitForStart(); - telemetry.log().clear(); - - while (opModeIsActive()) { - - // If the A button is pressed, start calibration and wait for the A button to rise - if (gamepad1.a && !compass.isCalibrating()) { - - telemetry.log().clear(); - telemetry.log().add("Calibration started"); - telemetry.log().add("Slowly rotate compass 360deg"); - telemetry.log().add("Press 'B' when complete"); - compass.setMode(CompassSensor.CompassMode.CALIBRATION_MODE); - timer.reset(); - - while (gamepad1.a && opModeIsActive()) { - doTelemetry(); - idle(); - } - } - - // If the B button is pressed, stop calibration and wait for the B button to rise - if (gamepad1.b && compass.isCalibrating()) { - - telemetry.log().clear(); - telemetry.log().add("Calibration complete"); - compass.setMode(CompassSensor.CompassMode.MEASUREMENT_MODE); - - if (compass.calibrationFailed()) { - telemetry.log().add("Calibration failed"); - compass.writeCommand(ModernRoboticsI2cCompassSensor.Command.NORMAL); - } - - while (gamepad1.a && opModeIsActive()) { - doTelemetry(); - idle(); - } - } - - doTelemetry(); - } - } - - protected void doTelemetry() { - - if (compass.isCalibrating()) { - - telemetry.addData("compass", "calibrating %s", Math.round(timer.seconds())%2==0 ? "|.." : "..|"); - - } else { - - // getDirection() returns a traditional compass heading in the range [0,360), - // with values increasing in a CW direction - telemetry.addData("heading", "%.1f", compass.getDirection()); - - // getAcceleration() returns the current 3D acceleration experienced by - // the sensor. This is used internally to the sensor to compute its tilt and thence - // to correct the magnetometer reading to produce tilt-corrected values in getDirection() - Acceleration accel = compass.getAcceleration(); - double accelMagnitude = Math.sqrt(accel.xAccel*accel.xAccel + accel.yAccel*accel.yAccel + accel.zAccel*accel.zAccel); - telemetry.addData("accel", accel); - telemetry.addData("accel magnitude", "%.3f", accelMagnitude); - - // getMagneticFlux returns the 3D magnetic field flux experienced by the sensor - telemetry.addData("mag flux", compass.getMagneticFlux()); - } - - // the command register provides status data - telemetry.addData("command", "%s", compass.readCommand()); - - telemetry.update(); - } -} 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 5425f0d..91c0062 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 @@ -33,19 +33,17 @@ import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cGyro; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.hardware.Gyroscope; import com.qualcomm.robotcore.hardware.IntegratingGyroscope; import com.qualcomm.robotcore.util.ElapsedTime; - import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; /* - * This is an example LinearOpMode that shows how to use the Modern Robotics Gyro. + * This OpMode shows how to use the Modern Robotics Gyro. * - * The op mode assumes that the gyro sensor is attached to a Device Interface Module + * The OpMode assumes that the gyro sensor is attached to a Device Interface Module * I2C channel and is configured with a name of "gyro". * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. @@ -55,7 +53,7 @@ import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; @Disabled public class SensorMRGyro extends LinearOpMode { - /** In this sample, for illustration purposes we use two interfaces on the one gyro object. + /* In this sample, for illustration purposes we use two interfaces on the one gyro object. * That's likely atypical: you'll probably use one or the other in any given situation, * depending on what you're trying to do. {@link IntegratingGyroscope} (and it's base interface, * {@link Gyroscope}) are common interfaces supported by possibly several different gyro diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRIrSeeker.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRIrSeeker.java deleted file mode 100644 index 9bd6452..0000000 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRIrSeeker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2017 FIRST. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted (subject to the limitations in the disclaimer below) provided that - * the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * Neither the name of FIRST nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS - * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.firstinspires.ftc.robotcontroller.external.samples; - -import com.qualcomm.robotcore.eventloop.opmode.Disabled; -import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; -import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.hardware.IrSeekerSensor; - -/* - * This is an example LinearOpMode that shows how to use - * the Modern Robotics ITR Seeker - * - * The op mode assumes that the IR Seeker - * is configured with a name of "sensor_ir". - * - * Set the switch on the Modern Robotics IR beacon to 1200 at 180.
    - * Turn on the IR beacon. - * Make sure the side of the beacon with the LED on is facing the robot.
    - * - * Use Android Studio 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 = "Sensor: MR IR Seeker", group = "Sensor") -@Disabled -public class SensorMRIrSeeker extends LinearOpMode { - - @Override - public void runOpMode() { - - IrSeekerSensor irSeeker; // Hardware Device Object - - // get a reference to our GyroSensor object. - irSeeker = hardwareMap.get(IrSeekerSensor.class, "sensor_ir"); - - // wait for the start button to be pressed. - waitForStart(); - - while (opModeIsActive()) { - - // Ensure we have a IR signal - if (irSeeker.signalDetected()) - { - // Display angle and strength - telemetry.addData("Angle", irSeeker.getAngle()); - telemetry.addData("Strength", irSeeker.getStrength()); - } - else - { - // Display loss of signal - telemetry.addData("Seeker", "Signal Lost"); - } - - telemetry.update(); - } - } -} diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMROpticalDistance.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMROpticalDistance.java index 8424ef7..6d2dfa3 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMROpticalDistance.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMROpticalDistance.java @@ -35,12 +35,11 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; /* - * This is an example LinearOpMode that shows how to use - * a Modern Robotics Optical Distance Sensor + * This OpMode shows how to use a Modern Robotics Optical Distance Sensor * It assumes that the ODS sensor is configured with a name of "sensor_ods". * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list */ @TeleOp(name = "Sensor: MR ODS", group = "Sensor") @Disabled @@ -57,7 +56,7 @@ public class SensorMROpticalDistance extends LinearOpMode { // wait for the start button to be pressed. waitForStart(); - // while the op mode is active, loop and read the light levels. + // while the OpMode is active, loop and read the light levels. // Note we use opModeIsActive() as our loop condition because it is an interruptible method. while (opModeIsActive()) { diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRRangeSensor.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRRangeSensor.java index d7de1ff..2039ef9 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRRangeSensor.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorMRRangeSensor.java @@ -33,22 +33,20 @@ import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cRangeSensor; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; - import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; -/** - * {@link SensorMRRangeSensor} illustrates how to use the Modern Robotics - * Range Sensor. +/* + * This OpMode illustrates how to use the Modern Robotics Range Sensor. * - * The op mode assumes that the range sensor is configured with a name of "sensor_range". + * The OpMode assumes that the range sensor is configured with a name of "sensor_range". * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list * * @see MR Range Sensor */ @TeleOp(name = "Sensor: MR range sensor", group = "Sensor") -@Disabled // comment out or remove this line to enable this opmode +@Disabled // comment out or remove this line to enable this OpMode public class SensorMRRangeSensor extends LinearOpMode { ModernRoboticsI2cRangeSensor rangeSensor; diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorREV2mDistance.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorREV2mDistance.java index 30bb377..13883c3 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorREV2mDistance.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorREV2mDistance.java @@ -33,38 +33,36 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.hardware.rev.Rev2mDistanceSensor; -import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DistanceSensor; - import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; -/** - * {@link SensorREV2mDistance} illustrates how to use the REV Robotics - * Time-of-Flight Range Sensor. +/* + * This OpMode illustrates how to use the REV Robotics 2M Distance Sensor. * - * The op mode assumes that the range sensor is configured with a name of "sensor_range". + * The OpMode assumes that the sensor is configured with a name of "sensor_distance". * * Use Android Studio 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 + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list * - * @see REV Robotics Web Page + * See the sensor's product page: https://www.revrobotics.com/rev-31-1505/ */ @TeleOp(name = "Sensor: REV2mDistance", group = "Sensor") @Disabled public class SensorREV2mDistance extends LinearOpMode { - private DistanceSensor sensorRange; + private DistanceSensor sensorDistance; @Override public void runOpMode() { // you can use this as a regular DistanceSensor. - sensorRange = hardwareMap.get(DistanceSensor.class, "sensor_range"); + sensorDistance = hardwareMap.get(DistanceSensor.class, "sensor_distance"); // you can also cast this to a Rev2mDistanceSensor if you want to use added // methods associated with the Rev2mDistanceSensor class. - Rev2mDistanceSensor sensorTimeOfFlight = (Rev2mDistanceSensor)sensorRange; + Rev2mDistanceSensor sensorTimeOfFlight = (Rev2mDistanceSensor) sensorDistance; telemetry.addData(">>", "Press start to continue"); telemetry.update(); @@ -72,11 +70,11 @@ public class SensorREV2mDistance extends LinearOpMode { waitForStart(); while(opModeIsActive()) { // generic DistanceSensor methods. - telemetry.addData("deviceName",sensorRange.getDeviceName() ); - telemetry.addData("range", String.format("%.01f mm", sensorRange.getDistance(DistanceUnit.MM))); - telemetry.addData("range", String.format("%.01f cm", sensorRange.getDistance(DistanceUnit.CM))); - telemetry.addData("range", String.format("%.01f m", sensorRange.getDistance(DistanceUnit.METER))); - telemetry.addData("range", String.format("%.01f in", sensorRange.getDistance(DistanceUnit.INCH))); + telemetry.addData("deviceName", sensorDistance.getDeviceName() ); + telemetry.addData("range", String.format("%.01f mm", sensorDistance.getDistance(DistanceUnit.MM))); + telemetry.addData("range", String.format("%.01f cm", sensorDistance.getDistance(DistanceUnit.CM))); + telemetry.addData("range", String.format("%.01f m", sensorDistance.getDistance(DistanceUnit.METER))); + telemetry.addData("range", String.format("%.01f in", sensorDistance.getDistance(DistanceUnit.INCH))); // Rev2mDistanceSensor specific methods. telemetry.addData("ID", String.format("%x", sensorTimeOfFlight.getModelID())); @@ -86,4 +84,4 @@ public class SensorREV2mDistance extends LinearOpMode { } } -} \ No newline at end of file +} diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorDigitalTouch.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorTouch.java similarity index 62% rename from FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorDigitalTouch.java rename to FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorTouch.java index b367924..3d79447 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorDigitalTouch.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/SensorTouch.java @@ -32,54 +32,44 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.qualcomm.robotcore.hardware.DigitalChannel; +import com.qualcomm.robotcore.hardware.TouchSensor; /* - * This is an example LinearOpMode that shows how to use - * a REV Robotics Touch Sensor. + * This OpMode demonstrates how to use a REV Robotics Touch Sensor, REV Robotics Magnetic Limit Switch, or other device + * that implements the TouchSensor interface. Any touch sensor that connects its output to ground when pressed + * (known as "active low") can be configured as a "REV Touch Sensor". This includes REV's Magnetic Limit Switch. * - * It assumes that the touch sensor is configured with a name of "sensor_digital". + * The OpMode assumes that the touch sensor is configured with a name of "sensor_touch". + * + * A REV Robotics Touch Sensor must be configured on digital port number 1, 3, 5, or 7. + * A Magnetic Limit Switch can be configured on any digital port. * * Use Android Studio 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. + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list. */ -@TeleOp(name = "Sensor: Digital touch", group = "Sensor") +@TeleOp(name = "Sensor: REV touch sensor", group = "Sensor") @Disabled -public class SensorDigitalTouch extends LinearOpMode { - /** - * The REV Robotics Touch Sensor - * is treated as a digital channel. It is HIGH if the button is unpressed. - * It pulls LOW if the button is pressed. - * - * Also, when you connect a REV Robotics Touch Sensor to the digital I/O port on the - * Expansion Hub using a 4-wire JST cable, the second pin gets connected to the Touch Sensor. - * The lower (first) pin stays unconnected.* - */ - - DigitalChannel digitalTouch; // Hardware Device Object +public class SensorTouch extends LinearOpMode { + TouchSensor touchSensor; // Touch sensor Object @Override public void runOpMode() { - // get a reference to our digitalTouch object. - digitalTouch = hardwareMap.get(DigitalChannel.class, "sensor_digital"); - - // set the digital channel to input. - digitalTouch.setMode(DigitalChannel.Mode.INPUT); + // get a reference to our touchSensor object. + touchSensor = hardwareMap.get(TouchSensor.class, "sensor_touch"); // wait for the start button to be pressed. waitForStart(); - // while the op mode is active, loop and read the light levels. + // while the OpMode is active, loop and read whether the sensor is being pressed. // Note we use opModeIsActive() as our loop condition because it is an interruptible method. while (opModeIsActive()) { // send the info back to driver station using telemetry function. - // if the digital channel returns true it's HIGH and the button is unpressed. - if (digitalTouch.getState() == true) { - telemetry.addData("Digital Touch", "Is Not Pressed"); + if (touchSensor.isPressed()) { + telemetry.addData("Touch Sensor", "Is Pressed"); } else { - telemetry.addData("Digital Touch", "Is Pressed"); + telemetry.addData("Touch Sensor", "Is Not Pressed"); } telemetry.update(); diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/UtilityCameraFrameCapture.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/UtilityCameraFrameCapture.java index a7a99f5..69420cc 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/UtilityCameraFrameCapture.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/UtilityCameraFrameCapture.java @@ -34,19 +34,17 @@ package org.firstinspires.ftc.robotcontroller.external.samples; import android.util.Size; - import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; - import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.vision.VisionPortal; import java.util.Locale; -/** - * This Utility OpMode helps calibrate a webcam or RC phone camera, useful for AprilTag pose estimation +/* + * This OpMode helps calibrate a webcam or RC phone camera, useful for AprilTag pose estimation * with the FTC VisionPortal. It captures a camera frame (image) and stores it on the Robot Controller * (Control Hub or RC phone), with each press of the gamepad button X (or Square). * Full calibration instructions are here: @@ -54,9 +52,9 @@ import java.util.Locale; * https://ftc-docs.firstinspires.org/camera-calibration * * In Android Studio, copy this class into your "teamcode" folder with a new name. - * Remove or comment out the @Disabled line to add this file to the Driver Station OpMode list. + * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list. * - * In OnBot Java, use "Add File" to add this file from the list of Samples. + * In OnBot Java, use "Add File" to add this OpMode from the list of Samples. */ @TeleOp(name = "Utility: Camera Frame Capture", group = "Utility") diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcOpModeRegister.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcOpModeRegister.java index 9a94f54..8c6ea59 100644 --- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcOpModeRegister.java +++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcOpModeRegister.java @@ -37,7 +37,7 @@ import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister; import org.firstinspires.ftc.robotcontroller.external.samples.ConceptNullOp; /** - * {@link FtcOpModeRegister} is responsible for registering opmodes for use in an FTC game. + * {@link FtcOpModeRegister} is responsible for registering OpModes for use in an FTC game. * @see #register(OpModeManager) */ public class FtcOpModeRegister implements OpModeRegister { diff --git a/build.common.gradle b/build.common.gradle index 1eee6fd..12e6acb 100644 --- a/build.common.gradle +++ b/build.common.gradle @@ -87,7 +87,6 @@ android { versionName vName } - // Advanced user code might just want to use Vuforia directly, so we set up the libs as needed // http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html buildTypes { release { diff --git a/build.dependencies.gradle b/build.dependencies.gradle index 82e0708..9775838 100644 --- a/build.dependencies.gradle +++ b/build.dependencies.gradle @@ -4,18 +4,18 @@ repositories { } dependencies { - implementation 'org.firstinspires.ftc:Inspection:8.2.0' - implementation 'org.firstinspires.ftc:Blocks:8.2.0' - implementation 'org.firstinspires.ftc:Tfod:8.2.0' - implementation 'org.firstinspires.ftc:RobotCore:8.2.0' - implementation 'org.firstinspires.ftc:RobotServer:8.2.0' - implementation 'org.firstinspires.ftc:OnBotJava:8.2.0' - implementation 'org.firstinspires.ftc:Hardware:8.2.0' - implementation 'org.firstinspires.ftc:FtcCommon:8.2.0' + implementation 'org.firstinspires.ftc:Inspection:9.0.0' + implementation 'org.firstinspires.ftc:Blocks:9.0.0' + implementation 'org.firstinspires.ftc:Tfod:9.0.0' + implementation 'org.firstinspires.ftc:RobotCore:9.0.0' + implementation 'org.firstinspires.ftc:RobotServer:9.0.0' + implementation 'org.firstinspires.ftc:OnBotJava:9.0.0' + implementation 'org.firstinspires.ftc:Hardware:9.0.0' + implementation 'org.firstinspires.ftc:FtcCommon:9.0.0' + implementation 'org.firstinspires.ftc:Vision:9.0.0' + implementation 'org.firstinspires.ftc:gameAssets-CenterStage:1.0.0' implementation 'org.tensorflow:tensorflow-lite-task-vision:0.4.3' runtimeOnly 'org.tensorflow:tensorflow-lite:2.12.0' implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'org.firstinspires.ftc:gameAssets-PowerPlay:1.0.0' - implementation 'org.firstinspires.ftc:Vision:8.2.0' } diff --git a/doc/media/chips.jpg b/doc/media/chips.jpg deleted file mode 100644 index 95005b9..0000000 Binary files a/doc/media/chips.jpg and /dev/null differ diff --git a/doc/media/stones.jpg b/doc/media/stones.jpg deleted file mode 100644 index 0eeb19f..0000000 Binary files a/doc/media/stones.jpg and /dev/null differ diff --git a/doc/media/target_chips_A4.pdf b/doc/media/target_chips_A4.pdf deleted file mode 100644 index 7dfbaf9..0000000 Binary files a/doc/media/target_chips_A4.pdf and /dev/null differ diff --git a/doc/media/target_chips_USLetter.pdf b/doc/media/target_chips_USLetter.pdf deleted file mode 100644 index 281895b..0000000 Binary files a/doc/media/target_chips_USLetter.pdf and /dev/null differ diff --git a/doc/media/target_stones_A4.pdf b/doc/media/target_stones_A4.pdf deleted file mode 100644 index 200415b..0000000 Binary files a/doc/media/target_stones_A4.pdf and /dev/null differ diff --git a/doc/media/target_stones_USLetter.pdf b/doc/media/target_stones_USLetter.pdf deleted file mode 100644 index 599d335..0000000 Binary files a/doc/media/target_stones_USLetter.pdf and /dev/null differ diff --git a/libs/Vuforia.jar b/libs/Vuforia.jar deleted file mode 100644 index 43bf627..0000000 Binary files a/libs/Vuforia.jar and /dev/null differ diff --git a/libs/arm64-v8a/libVuforia.so b/libs/arm64-v8a/libVuforia.so deleted file mode 100644 index db2facf..0000000 Binary files a/libs/arm64-v8a/libVuforia.so and /dev/null differ diff --git a/libs/armeabi-v7a/libVuforia.so b/libs/armeabi-v7a/libVuforia.so deleted file mode 100644 index b8ef4f7..0000000 Binary files a/libs/armeabi-v7a/libVuforia.so and /dev/null differ