9-27-23 based on cmacfarl github note (released SDK lacks the assets folder), added notes for Android Studio users to skip the "run as is" section and manually add folder and .tflite file.
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
This text does not appear at the published wiki.
|
This text does not appear at the published wiki.
|
||||||
|
|
||||||
|
v03 9-27-23 add a note for Android Studio users to skip the Preliminary Testing section if OpMode crashes with warning
|
||||||
|
> Loading model from asset failed
|
||||||
|
|
||||||
|
This is based on notice from [cmacfarl](https://github.com/FIRST-Tech-Challenge/ftc_sdk/pull/3087#issuecomment-1736716592) that the assets folder is NOT present in the released SDK. So, this Sample OpMode may not work "as is" when built from AS.
|
||||||
|
|
||||||
|
Verified that OnBot Java successfully runs this Sample (and the Easy version) "as is", with downloaded APK from the github staging repo for SDK 9.0.1 and with the .tflite file removed from the local assets folder.
|
||||||
|
|
||||||
|
|
||||||
v02 9-26-23 restructure based on first running the OpMode "as is" to detect the default white Pixel. Then move on to uploading and specifying a TFOD model file. In early testing, the OpMode would not run "as is", but this was due to a missing assets folder with its default .tflite model file.
|
v02 9-26-23 restructure based on first running the OpMode "as is" to detect the default white Pixel. Then move on to uploading and specifying a TFOD model file. In early testing, the OpMode would not run "as is", but this was due to a missing assets folder with its default .tflite model file.
|
||||||
|
|
||||||
v01 9-25-23 posted first draft of tutorial at FTC wiki.
|
v01 9-25-23 posted first draft of tutorial at FTC wiki.
|
||||||
@ -52,7 +60,7 @@ This Sample has optional gamepad inputs, so it could be designated as a **TeleOp
|
|||||||
|
|
||||||
Click "OK" to create your new OpMode.
|
Click "OK" to create your new OpMode.
|
||||||
|
|
||||||
<i>Android Studio users should follow the commented instructions to copy this class from the Samples folder to the Teamcode folder, with a new name. Also remove the `@Disabled` annotation, to make the OpMode visible in the Driver Station list.</i>
|
<i>**Android Studio** users should follow the commented instructions to copy this class from the Samples folder to the Teamcode folder, with a new name. Also remove the `@Disabled` annotation, to make the OpMode visible in the Driver Station list.</i>
|
||||||
|
|
||||||
The new OpMode should appear in the editing window of OnBot Java.
|
The new OpMode should appear in the editing window of OnBot Java.
|
||||||
|
|
||||||
@ -66,6 +74,8 @@ By default, the Sample OpMode assumes you are using a webcam, configured as "Web
|
|||||||
|
|
||||||
This Sample OpMode is **ready to use**, for detecting the default/built-in model (white Pixel for CENTERSTAGE).
|
This Sample OpMode is **ready to use**, for detecting the default/built-in model (white Pixel for CENTERSTAGE).
|
||||||
|
|
||||||
|
<i>If **Android Studio** users get a DS error message "Loading model from asset failed", skip to the next section "Downloading the Model".</i>
|
||||||
|
|
||||||
Click the "Build Everything" button (wrench icon at lower right), and wait for confirmation "BUILD SUCCESSFUL".
|
Click the "Build Everything" button (wrench icon at lower right), and wait for confirmation "BUILD SUCCESSFUL".
|
||||||
|
|
||||||
If Build is prevented by some other OpMode having errors/issues, they must be fixed before your new OpMode can run. For a quick fix, you could right-click on that filename and choose "Disable/Comment". This "comments out" all lines of code, effectively removing that file from the Build. That file can be re-activated later with "Enable/Uncomment".
|
If Build is prevented by some other OpMode having errors/issues, they must be fixed before your new OpMode can run. For a quick fix, you could right-click on that filename and choose "Disable/Comment". This "comments out" all lines of code, effectively removing that file from the Build. That file can be re-activated later with "Enable/Uncomment".
|
||||||
@ -132,10 +142,12 @@ Now the TFOD model is stored on your laptop.
|
|||||||
|
|
||||||
## Uploading to the Robot Controller
|
## Uploading to the Robot Controller
|
||||||
|
|
||||||
Next, upload the TFOD model to the Robot Controller. Connect your laptop to your Robot Controller's wireless network, open the Chrome browser, and navigate to the FTC "Manage" page:
|
Next, OnBot Java users will upload the TFOD model to the Robot Controller. Connect your laptop to your Robot Controller's wireless network, open the Chrome browser, and navigate to the FTC "Manage" page:
|
||||||
|
|
||||||
<p align="center">[[https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/images/TFOD-Sample-OpMode-with-Java-Builder/040-Manage-page.png]]</p>
|
<p align="center">[[https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/images/TFOD-Sample-OpMode-with-Java-Builder/040-Manage-page.png]]</p>
|
||||||
|
|
||||||
|
<i>**Android Studio** users should instead skip to the instructions at the bottom of this section.</i>
|
||||||
|
|
||||||
Scroll down and click on "Manage TensorFlow Lite Models".
|
Scroll down and click on "Manage TensorFlow Lite Models".
|
||||||
|
|
||||||
<p align="center">[[https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/images/TFOD-Sample-OpMode-with-Java-Builder/050-Manage-TFLite-Models.png]]</p>
|
<p align="center">[[https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/images/TFOD-Sample-OpMode-with-Java-Builder/050-Manage-TFLite-Models.png]]</p>
|
||||||
@ -224,9 +236,9 @@ Uncomment two Builder lines, circled above in green:
|
|||||||
.setModelLabels(LABELS)
|
.setModelLabels(LABELS)
|
||||||
```
|
```
|
||||||
|
|
||||||
These Builder settings tell the TFOD Processor which model and labels to use for evaluating camera frames.
|
<i>**Android Studio** users should instead uncomment the lines `.setModelAssetName(TFOD_MODEL_ASSET)` and `.setModelLabels(LABELS)`.</i>
|
||||||
|
|
||||||
<i>**Android Studio** users should instead uncomment the line `.setModelAssetName(TFOD_MODEL_ASSET)`.</i>
|
These Builder settings tell the TFOD Processor which model and labels to use for evaluating camera frames.
|
||||||
|
|
||||||
<i>**That's it!**</i> You are ready to test this Sample OpMode again, this time using a "custom" (uploaded) TFOD model.
|
<i>**That's it!**</i> You are ready to test this Sample OpMode again, this time using a "custom" (uploaded) TFOD model.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user