Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FtcRobotController/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="61"
android:versionName="11.1">
android:versionCode="62"
android:versionName="11.2">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


/*
* This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
* This file contains a 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
* class is instantiated on the Robot Controller and executed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
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.CameraCompatibilityManager;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.robotcore.internal.usb.UsbConstants;
import org.firstinspires.ftc.vision.VisionPortal;
import org.firstinspires.ftc.vision.apriltag.AprilTagDetection;
import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor;
Expand Down Expand Up @@ -81,9 +83,33 @@ public class ConceptAprilTag extends LinearOpMode {
*/
private VisionPortal visionPortal;

// To find the VID/PID for a camera:
//
// Linux: open a terminal, run "lsusb", locate the line for your camera,
// and find the section that resembles "ID 1d6b:0002"; this is VID:PID
//
// OSX: open a terminal, run "system_profiler SPUSBDataType", locate the
// section for your camera, and find the "Product ID:" and "Vendor ID:"
// listings in the output
//
// Windows: open a PowerShell, run:
// Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -like 'USB*' } | Select-Object FriendlyName, InstanceId
// and locate the line for your camera. The VID and PID is listed directly in the line.
static final int VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY = 0x1BCF;
static final int PRODUCT_ID_ARDUCAM_OV5648 = 0x284C;

