diff --git a/.gitignore b/.gitignore
index 674138c..7d82b7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,5 +85,3 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
-
-VuForiaKey.java
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index f92b736..e94f1ce 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -26,5 +26,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/build.gradle b/FtcRobotController/build.gradle
index 3783d54..9abf380 100644
--- a/FtcRobotController/build.gradle
+++ b/FtcRobotController/build.gradle
@@ -33,4 +33,4 @@ repositories {
}
}
-apply from: 'build.release.gradle'
+apply from: '../build.dependencies.gradle'
diff --git a/FtcRobotController/build.release.gradle b/FtcRobotController/build.release.gradle
deleted file mode 100644
index 93442a3..0000000
--- a/FtcRobotController/build.release.gradle
+++ /dev/null
@@ -1,12 +0,0 @@
-dependencies {
- implementation 'org.firstinspires.ftc:Inspection:6.1.1'
- implementation 'org.firstinspires.ftc:Blocks:6.1.1'
- implementation 'org.firstinspires.ftc:RobotCore:6.1.1'
- implementation 'org.firstinspires.ftc:RobotServer:6.1.1'
- implementation 'org.firstinspires.ftc:OnBotJava:6.1.1'
- implementation 'org.firstinspires.ftc:Hardware:6.1.1'
- implementation 'org.firstinspires.ftc:FtcCommon:6.1.1'
- implementation 'androidx.appcompat:appcompat:1.2.0'
-
- implementation 'com.acmerobotics.dashboard:dashboard:0.4.0'
-}
diff --git a/FtcRobotController/src/main/AndroidManifest.xml b/FtcRobotController/src/main/AndroidManifest.xml
index cb1e8d2..10e9f96 100644
--- a/FtcRobotController/src/main/AndroidManifest.xml
+++ b/FtcRobotController/src/main/AndroidManifest.xml
@@ -2,8 +2,8 @@
+ android:versionCode="40"
+ android:versionName="6.2">
diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaUltimateGoalNavigationWebcam.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaUltimateGoalNavigationWebcam.java
index 8021ba9..3497b8b 100644
--- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaUltimateGoalNavigationWebcam.java
+++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaUltimateGoalNavigationWebcam.java
@@ -48,9 +48,8 @@
import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES;
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ;
-import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX;
+import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XZY;
import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC;
-import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK;
/**
* This 2020-2021 OpMode illustrates the basics of using the Vuforia localizer to determine
@@ -89,10 +88,6 @@
@Disabled
public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
- // IMPORTANT: If you are using a USB WebCam, you must select CAMERA_CHOICE = BACK; and PHONE_IS_PORTRAIT = false;
- private static final VuforiaLocalizer.CameraDirection CAMERA_CHOICE = BACK;
- private static final boolean PHONE_IS_PORTRAIT = false ;
-
/*
* IMPORTANT: You need to obtain your own license key to use Vuforia. The string below with which
* 'parameters.vuforiaLicenseKey' is initialized is for illustration only, and will not function.
@@ -140,8 +135,9 @@ public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
- * We can pass Vuforia the handle to a camera preview resource (on the RC phone);
+ * We can pass Vuforia the handle to a camera preview resource (on the RC screen);
* If no camera monitor is desired, use the parameter-less constructor instead (commented out below).
+ * Note: A preview window is required if you want to view the camera stream on the Driver Station Phone.
*/
int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
@@ -207,12 +203,12 @@ public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
frontWallTarget.setLocation(OpenGLMatrix
.translation(-halfField, 0, mmTargetHeight)
- .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , 90)));
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 90)));
// The tower goal targets are located a quarter field length from the ends of the back perimeter wall.
blueTowerGoalTarget.setLocation(OpenGLMatrix
.translation(halfField, quadField, mmTargetHeight)
- .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , -90)));
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
redTowerGoalTarget.setLocation(OpenGLMatrix
.translation(halfField, -quadField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
@@ -220,42 +216,33 @@ public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
//
// Create a transformation matrix describing where the phone is on the robot.
//
- // NOTE !!!! It's very important that you turn OFF your phone's Auto-Screen-Rotation option.
- // Lock it into Portrait for these numbers to work.
- //
// Info: The coordinate frame for the robot looks the same as the field.
// The robot's "forward" direction is facing out along X axis, with the LEFT side facing out along the Y axis.
// Z is UP on the robot. This equates to a bearing angle of Zero degrees.
//
- // The phone starts out lying flat, with the screen facing Up and with the physical top of the phone
- // pointing to the LEFT side of the Robot.
- // The two examples below assume that the camera is facing forward out the front of the robot.
-
- // We need to rotate the camera around it's long axis to bring the correct camera forward.
- if (CAMERA_CHOICE == BACK) {
- phoneYRotate = -90;
- } else {
- phoneYRotate = 90;
- }
-
- // Rotate the phone vertical about the X axis if it's in portrait mode
- if (PHONE_IS_PORTRAIT) {
- phoneXRotate = 90 ;
- }
+ // For a WebCam, the default starting orientation of the camera is looking UP (pointing in the Z direction),
+ // with the wide (horizontal) axis of the camera aligned with the X axis, and
+ // the Narrow (vertical) axis of the camera aligned with the Y axis
+ //
+ // But, this example assumes that the camera is actually facing forward out the front of the robot.
+ // So, the "default" camera position requires two rotations to get it oriented correctly.
+ // 1) First it must be rotated +90 degrees around the X axis to get it horizontal (it's now facing out the right side of the robot)
+ // 2) Next it must be be rotated +90 degrees (counter-clockwise) around the Z axis to face forward.
+ //
+ // Finally the camera can be translated to its actual mounting position on the robot.
+ // In this example, it is centered (left to right), but 4" forward of the middle of the robot, and 8" above ground level.
- // Next, translate the camera lens to where it is on the robot.
- // In this example, it is centered (left to right), but forward of the middle of the robot, and above ground level.
final float CAMERA_FORWARD_DISPLACEMENT = 4.0f * mmPerInch; // eg: Camera is 4 Inches in front of robot-center
final float CAMERA_VERTICAL_DISPLACEMENT = 8.0f * mmPerInch; // eg: Camera is 8 Inches above ground
final float CAMERA_LEFT_DISPLACEMENT = 0; // eg: Camera is ON the robot's center line
- OpenGLMatrix robotFromCamera = OpenGLMatrix
+ OpenGLMatrix cameraLocationOnRobot = OpenGLMatrix
.translation(CAMERA_FORWARD_DISPLACEMENT, CAMERA_LEFT_DISPLACEMENT, CAMERA_VERTICAL_DISPLACEMENT)
- .multiplied(Orientation.getRotationMatrix(EXTRINSIC, YZX, DEGREES, phoneYRotate, phoneZRotate, phoneXRotate));
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XZY, DEGREES, 90, 90, 0));
/** Let all the trackable listeners know where the phone is. */
for (VuforiaTrackable trackable : allTrackables) {
- ((VuforiaTrackableDefaultListener) trackable.getListener()).setPhoneInformation(robotFromCamera, parameters.cameraDirection);
+ ((VuforiaTrackableDefaultListener) trackable.getListener()).setCameraLocationOnRobot(parameters.cameraName, cameraLocationOnRobot);
}
// WARNING:
diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/readme.md b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/readme.md
index 5b66c4f..1808cd3 100644
--- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/readme.md
+++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/readme.md
@@ -2,9 +2,12 @@
## Caution
No Team-specific code should be placed or modified in this ``.../samples`` folder.
-Full or partial Samples should be Copied from here, and then Pasted into
-the team's folder, using the Android Studio cut and paste commands.
-This automatically changes all file and class names to be consistent.
+Samples should be Copied from here, and then Pasted into the team's
+[/TeamCode/src/main/java/org/firstinspires/ftc/teamcode](../../../../../../../../../../TeamCode/src/main/java/org/firstinspires/ftc/teamcode)
+ folder, using the Android Studio cut and paste commands. This automatically changes all file and
+class names to be consistent. From there, the sample can be modified to suit the team's needs.
+
+For more detailed instructions see the /teamcode readme.
### Naming of Samples
diff --git a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java
index 18c4712..6c8e534 100644
--- a/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java
+++ b/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java
@@ -382,6 +382,10 @@ public boolean onMenuItemClick(MenuItem item) {
}
FtcAboutActivity.setBuildTimeFromBuildConfig(BuildConfig.BUILD_TIME);
+
+ // check to see if there is a preferred Wi-Fi to use.
+ checkPreferredChannel();
+
FtcDashboard.start();
}
@@ -404,17 +408,6 @@ protected void onStart() {
super.onStart();
RobotLog.vv(TAG, "onStart()");
- // If we're start()ing after a stop(), then shut the old robot down so
- // we can refresh it with new state (e.g., with new hw configurations)
- shutdownRobot();
-
- updateUIAndRequestRobotSetup();
-
- cfgFileMgr.getActiveConfigAndUpdateUI();
-
- // check to see if there is a preferred Wi-Fi to use.
- checkPreferredChannel();
-
entireScreenLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -662,7 +655,9 @@ protected void onActivityResult(int request, int result, Intent intent) {
// was some historical confusion about launch codes here, so we err safely
if (request == RequestCode.CONFIGURE_ROBOT_CONTROLLER.ordinal() || request == RequestCode.SETTINGS_ROBOT_CONTROLLER.ordinal()) {
// We always do a refresh, whether it was a cancel or an OK, for robustness
+ shutdownRobot();
cfgFileMgr.getActiveConfigAndUpdateUI();
+ updateUIAndRequestRobotSetup();
}
}
diff --git a/TeamCode/build.gradle b/TeamCode/build.gradle
index 77f5a87..3e38db9 100644
--- a/TeamCode/build.gradle
+++ b/TeamCode/build.gradle
@@ -13,6 +13,7 @@
// Include common definitions from above.
apply from: '../build.common.gradle'
+apply from: '../build.dependencies.gradle'
repositories {
google()
@@ -23,6 +24,8 @@ dependencies {
annotationProcessor files('lib/OpModeAnnotationProcessor.jar')
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
+ implementation 'com.acmerobotics.roadrunner:core:0.5.3'
+ implementation 'org.apache.commons:commons-math3:3.6.1'
}
buildscript {
@@ -40,4 +43,4 @@ buildscript {
android {
defaultConfig {
}
-}
\ No newline at end of file
+}
diff --git a/TeamCode/build.release.gradle b/TeamCode/build.release.gradle
deleted file mode 100644
index da21288..0000000
--- a/TeamCode/build.release.gradle
+++ /dev/null
@@ -1,11 +0,0 @@
-dependencies {
- implementation project(':FtcRobotController')
- implementation 'org.firstinspires.ftc:RobotCore:6.1.1'
- implementation 'org.firstinspires.ftc:Hardware:6.1.1'
- implementation 'org.firstinspires.ftc:FtcCommon:6.1.1'
- implementation (name: 'tfod-release', ext:'aar')
- implementation (name: 'tensorflow-lite-0.0.0-nightly', ext:'aar')
- implementation 'com.acmerobotics.roadrunner:core:0.5.3'
- implementation 'com.acmerobotics.dashboard:dashboard:0.4.0'
- implementation 'org.apache.commons:commons-math3:3.6.1'
-}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/API/Sensor.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/API/Sensor.java
index 58e3ce0..8cb602a 100644
--- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/API/Sensor.java
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/API/Sensor.java
@@ -325,7 +325,8 @@ public static void initVuforia(String webcamName) {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
*/
- VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(R.id.cameraMonitorViewId);
+ int cameraMonitorViewId = Robot.linearOpMode.hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", Robot.linearOpMode.hardwareMap.appContext.getPackageName());
+ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraName = Robot.sensor.getWebcam(webcamName);
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/ConceptTensorFlowObjectDetectionWebcam.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/ConceptTensorFlowObjectDetectionWebcam.java
index 538bbf9..1d476e6 100644
--- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/ConceptTensorFlowObjectDetectionWebcam.java
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/ConceptTensorFlowObjectDetectionWebcam.java
@@ -153,7 +153,8 @@ private void initVuforia() {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
*/
- VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(R.id.cameraMonitorViewId);
+ int cameraMonitorViewId = Robot.linearOpMode.hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", Robot.linearOpMode.hardwareMap.appContext.getPackageName());
+ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraName = Robot.sensor.getWebcam(Naming.WEBCAM_0);
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/VuforiaStreamOpMode.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/VuforiaStreamOpMode.java
index 92d1b79..a5424a2 100644
--- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/VuforiaStreamOpMode.java
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpMode/TeleOp/VuforiaStreamOpMode.java
@@ -30,7 +30,9 @@ public void runOpMode() throws InterruptedException {
// gives Vuforia more time to exit before the watchdog notices
msStuckDetectStop = 2500;
- VuforiaLocalizer.Parameters vuforiaParams = new VuforiaLocalizer.Parameters(R.id.cameraMonitorViewId);
+ int cameraMonitorViewId = Robot.linearOpMode.hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", Robot.linearOpMode.hardwareMap.appContext.getPackageName());
+ VuforiaLocalizer.Parameters vuforiaParams = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
+
vuforiaParams.cameraName = Robot.sensor.getWebcam(Naming.WEBCAM_0);
vuforiaParams.vuforiaLicenseKey = VUFORIA_LICENSE_KEY;
vuforiaParams.cameraDirection = VuforiaLocalizer.CameraDirection.BACK;
diff --git a/build.common.gradle b/build.common.gradle
index 07c4be1..dca0efc 100644
--- a/build.common.gradle
+++ b/build.common.gradle
@@ -24,6 +24,21 @@ android {
compileSdkVersion 29
signingConfigs {
+ release {
+ def apkStoreFile = System.getenv("APK_SIGNING_STORE_FILE")
+ if (apkStoreFile != null) {
+ keyAlias System.getenv("APK_SIGNING_KEY_ALIAS")
+ keyPassword System.getenv("APK_SIGNING_KEY_PASSWORD")
+ storeFile file(System.getenv("APK_SIGNING_STORE_FILE"))
+ storePassword System.getenv("APK_SIGNING_STORE_PASSWORD")
+ } else {
+ keyAlias 'androiddebugkey'
+ keyPassword 'android'
+ storeFile rootProject.file('libs/ftc.debug.keystore')
+ storePassword 'android'
+ }
+ }
+
debug {
keyAlias 'androiddebugkey'
keyPassword 'android'
@@ -82,8 +97,8 @@ android {
// http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html
buildTypes {
release {
- // Disable debugging for release versions so it can be uploaded to Google Play.
- //debuggable true
+ signingConfig signingConfigs.release
+
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
@@ -114,5 +129,3 @@ repositories {
dirs rootProject.file('libs')
}
}
-apply from: 'build.release.gradle'
-apply plugin: 'kotlin-android'
diff --git a/build.dependencies.gradle b/build.dependencies.gradle
new file mode 100644
index 0000000..c93fa8c
--- /dev/null
+++ b/build.dependencies.gradle
@@ -0,0 +1,25 @@
+
+repositories {
+ mavenCentral()
+ google() // Needed for androidx
+ jcenter() // Needed for tensorflow-lite
+ flatDir {
+ dirs rootProject.file('libs')
+ }
+ maven { url = 'https://maven.brott.dev/' }
+}
+
+dependencies {
+ implementation 'org.firstinspires.ftc:Inspection:6.2.1'
+ implementation 'org.firstinspires.ftc:Blocks:6.2.1'
+ implementation 'org.firstinspires.ftc:RobotCore:6.2.1'
+ implementation 'org.firstinspires.ftc:RobotServer:6.2.1'
+ implementation 'org.firstinspires.ftc:OnBotJava:6.2.1'
+ implementation 'org.firstinspires.ftc:Hardware:6.2.1'
+ implementation 'org.firstinspires.ftc:FtcCommon:6.2.1'
+ implementation 'org.firstinspires.ftc:tfod:1.0.2'
+ implementation 'org.tensorflow:tensorflow-lite:1.10.0'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'com.acmerobotics.dashboard:dashboard:0.4.1'
+}
+
diff --git a/build.gradle b/build.gradle
index 0edbab7..fb6975d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,8 +3,14 @@
*
* It is extraordinarily rare that you will ever need to edit this file.
*/
+
+configurations {
+ doc { transitive false }
+}
+
buildscript {
repositories {
+ mavenCentral()
google()
jcenter()
}
@@ -17,7 +23,47 @@ buildscript {
// google() repository beginning with version 3.2 of the Android Gradle Plugin
allprojects {
repositories {
+ mavenCentral()
google()
jcenter()
}
}
+
+repositories {
+ mavenCentral()
+
+ flatDir {
+ dirs '../libs'
+ }
+}
+
+dependencies {
+ doc 'org.firstinspires.ftc:Hardware:6.2.0'
+ doc 'org.firstinspires.ftc:RobotCore:6.2.0'
+ doc 'org.firstinspires.ftc:FtcCommon:6.2.0'
+ doc 'org.firstinspires.ftc:OnBotJava:6.2.0'
+ doc 'org.firstinspires.ftc:Inspection:6.2.0'
+}
+
+task extractJavadoc {
+ doLast {
+ def componentIds = configurations.doc.incoming.resolutionResult.allDependencies.collect { it.selected.id }
+
+ def result = dependencies.createArtifactResolutionQuery()
+ .forComponents(componentIds)
+ .withArtifacts(JvmLibrary, SourcesArtifact, JavadocArtifact)
+ .execute()
+
+ for (component in result.resolvedComponents) {
+ component.getArtifacts(JavadocArtifact).each { artifact ->
+ def version = artifact.identifier.componentIdentifier.version
+ def libName = artifact.identifier.componentIdentifier.moduleIdentifier.name
+ copy {
+ from zipTree(artifact.file)
+ into "docs/$version/$libName/"
+ }
+ }
+ }
+ }
+}
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2a1e74b..183f49c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
\ No newline at end of file