Difference between revisions of "FTC CanDo With TensorFlow 20220513"

From wikidb
Jump to: navigation, search
(Epp TensorFlow Projects)
(Potential Exercises)
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Added Machine Learning Capability =
 
= Added Machine Learning Capability =
  
TBD
+
The goal of this program is to enable CanDo to push a gold cub off the arena more quickly by using Tensorflow.
 +
Some may say that we are making the program smarter through machine learning.
 +
Whether we think the terms "learning" and "smarter" are appropriate, Convolutional Neural Networks are a powerful, import and fun technology to understand.
 +
We'll get a hint of what it is about in this lab.
  
 
= References =
 
= References =
Line 12: Line 15:
 
== Epp TensorFlow Projects ==
 
== Epp TensorFlow Projects ==
  
* [https://www.youtube.com/watch?v=Cd2PYhapyvw ]
 
 
* [https://github.com/edcepp/FTCEppTensorCode/tree/master/FTCEppTensorCode FTC Epp TensorCode]
 
* [https://github.com/edcepp/FTCEppTensorCode/tree/master/FTCEppTensorCode FTC Epp TensorCode]
 
* [https://tryengineering.org/tryengineering-community-resources/using-tensorflow-to-detect-game-pieces-in-first-tech-challenge-robot-competitions-an-exploration-in-machine-learning/ IEEE TryEnginering  resource page] Links to the same tutorial above.
 
* [https://tryengineering.org/tryengineering-community-resources/using-tensorflow-to-detect-game-pieces-in-first-tech-challenge-robot-competitions-an-exploration-in-machine-learning/ IEEE TryEnginering  resource page] Links to the same tutorial above.
  
 
= Code =
 
= Code =
 +
 +
== Integrated CanDo and TensorFlow Code==
 +
 +
The goal of this program is to enable CanDo to push a gold cub off the arena more quickly by use Tensorflow.
 +
 +
* [https://github.com/edcepp/FTCJavaLabs/blob/main/TensorFlowCanDo11.java TensorFlowCanDo11.java]
  
 
== Based on Version 6 of CanDo and ==
 
== Based on Version 6 of CanDo and ==
Line 23: Line 31:
 
* For details see [[FTC_A_Hint_of_CanDo_-_TBD_20220422#Version_6_Add_Reverse_and_Turn]]
 
* For details see [[FTC_A_Hint_of_CanDo_-_TBD_20220422#Version_6_Add_Reverse_and_Turn]]
  
== Bases on xxx ==
+
== Bases on this Version of a TensorFlow Object Detection Program ==
 +
 
 +
* [https://github.com/edcepp/FTCEppTensorCode/blob/master/FTCEppTensorCode/TestTensorFlowObjectDetectionWebcamEpp.java TestTensorFlowObjectDetectionWebcamEpp.java]
 +
 
 +
= Exercises =
 +
 
 +
== Exercise 1 ==
 +
 
 +
* Test recognition for a gold cube under
 +
** Various lighting
 +
** Orientations
 +
** Distances
 +
 
 +
== Exercise 2 ==
 +
 
 +
* Enhance the TensorFlowCanDo11.java program by making the robot rotate to find a gold mineral.
 +
 
 +
== Exercise 3 ==
 +
 
 +
* Make the robot stop rotating after it has located the gold mineral.
 +
 
 +
== Exercise 4 ==
 +
 
 +
* Make the robot push the gold mineral off the arena.
 +
* If the robot overshoots its rotation, make it adjust its aim until the robot is centered in the monitor.
 +
* Enhance model
 +
 
 +
= Spoiler Alert - New Code Version =
 +
 
 +
* [https://github.com/edcepp/FTCJavaLabs/blob/main/TensorFlowCanDo12.java TensorFlowCanDo12.java]
 +
 
 +
This version implement several of the exercises. It is a proof of concept. The follow are some possible improvements.
 +
 
 +
* Optimize motor power to improve performance.
 +
* Correct for overshoot by reversing rotation one or more times.
 +
* Try BC instead of the BCDM tflite versions of the model.
 +
* Test lighting conditions
 +
* Replace dead reckoning with additional targeting step during the move toward the block in the last step
 +
 
 +
== Exercise 5 - TBD ==
 +
 
 +
* Gearing up for confidence level experiments
 +
* [https://github.com/edcepp/FTCJavaLabs/blob/main/TensorFlowCanDo13.java TensorFlowCanDo13.java]
 +
 
 +
== Potential Exercises ==
 +
 
 +
* Camera Field of View
 +
* Initial robot rotation speed
 +
* Impact of background on recognition
 +
* other?
 +
 
 +
= '''TBD''' Working with Models =
 +
 
 +
== References to be Explored ==
 +
 
 +
* [https://storage.googleapis.com/ftc-ml-firstinspires-prod/docs/ftc-ml_manual_2021.pdf FTC Machine Learning Tookit 2021-2022]Step-by-step guide
 +
* [https://www.youtube.com/watch?v=MLNjARrsIMA FTC OnBot Java TensorFlow Custom Model Tutorial]
 +
** [https://youtu.be/LGSL5izjCKU A step-by-step guide to implementing your TensorFlow Custom Model in OnBot Java] Guide to making a TensorFlow Custom Model android studio?
 +
* [https://javadoc.io/doc/org.firstinspires.ftc/RobotCore/latest/org/firstinspires/ftc/robotcore/external/tfod/TfodCurrentGame.html TensorFlow for Current Game]
 +
* [https://community.ftclive.org/t/onbotjava-issue/122 OnBotJava issue!]
 +
* [https://github-wiki-see.page/m/FIRST-Tech-Challenge/FtcRobotController/wiki/Using-TensorFlow-in-Freight-Frenzy Using TensorFlow in Freight Frenzy]
 +
* [https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Using-TensorFlow-in-Freight-Frenzy Using TensorFlow in Freight Frenzy]
 +
* [https://www.chiefdelphi.com/t/ftc-freight-frenzy-tensorflow-programming-issue/397601 FTC Freight Frenzy TensorFlow Programming Issue]
 +
 
 +
== Failed: Enabling the Rover Ruckus model ==
 +
 
 +
Load the following into
 +
    C:\Users\epp\AndroidStudioProjects\FTC71\FtcRobotController\FtcRobotController\src\main\assets
 +
        RoverReckus.tflite
 +
                  .dat
 +
                  .xml
  
* TensorFlow TBD
+
  from
 +
    C:\Users\epp\AndroidStudioProjects\FTC54\SkyStone-master\SkyStone-master\FtcRobotController\src\main\assets
  
== Integrated ==
+
and use this command
 +
  private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite";
  
* TensorFlowCanDo TDB
+
The program would not start up. Could find a "FreightFrenzy_BCDM.tflite" in my project. The SDK has changed.

Latest revision as of 13:21, 3 June 2022

Added Machine Learning Capability

The goal of this program is to enable CanDo to push a gold cub off the arena more quickly by using Tensorflow. Some may say that we are making the program smarter through machine learning. Whether we think the terms "learning" and "smarter" are appropriate, Convolutional Neural Networks are a powerful, import and fun technology to understand. We'll get a hint of what it is about in this lab.

References

Tutorial Videos

Epp TensorFlow Projects

Code

Integrated CanDo and TensorFlow Code

The goal of this program is to enable CanDo to push a gold cub off the arena more quickly by use Tensorflow.

Based on Version 6 of CanDo and

Bases on this Version of a TensorFlow Object Detection Program

Exercises

Exercise 1

  • Test recognition for a gold cube under
    • Various lighting
    • Orientations
    • Distances

Exercise 2

  • Enhance the TensorFlowCanDo11.java program by making the robot rotate to find a gold mineral.

Exercise 3

  • Make the robot stop rotating after it has located the gold mineral.

Exercise 4

  • Make the robot push the gold mineral off the arena.
  • If the robot overshoots its rotation, make it adjust its aim until the robot is centered in the monitor.
  • Enhance model

Spoiler Alert - New Code Version

This version implement several of the exercises. It is a proof of concept. The follow are some possible improvements.

  • Optimize motor power to improve performance.
  • Correct for overshoot by reversing rotation one or more times.
  • Try BC instead of the BCDM tflite versions of the model.
  • Test lighting conditions
  • Replace dead reckoning with additional targeting step during the move toward the block in the last step

Exercise 5 - TBD

Potential Exercises

  • Camera Field of View
  • Initial robot rotation speed
  • Impact of background on recognition
  • other?

TBD Working with Models

References to be Explored

Failed: Enabling the Rover Ruckus model

Load the following into

   C:\Users\epp\AndroidStudioProjects\FTC71\FtcRobotController\FtcRobotController\src\main\assets
       RoverReckus.tflite
                  .dat
                  .xml
 from
   C:\Users\epp\AndroidStudioProjects\FTC54\SkyStone-master\SkyStone-master\FtcRobotController\src\main\assets

and use this command

 private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite";

The program would not start up. Could find a "FreightFrenzy_BCDM.tflite" in my project. The SDK has changed.