@Override
public void runOpMode() {

// Demonstrate how to add a camera compatibility quirk
// these can sometimes be needed if a camera behaves poorly.
// Quirks have no effect unless the camera you are using matches the specified VID/PID
CameraCompatibilityManager.getInstance()
.addQuirk(
VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY,
PRODUCT_ID_ARDUCAM_OV5648,
CameraCompatibilityManager.Quirk.AVOID_LIB_USB_RESET_DEVICE);

initAprilTag();

// Wait for the DS start button to be touched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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.CameraCompatibilityManager;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.vision.VisionPortal;
import org.firstinspires.ftc.vision.apriltag.AprilTagDetection;
Expand Down Expand Up @@ -77,9 +78,33 @@ public class ConceptAprilTagEasy extends LinearOpMode {
*/
private VisionPortal visionPortal;

// To find the VID/PID for a camera:
//
// Linux: open a terminal, run "lsusb", locate the line for your camera,
// and find the section that resembles "ID 1d6b:0002"; this is VID:PID
//
// OSX: open a terminal, run "system_profiler SPUSBDataType", locate the
// section for your camera, and find the "Product ID:" and "Vendor ID:"
// listings in the output
//
// Windows: open a PowerShell, run:
// Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -like 'USB*' } | Select-Object FriendlyName, InstanceId
// and locate the line for your camera. The VID and PID is listed directly in the line.
static final int VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY = 0x1BCF;
static final int PRODUCT_ID_ARDUCAM_OV5648 = 0x284C;

@Override
public void runOpMode() {

// Demonstrate how to add a camera compatibility quirk
// these can sometimes be needed if a camera behaves poorly.
// Quirks have no effect unless the camera you are using matches the specified VID/PID
CameraCompatibilityManager.getInstance()
.addQuirk(
VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY,
PRODUCT_ID_ARDUCAM_OV5648,
CameraCompatibilityManager.Quirk.AVOID_LIB_USB_RESET_DEVICE);

initAprilTag();

// Wait for the DS start button to be touched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import org.firstinspires.ftc.robotcore.external.hardware.camera.BuiltinCameraDirection;
import org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCompatibilityManager;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
Expand Down Expand Up @@ -109,9 +110,33 @@ public class ConceptAprilTagLocalization extends LinearOpMode {
*/
private VisionPortal visionPortal;

// To find the VID/PID for a camera:
//
// Linux: open a terminal, run "lsusb", locate the line for your camera,
// and find the section that resembles "ID 1d6b:0002"; this is VID:PID
//
// OSX: open a terminal, run "system_profiler SPUSBDataType", locate the
// section for your camera, and find the "Product ID:" and "Vendor ID:"
// listings in the output
//
// Windows: open a PowerShell, run:
// Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -like 'USB*' } | Select-Object FriendlyName, InstanceId
// and locate the line for your camera. The VID and PID is listed directly in the line.
static final int VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY = 0x1BCF;
static final int PRODUCT_ID_ARDUCAM_OV5648 = 0x284C;

@Override
public void runOpMode() {

// Demonstrate how to add a camera compatibility quirk
// these can sometimes be needed if a camera behaves poorly.
// Quirks have no effect unless the camera you are using matches the specified VID/PID
CameraCompatibilityManager.getInstance()
.addQuirk(
VENDOR_ID_SUNPLUS_INNOVATION_TECHNOLOGY,
PRODUCT_ID_ARDUCAM_OV5648,
CameraCompatibilityManager.Quirk.AVOID_LIB_USB_RESET_DEVICE);

initAprilTag();

// Wait for the DS start button to be touched.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package org.firstinspires.ftc.robotcontroller.external.utilities;
/*
Copyright (c) 2026 Porpoiseful, LLC
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 Alan Smith 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.
*/

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.Utility;
import com.qualcomm.robotcore.hardware.Gamepad;

/*
* This OpMode helps test the gamepads so you can make sure they are functional.
*
*/
@Utility(name = "Test Gamepad", description = "Test gamepads on your driver station")
@SuppressWarnings("unused")
public class UtilityTestGamepad extends OpMode {

public static final String SEPARATOR = " • ";

@Override
public void init(){
telemetry.addData("Instructions", "Setup your gamepads and then press the play button");
}

@Override
public void loop() {
display_gamepad(gamepad1, "Gamepad 1");
display_gamepad(gamepad2, "Gamepad 2");
}

void display_gamepad(Gamepad gamepad, String name) {
telemetry.addLine("---" + name + "---");
telemetry.addData("Left Joystick", "(% 1.2f, %1.2f)", gamepad.left_stick_x, gamepad.left_stick_y);
telemetry.addData("Left Trigger", "% 1.2f", gamepad.left_trigger);
telemetry.addData("Right Joystick", "(% 1.2f, %1.2f)", gamepad.right_stick_x, gamepad.right_stick_y);
telemetry.addData("Right Trigger", "% 1.2f", gamepad.right_trigger);

switch(gamepad.type()){
case SONY_PS4:
case SONY_PS4_SUPPORTED_BY_KERNEL:

if (gamepad.touchpad_finger_1) {
telemetry.addData("Touchpad Finger1", "(% 1.2f, %1.2f)", gamepad.touchpad_finger_1_x, gamepad.touchpad_finger_1_y);
} else {
telemetry.addData("Touchpad Finger1", false);
}

if (gamepad.touchpad_finger_2) {
telemetry.addData("Touchpad Finger2", "(% 1.2f, %1.2f)", gamepad.touchpad_finger_2_x, gamepad.touchpad_finger_2_y);
} else {
telemetry.addData("Touchpad Finger2", false);
}

telemetry.addData("Buttons", ps_buttons_to_string(gamepad));
break;
case LOGITECH_F310:
case XBOX_360:
case UNKNOWN:
default:
telemetry.addData("Buttons", xbox_buttons_to_string(gamepad));
break;
}
}

/*
This returns a string based off of the buttons pressed, with the xbox names for buttons
*/
String xbox_buttons_to_string(Gamepad gamepad){
String buttons = generic_buttons_to_string(gamepad);
if (gamepad.back) buttons += "back" + SEPARATOR;
if (gamepad.start) buttons += "start" + SEPARATOR;
if (gamepad.guide) buttons += "guide" + SEPARATOR;
if (gamepad.a) buttons += "a" + SEPARATOR;
if (gamepad.b) buttons += "b" + SEPARATOR;
if (gamepad.x) buttons += "x" + SEPARATOR;
if (gamepad.y) buttons += "y" + SEPARATOR;

return buttons;
}

/*
This returns a string based off of the buttons pressed, with the ps names for buttons
*/
String ps_buttons_to_string(Gamepad gamepad){
String buttons = generic_buttons_to_string(gamepad);
if (gamepad.cross) buttons += "cross" + SEPARATOR;
if (gamepad.circle) buttons += "circle" + SEPARATOR;
if (gamepad.square) buttons += "square" + SEPARATOR;
if (gamepad.triangle) buttons += "triangle" + SEPARATOR;
if (gamepad.ps) buttons += "ps" + SEPARATOR;
if (gamepad.share) buttons += "share" + SEPARATOR;
if (gamepad.options) buttons += "options" + SEPARATOR;
if (gamepad.touchpad) buttons += "touchpad" + SEPARATOR;

return buttons;
}

/*
This returns the buttons pressed for those that are the same on both types of gamepads
*/
String generic_buttons_to_string(Gamepad gamepad){
String buttons = "";
if (gamepad.dpad_up) buttons += "dpad_up" + SEPARATOR;
if (gamepad.dpad_down) buttons += "dpad_down" + SEPARATOR;
if (gamepad.dpad_left) buttons += "dpad_left" + SEPARATOR;
if (gamepad.dpad_right) buttons += "dpad_right" + SEPARATOR;
if (gamepad.left_bumper) buttons += "left_bumper" + SEPARATOR;
if (gamepad.right_bumper) buttons += "right_bumper" + SEPARATOR;
if (gamepad.left_stick_button) buttons += "left stick button" + SEPARATOR;
if (gamepad.right_stick_button) buttons += "right stick button" + SEPARATOR;
return buttons;
}

}
Loading
Loading