Skip to content

Commit cd037e0

Browse files
authored
Merge pull request #105 from FIRST-Tech-Challenge/20210218-074821-release-candidate
FtcRobotController v6.2
2 parents 5b8d84a + 6e7dfbf commit cd037e0

File tree

12 files changed

+162
-88
lines changed

12 files changed

+162
-88
lines changed

FtcRobotController/build.gradle

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,4 @@ android {
2121
}
2222
}
2323

24-
repositories {
25-
maven { url = "https://dl.bintray.com/first-tech-challenge/ftcsdk/" }
26-
27-
flatDir {
28-
dirs '../libs'
29-
}
30-
}
31-
32-
apply from: 'build.release.gradle'
24+
apply from: '../build.dependencies.gradle'

FtcRobotController/build.release.gradle

Lines changed: 0 additions & 10 deletions
This file was deleted.

FtcRobotController/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.qualcomm.ftcrobotcontroller"
5-
android:versionCode="39"
6-
android:versionName="6.1">
5+
android:versionCode="40"
6+
android:versionName="6.2">
77

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

FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaUltimateGoalNavigationWebcam.java

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@
4848

4949
import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES;
5050
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ;
51-
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX;
51+
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XZY;
5252
import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC;
53-
import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK;
5453

5554
/**
5655
* This 2020-2021 OpMode illustrates the basics of using the Vuforia localizer to determine
@@ -89,10 +88,6 @@
8988
@Disabled
9089
public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
9190

92-
// IMPORTANT: If you are using a USB WebCam, you must select CAMERA_CHOICE = BACK; and PHONE_IS_PORTRAIT = false;
93-
private static final VuforiaLocalizer.CameraDirection CAMERA_CHOICE = BACK;
94-
private static final boolean PHONE_IS_PORTRAIT = false ;
95-
9691
/*
9792
* IMPORTANT: You need to obtain your own license key to use Vuforia. The string below with which
9893
* 'parameters.vuforiaLicenseKey' is initialized is for illustration only, and will not function.
@@ -140,8 +135,9 @@ public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
140135

141136
/*
142137
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
143-
* We can pass Vuforia the handle to a camera preview resource (on the RC phone);
138+
* We can pass Vuforia the handle to a camera preview resource (on the RC screen);
144139
* If no camera monitor is desired, use the parameter-less constructor instead (commented out below).
140+
* Note: A preview window is required if you want to view the camera stream on the Driver Station Phone.
145141
*/
146142
int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
147143
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
@@ -207,55 +203,46 @@ public class ConceptVuforiaUltimateGoalNavigationWebcam extends LinearOpMode {
207203
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
208204
frontWallTarget.setLocation(OpenGLMatrix
209205
.translation(-halfField, 0, mmTargetHeight)
210-
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , 90)));
206+
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 90)));
211207

