Skip to content

Commit

Permalink
GITBOOK-1: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
GramGra07 authored and gitbook-bot committed Feb 24, 2024
1 parent 31097b3 commit 01047e4
Show file tree
Hide file tree
Showing 21 changed files with 546 additions and 1,359 deletions.
2 changes: 2 additions & 0 deletions .etc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .etc

17 changes: 17 additions & 0 deletions .etc/machinelearning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Machine learning

**Note this is no longer supported in FTC SDK 8.0.0**

In FTC we typically use machine learning an AI's to detect images. In the FTC sample code in concept tensor flow object detection or TFOD, this is exactly what this does, it uses a tensorflow lite model in order for the robot to detect certain images, FTC has already trained some of it for us, but if you want to create your own AI it will take a little bit more work. [Here is the FTC object detection software](https://github.com/FIRST-Tech-Challenge/FtcRobotController/blob/master/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionWebcam.java) To start, make sure your team is registered and you have roles set up correctly, this [website](https://ftc-docs.firstinspires.org/ftc\_ml/logging\_on/logging-on.html#adding-students-to-your-teams-ftc-ml-workspace) will show you exactly how that is possible. Note that only coaches can put video into the recognition so either arrange for a time or have your coach sign in for you _wink_. Then you will take your videos, I would recommend (for Power Play season) to have 6 videos, all 3 sides on both color cones, this will allow for the most accurate design. I just used wevideo to combine these videos into one. Once your coach or you have uploaded the video to the [Machine learning site](https://ftc-ml.firstinspires.org/), you will have to wait for it to "extract" the frames. Then you will click on the description and get to work, you will get a picture of your video, make your object detection by dragging your box over the part you want it to detect and name it. Then click start tracking. This might take a while and you will have to watch it like a hawk. It might think some of your images are the same label in which case go to the first frame it messes up and simply change the label and hit start tracking. Once you have labeled all of your frames, you will select your video and click produce dataset, all of the default settings should be good and this is the shortest part of the process. Next you will have to select the dataset and click start training. This part will take as long as you want it to take, I would recommend 3000 steps as this will give you the highest accuracy. Once you download your model, place it into your assets folder and change `private static final String TFOD_MODEL_ASSET = "PowerPlay.tflite";` in your code to `private static final String TFOD_MODEL_ASSET = "your file name.tflite";`. Now you will have to go back to the datasets and look at your labels, put these labels into the FTC sample code and you are good to go.

* Getting a VuForia key