212208
// The tower goal targets are located a quarter field length from the ends of the back perimeter wall.
213209
blueTowerGoalTarget.setLocation(OpenGLMatrix
214210
.translation(halfField, quadField, mmTargetHeight)
215-
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , -90)));
211+
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
216212
redTowerGoalTarget.setLocation(OpenGLMatrix
217213
.translation(halfField, -quadField, mmTargetHeight)
218214
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
219215

220216
//
221217
// Create a transformation matrix describing where the phone is on the robot.
222218
//
223-
// NOTE !!!! It's very important that you turn OFF your phone's Auto-Screen-Rotation option.
224-
// Lock it into Portrait for these numbers to work.
225-
//
226219
// Info: The coordinate frame for the robot looks the same as the field.
227220
// The robot's "forward" direction is facing out along X axis, with the LEFT side facing out along the Y axis.
228221
// Z is UP on the robot. This equates to a bearing angle of Zero degrees.
229222
//
230-
// The phone starts out lying flat, with the screen facing Up and with the physical top of the phone
231-
// pointing to the LEFT side of the Robot.
232-
// The two examples below assume that the camera is facing forward out the front of the robot.
233-
234-
// We need to rotate the camera around it's long axis to bring the correct camera forward.
235-
if (CAMERA_CHOICE == BACK) {
236-
phoneYRotate = -90;
237-
} else {
238-
phoneYRotate = 90;
239-
}
240-
241-
// Rotate the phone vertical about the X axis if it's in portrait mode
242-
if (PHONE_IS_PORTRAIT) {
243-
phoneXRotate = 90 ;
244-
}
223+
// For a WebCam, the default starting orientation of the camera is looking UP (pointing in the Z direction),
224+
// with the wide (horizontal) axis of the camera aligned with the X axis, and
225+
// the Narrow (vertical) axis of the camera aligned with the Y axis
226+
//
227+
// But, this example assumes that the camera is actually facing forward out the front of the robot.
228+
// So, the "default" camera position requires two rotations to get it oriented correctly.
229+
// 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)
230+
// 2) Next it must be be rotated +90 degrees (counter-clockwise) around the Z axis to face forward.
231+
//
232+
// Finally the camera can be translated to its actual mounting position on the robot.
233+
// In this example, it is centered (left to right), but 4" forward of the middle of the robot, and 8" above ground level.
245234

246-
// Next, translate the camera lens to where it is on the robot.
247-
// In this example, it is centered (left to right), but forward of the middle of the robot, and above ground level.
248235
final float CAMERA_FORWARD_DISPLACEMENT = 4.0f * mmPerInch; // eg: Camera is 4 Inches in front of robot-center
249236
final float CAMERA_VERTICAL_DISPLACEMENT = 8.0f * mmPerInch; // eg: Camera is 8 Inches above ground
250237
final float CAMERA_LEFT_DISPLACEMENT = 0; // eg: Camera is ON the robot's center line
251238

252-
OpenGLMatrix robotFromCamera = OpenGLMatrix
239+
OpenGLMatrix cameraLocationOnRobot = OpenGLMatrix
253240
.translation(CAMERA_FORWARD_DISPLACEMENT, CAMERA_LEFT_DISPLACEMENT, CAMERA_VERTICAL_DISPLACEMENT)
254-
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, YZX, DEGREES, phoneYRotate, phoneZRotate, phoneXRotate));
241+
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XZY, DEGREES, 90, 90, 0));
255242

256243
/** Let all the trackable listeners know where the phone is. */
257244
for (VuforiaTrackable trackable : allTrackables) {
258-
((VuforiaTrackableDefaultListener) trackable.getListener()).setPhoneInformation(robotFromCamera, parameters.cameraDirection);
245+
((VuforiaTrackableDefaultListener) trackable.getListener()).setCameraLocationOnRobot(parameters.cameraName, cameraLocationOnRobot);
259246
}
260247

261248
// WARNING:

FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/readme.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
## Caution
33
No Team-specific code should be placed or modified in this ``.../samples`` folder.
44

5-
Full or partial Samples should be Copied from here, and then Pasted into
6-
the team's folder, using the Android Studio cut and paste commands.
7-
This automatically changes all file and class names to be consistent.
5+
Samples should be Copied from here, and then Pasted into the team's
6+
[/TeamCode/src/main/java/org/firstinspires/ftc/teamcode](../../../../../../../../../../TeamCode/src/main/java/org/firstinspires/ftc/teamcode)
7+
folder, using the Android Studio cut and paste commands. This automatically changes all file and
8+
class names to be consistent. From there, the sample can be modified to suit the team's needs.
9+
10+
For more detailed instructions see the /teamcode readme.
811

912
### Naming of Samples
1013

FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ public boolean onMenuItemClick(MenuItem item) {
380380
}
381381

382382
FtcAboutActivity.setBuildTimeFromBuildConfig(BuildConfig.BUILD_TIME);
383+
384+
// check to see if there is a preferred Wi-Fi to use.
385+
checkPreferredChannel();
383386
}
384387