Go to [this website](https://developer.vuforia.com/license-manager) and log in, and create a new key.

Video showing entire process:

https://user-images.githubusercontent.com/101433010/199403553-69995287-3eaf-4af7-b74c-d8ae17b0868a.mp4

[Next up: OpenCV](../opencv.md)

[Go back home](../)
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

222 changes: 51 additions & 171 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,179 +1,59 @@
# WHS-FTC Code_Training_Module
## Created by FTC Team 5115
### To help everyone that wants to understand the coding process and language involved in FTC programming and Java
## Note: I will try to keep updating for as long as possible but please request features and give feedback [here][feed]

Github Repo located [here][repo]

Github Pages located [here][page]

Code Training Module Info/Feedback located [here][feed]

## Start [here](gettingStarted.md)

# Table of Contents <a name="top"></a>
- [Links](/.etc/linksAndAcknowledgements.md#link)
- [Tips and Hints](#tip)
- [Fatal Errors](/coding.md#fatal)
- [Getting Started](/gettingStarted.md)
- [Github Basics](/basics/githubBasics.md)
- [Set-up Android Studio](/basics/githubBasics.md#setup)
- [Forking](/basics/githubBasics.md#fork)
- [Cloning the repository](/basics/githubBasics.md#clone)
- [Github Basics](/basics/githubBasics.md#gbasics)
- [Commits](/basics/githubBasics.md#commit)
- [Push](/basics/githubBasics.md#push)
- [Pull/merge](/basics/githubBasics.md#pull)
- [Managing your server](/basics/githubBasics.md#manage)
- [Personal Access Token](/basics/githubBasics.md#pat)
- [Video Explanation of GitHub](/basics/githubBasics.md#gitvid)
- [Coding](/coding.md#code)
- [Code Basics](/basics/codingBasics.md#cbasics)
- [What is a...](/basics/codingBasics.md#wia)
- [Operation](/basics/codingBasics.md#oper)
- [Variable](/basics/codingBasics.md#var)
- [Function](/basics/codingBasics.md#func)
- [If Statement](/basics/codingBasics.md#if)
- [Print/Telemetry System](/basics/codingBasics.md#print)
- [Loop](/basics/codingBasics.md#loop)
- [Import](/basics/codingBasics.md#import)
- [Getting Started](/coding.md#start2)
- [Setting up your files](/coding.md#files)
- [Using Variables](/coding.md#usevar)
- [TeleOp](/coding.md#tele)
- [Autonomous](/coding.md#auto)
- [Editing your code](/coding.md#edit)
- [Functions](/coding.md#functions)
- [Hardware](/coding.md#ware)
- [Motors and Servos](/coding.md#motor)
- [Sensors](/coding.md#sense)
- [Indicators](/coding.md#indicator)
- [Built in Functions](/coding.md#built)
- [GamePad Input](/coding.md#gp)
- [Encoders](/autonomous/encoders.md#encode)
- [How do they work?](/autonomous/encoders.md#eWork)
- [How do I use them?](/autonomous/encoders.md#eUse)
- [Why should I use them?](/autonomous/encoders.md#eyUse)
- [PIDF](advanced/PIDF.md#pidf)
- [What is it?](advanced/PIDF.md#what)
- [How do I use it?](advanced/PIDF.md#use)
- [How do I tune it?](advanced/PIDF.md#tune)
- [How do I implement it?](advanced/PIDF.md#implement)
- [Resources](advanced/PIDF.md#resources)
- [Running your code](#run)
- [Machine Learning and TFOD](/autonomous/machineLearning.md#ml)
- [OpenCV](/autonomous/openCV.md)
- [Road Runner](/autonomous/roadRunner.md)
- [StateMachine](/autonomous/StateMachine.md)
- [Updating your devices](#update)
- [Overall game](#ovr)
- [Feedback](#feed)
- [Acknowledgements](/.etc/linksAndAcknowledgements.md#agk)
- [Glossary](#gloss)

## Tips and Hints <a name="tip"></a>
### 1. PRACTICE!!
- It is known that if you practice something, you will get better at it over time, this is the same for coding and robotics
### 2. Ask Questions
- A lot of people know what they are doing and are willing to help if you just ask
### 3. If you don't know a concept, look it up
- There are a lot of helpful solutions and people on the internet, someone **WILL** usually know the answer to your problem
### 4. READ
- All of the example opModes have very helpful comments to show you exactly what each part does, also if you read this whole thing you should be good to go
### 5. Collaborate
- A lot of problems can be solved by collaboration with friends and peers
### 6. Use prior knowledge
- Even if your prior knowledge is in a different language, it **will** help you understand this code.

## Running your code <a name="run"></a>
To put the code onto your robot, you will plug in the RC phone or the control hub to your computer and press the ![runa][run] button. It will take a bit to load and once it finishes, you can disconnect and then go to your DS phone and select your opmode, then select the run button once, tap it again and your code will run.

## Updating your devices <a name="update"></a>
Go to this [website][rhc]. It will take you to rev hardware client. Once you download the app you will be able to connect the DS phone or the Control Hub and it will show you your possible updates, take them all and you are good to go!

## Overall Game <a name="ovr"></a>
# WHS-FTC Code\_Training\_Module

### Created by FTC Team 5115

#### To help everyone that wants to understand the coding process and language involved in FTC programming and Java

### Note: I will try to keep updating for as long as possible but please request features and give feedback [here](https://gramgra07.github.io/gg-web/)

Github Repo located [here](https://github.com/GramGra07/WHS-FTC-Code\_Training\_Module)

#### 1. PRACTICE!!

* It is known that if you practice something, you will get better at it over time, this is the same for coding and robotics

#### 2. Ask Questions

* A lot of people know what they are doing and are willing to help if you just ask

#### 3. If you don't know a concept, look it up

* There are a lot of helpful solutions and people on the internet, someone **WILL** usually know the answer to your problem

#### 4. READ

* All of the example opModes have very helpful comments to show you exactly what each part does, also if you read this whole thing you should be good to go

#### 5. Collaborate

* A lot of problems can be solved by collaboration with friends and peers

#### 6. Use prior knowledge

* Even if your prior knowledge is in a different language, it **will** help you understand this code.

### Running your code <a href="#run" id="run"></a>

To put the code onto your robot, you will plug in the RC phone or the control hub to your computer and press the ![runa](images/run.png) button. It will take a bit to load and once it finishes, you can disconnect and then go to your DS phone and select your opmode, then select the run button once, tap it again and your code will run.

### Updating your devices <a href="#update" id="update"></a>

Go to this [website](https://docs.revrobotics.com/rev-hardware-client/getting-started/installation-instructions). It will take you to rev hardware client. Once you download the app you will be able to connect the DS phone or the Control Hub and it will show you your possible updates, take them all and you are good to go!

### Overall Game <a href="#ovr" id="ovr"></a>

The game begins with a 30 second autonomous period, runtime helps us achieve this, and then a 2 minute TeleOp period, the goal is to score as many points as possible.

## Feedback <a name="feed"></a>

### Feedback <a href="#feed" id="feed"></a>

I would love to have feedback on this repository. You can contact me through the discussions! Thanks!

## Glossary <a name="gloss"></a>
### Glossary <a href="#gloss" id="gloss"></a>

A repository is a folder hosted on github that contains code and items.

A TeleOp is an opmode that uses your game-pad inputs to control your robot, it is on the right side of the phone when selecting an opmode.

A Autonomous opmode is an opmode that continuously loops for 30 seconds at the beginning of the each match, it is on the left side of the phone when selecting an opmode.

My apologies if this doesn't work, some code software allows this exact code, some doesn't.

[rhc]:https://docs.revrobotics.com/rev-hardware-client/getting-started/installation-instructions
[ftcpage]: https://github.com/FIRST-Tech-Challenge/FtcRobotController
[user]: https://github.com/GramGra07
[team]: https://github.com/WindsorHSRobotics/Team_Resources
[rev]: https://www.revrobotics.com/
[clineuser]: https://github.com/stcline
[aslink]: https://developer.android.com/studio
[ggl]: https://www.google.com/
[lop]: https://github.com/FIRST-Tech-Challenge/FtcRobotController/blob/master/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/BasicOpMode_Linear.java
[cuser]: https://github.com/ctimmons25
[juser]: https://github.com/JohnMayfield
[buser]: https://github.com/sangerb19
[gm0]: https://gm0.org/en/latest/
[lib]: https://www.firstinspires.org/resource-library/ftc/game-and-season-info
[web]: https://gist.github.com/jagrosh/5b1761213e33fc5b54ec7f6379034a22
[mlguide]: https://ftc-docs.firstinspires.org/ftc_ml/
[ml]: https://ftc-ml.firstinspires.org/
[mlset]: https://ftc-docs.firstinspires.org/ftc_ml/logging_on/logging-on.html#adding-students-to-your-teams-ftc-ml-workspace
[tfodweb]: https://github.com/FIRST-Tech-Challenge/FtcRobotController/blob/master/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionWebcam.java
[vu]: https://developer.vuforia.com/license-manager
[3D]: https://docs.google.com/presentation/d/1MeLkA9mCI4vZMiejlqMZpAhZvbV2ThvSf6oZBzhQGdo/edit?usp=sharing
[qm]: https://gm0.org/en/latest/docs/software/tutorials/mecanum-drive.html
[qt]: https://docs.revrobotics.com/kickoff-concepts/freight-frenzy-2021-2022/programming-teleoperated
[bb]: https://www.firstinspires.org/sites/default/files/uploads/resource_library/ftc/blocks-programming-guide.pdf
[page]: https://gramgra07.github.io/WHS-FTC-Code_Training_Module/
[repo]: https://github.com/GramGra07/WHS-FTC-Code_Training_Module/blob/main/README.md
[feed]: https://gramgra07.github.io/gg-web/
[eocv]: https://github.com/OpenFTC/EasyOpenCV
[hsv]: https://i.stack.imgur.com/gyuw4.png
[lrr]: https://learnroadrunner.com/#frequently-asked-questions
[dash]: http://192.168.43.1:8080/dash

[fork]: /images/fork.png
[gitcommit]: /images/gitCommit.png
[commit]: /images/commit.png
[push]: /images/push.png
[pull]: /images/pull.png
[run]: /images/run.png
[setting]: /images/settings.png
[beTele]: /examples/exampleTeleOpBlank
[feTele]: /examples/exampleTeleOpFull
[beAuto]: /examples/exampleAutoBlank.txt
[feAuto]: /examples/exampleAutoFull.txt
[code]: /images/code.png
[zip]: /images/zip.png
[vcs]: /images/vcs.png
[step1]: /images/step1.png
[step2]: /images/step2.png
[step3]: /images/step3.png
[step4]: /images/step4.png
[step5]: /images/step5.png
[step6]: /images/step6.png
[file]: /images/file.png
[open]: /images/open.png
[new]: /images/new.png
[import]: /examples/import.txt
[eDemo]: /examples/RobotAutoDriveByEncoder_Linear.txt
[color]: /examples/SensorColor.txt
[IMU]: /examples/SensorBNO055IMU.txt

[cP]: /coding.md
[mlP]: /autonomous/machineLearning.md
[gbP]: /basics/githubBasics.md
[laP]: /.etc/linksAndAcknowledgements.md
[eP]: /autonomous/encoders.md
[hP]: /README.md
[rr]: /autonomous/roadRunner.md
[cv]: /autonomous/openCV.md
[pidf]: /advanced/PIDF.md
[sm]: /autonomous/StateMachine.md
A Autonomous opmode is an opmode that continuously loops for 30 seconds at the beginning of the each match, it is on the left side of the phone when selecting an opmode.

My apologies if this doesn't work, some code software allows this exact code, some doesn't.
16 changes: 16 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Table of contents

* [WHS-FTC Code\_Training\_Module](README.md)
* [Getting Started](gettingStarted.md)
* [Github Basics](githubbasics.md)
* [Coding Basics](codingbasics.md)
* [Coding](coding.md)
* [Encoders](encoders.md)
* [OpenCV](opencv.md)
* [RoadRunner](roadrunner.md)
* [StateMachine](statemachine.md)
* [PIDF Controller](pidf.md)
* [.etc](.etc/README.md)
* [Machine learning](.etc/machinelearning.md)
* [hyperlinks](.etc/hyperlinks.md)
* [linksAndAcknowledgements](.etc/linksAndAcknowledgements.md)
Loading

0 comments on commit 01047e4

Please sign in to comment.