385388
protected UpdateUI createUpdateUI() {
@@ -401,17 +404,6 @@ protected void onStart() {
401404
super.onStart();
402405
RobotLog.vv(TAG, "onStart()");
403406

404-
// If we're start()ing after a stop(), then shut the old robot down so
405-
// we can refresh it with new state (e.g., with new hw configurations)
406-
shutdownRobot();
407-
408-
updateUIAndRequestRobotSetup();
409-
410-
cfgFileMgr.getActiveConfigAndUpdateUI();
411-
412-
// check to see if there is a preferred Wi-Fi to use.
413-
checkPreferredChannel();
414-
415407
entireScreenLayout.setOnTouchListener(new View.OnTouchListener() {
416408
@Override
417409
public boolean onTouch(View v, MotionEvent event) {
@@ -657,7 +649,9 @@ protected void onActivityResult(int request, int result, Intent intent) {
657649
// was some historical confusion about launch codes here, so we err safely
658650
if (request == RequestCode.CONFIGURE_ROBOT_CONTROLLER.ordinal() || request == RequestCode.SETTINGS_ROBOT_CONTROLLER.ordinal()) {
659651
// We always do a refresh, whether it was a cancel or an OK, for robustness
652+
shutdownRobot();
660653
cfgFileMgr.getActiveConfigAndUpdateUI();
654+
updateUIAndRequestRobotSetup();
661655
}
662656
}
663657

README.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ If you are an Android Studio programmer, there are several ways to download this
2525

2626
* You can also download the project folder (as a .zip or .tar.gz archive file) from the Downloads subsection of the [Releases](https://github.com/FIRST-Tech-Challenge/FtcRobotController/releases) page for this repository.
2727

28+
* The Releases page also contains prebuilt APKs.
29+
2830
Once you have downloaded and uncompressed (if needed) your folder, you can use Android Studio to import the folder ("Import project (Eclipse ADT, Gradle, etc.)").
2931

3032
## Getting Help
@@ -40,18 +42,49 @@ The Javadoc reference documentation for the FTC SDK is now available online. Cl
4042

4143
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[FTC Javadoc Documentation](https://first-tech-challenge.github.io/FtcRobotController)
4244

43-
Documentation for the FTC SDK is also included with this repository. There is a subfolder called "doc" which contains several subfolders:
44-
45-
* The folder "apk" contains the .apk files for the FTC Driver Station and FTC Robot Controller apps.
46-
* The folder "javadoc" contains the JavaDoc user documentation for the FTC SDK.
47-
4845
### Online User Forum
4946
For technical questions regarding the Control System or the FTC SDK, please visit the FTC Technology forum:
5047

5148
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[FTC Technology Forum](https://ftcforum.firstinspires.org/forum/ftc-technology)
5249

50+
### Sample OpModes
51+
This project contains a large selection of Sample OpModes (robot code examples) which can be cut and pasted into your /teamcode folder to be used as-is, or modified to suit your team's needs.
52+
53+
Samples Folder: &nbsp;&nbsp; [/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples](FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples)
54+
55+
The readme.md file located in the [/TeamCode/src/main/java/org/firstinspires/ftc/teamcode](TeamCode/src/main/java/org/firstinspires/ftc/teamcode) folder contains an explanation of the sample naming convention, and instructions on how to copy them to your own project space.
56+
5357
# Release Information
5458

59+
## Version 6.2 (20210218-074821)
60+
61+
### Enhancements
62+
* Attempts to automatically fix the condition where a Control Hub's internal Expansion Hub is not
63+
working by re-flashing its firmware
64+
* Makes various improvements to the WiFi Direct pairing screen, especially in landscape mode
65+
* Makes the Robot Controller service no longer be categorically restarted when the main activity is brought to foreground
66+
* (e.g. the service is no longer restarted simply by viewing the Self Inspect screen and pressing the back button)
67+
* It is still restarted if the Settings menu or Configure Robot menu is opened
68+
69+
70+
### Bug fixes
71+
* Fixes [FtcRobotController issue #71](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/71)
72+
Cannot open OpModes in v6.1 Blocks offline editor
73+
* Fixes [FtcRobotController issue #79](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/79)
74+
6.1 causes a soft reboot on the Motorola E5 Play
75+
* Fixes issue where the Control Hub OS's watchdog would restart the Robot Controller app if
76+
the Control Hub was not able to communicate with its internal Expansion Hub
77+
* Fixes certain I2C devices not showing up in the appropriate `HardwareMap` fields (such as `hardwareMap.colorSensor`)
78+
* Fixes issue where performing a WiFi factory reset on the Control Hub would not set the WiFi band to 2.4 GHz
79+
* Fixes issue where OnBotJava might fail to create a new file if the option to "Setup Code for Configured Hardware" was selected
80+
* Fixes issue where performing certain operations after an Op Mode crashes would temporarily break Control/Expansion Hub communication
81+
* Fixes issue where a Control Hub with a configured USB-connected Expansion Hub would not work if the Expansion Hub was missing at startup
82+
* Fixes potential issues caused by having mismatched Control/Expansion Hub firmware versions
83+
* Fixes [ftc_app issue 673](https://github.com/ftctechnh/ftc_app/issues/673) Latest matchlog is being deleted instead of old ones by RobotLog
84+
* Fixes ConceptVuforiaUltimateGoalNavigationWebcam sample opmode by correctly orienting camera on robot.
85+
* Fixes issue where logcat would be spammed with InterruptedExceptions when stop is requested from the Driver Station (this behavior was accidentally introduced in v5.3). This change has no impact on functionality.
86+
* Fixes issue where the blocks editor fails to load if the name of any TeleOp opmode contains an apostrophe.
87+
5588
## Version 6.1 (20201209-113742)
5689
* Makes the scan button on the configuration screen update the list of Expansion Hubs connected via RS-485
5790
* Fixes [SkyStone issue #143](https://github.com/FIRST-Tech-Challenge/SkyStone/issues/143)

TeamCode/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313

1414
// Include common definitions from above.
1515
apply from: '../build.common.gradle'
16-
17-
repositories {
18-
maven { url = "https://dl.bintray.com/first-tech-challenge/ftcsdk/" }
19-
}
16+
apply from: '../build.dependencies.gradle'
2017

2118
dependencies {
19+
implementation project(':FtcRobotController')
2220
annotationProcessor files('lib/OpModeAnnotationProcessor.jar')
23-
}
21+
}

TeamCode/build.release.gradle

Lines changed: 0 additions & 8 deletions
This file was deleted.

build.common.gradle

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ android {
2424
compileSdkVersion 29
2525

2626
signingConfigs {
27+
release {
28+
def apkStoreFile = System.getenv("APK_SIGNING_STORE_FILE")
29+
if (apkStoreFile != null) {
30+
keyAlias System.getenv("APK_SIGNING_KEY_ALIAS")
31+
keyPassword System.getenv("APK_SIGNING_KEY_PASSWORD")
32+
storeFile file(System.getenv("APK_SIGNING_STORE_FILE"))
33+
storePassword System.getenv("APK_SIGNING_STORE_PASSWORD")
34+
} else {
35+
keyAlias 'androiddebugkey'
36+
keyPassword 'android'
37+
storeFile rootProject.file('libs/ftc.debug.keystore')
38+
storePassword 'android'
39+
}
40+
}
41+
2742
debug {
2843
keyAlias 'androiddebugkey'
2944
keyPassword 'android'
@@ -75,8 +90,8 @@ android {
7590
// http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html
7691
buildTypes {
7792
release {
78-
// Disable debugging for release versions so it can be uploaded to Google Play.
79-
//debuggable true
93+
signingConfig signingConfigs.release
94+
8095
ndk {
8196
abiFilters "armeabi-v7a", "arm64-v8a"
8297
}
@@ -100,11 +115,12 @@ android {
100115
jni.srcDirs = []
101116
jniLibs.srcDir rootProject.file('libs')
102117
}
118+
ndkVersion '21.3.6528147'
103119
}
104120

105121
repositories {
106122
flatDir {
107123
dirs rootProject.file('libs')
108124
}
109125
}
110-
apply from: 'build.release.gradle'
126+

0 commit comments

Comments
 (0)