Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Merge branch 'dev' of https://github.com/serivesmejia/EOCV-Sim into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Dec 18, 2020
2 parents 6b044ee + a4cc211 commit 4b90422
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 16 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ simple user interface directly in your computer, simulating the EasyOpenCV libra
FTC SDK structure, allowing you to simply copy paste directly your pipeline code once you want to
transfer it onto your robot!

<img src='images/eocvsim_screenshot_1.png' width='650' height='500'>
<img src='images/eocvsim_screenshot_1.png' width='75%' height='75%'>

# Compatibility

Expand Down Expand Up @@ -48,18 +48,12 @@ No complicated setup is required, straight up importing the project into Intelli
1) In the "URL" field, enter: ```https://github.com/serivesmejia/EOCV-Sim.git```<br/>
2) The directory can be changed, but it will be automatically filled so it's not necessary.
3) Make sure the "Version control" is set to "Git".<br/><br/>
<img src='images/eocvsim_screenshot_installation_3.png' width='608' height='363'><br/>
<img src='images/eocvsim_screenshot_installation_3.png' width='50%' height='50%'><br/>
4) After that, click on the "Clone" button, located at the bottom right and the cloning process will begin...<br/>
<img src='images/eocvsim_screenshot_installation_4.png' width='407' height='83'><br/>
<img src='images/eocvsim_screenshot_installation_4.png' width='50%' height='50%'><br/>
5) After the cloning finishes, the project should automatically import and you'll have something like this:<br/><br/>
<img src='images/eocvsim_screenshot_installation_5.png' width='500' height='267'><br/>
<img src='images/eocvsim_screenshot_installation_5.png' width='75%' height='75%'><br/>

4) **Change to packages view** (optional):<br/><br/>
In order to have a better look of your project's sources, I recommend to change the view to "package" as explained next:<br/>
1) Go to the left where your project files are shown, and click on the "Project" drop down list
2) Select "Packages" from the list and the view will change.<br/><br/>
Here's a quick gif illustrating these steps:<br/><br/>
<img src='images/eocv_installation_changeview.gif' width='512' height='288'><br/><br/>
### And you're ready to go! Refer to the [usage explanation](https://github.com/serivesmejia/EOCV-Sim/blob/master/USAGE.md) for further details on how to utilize the simulator.<br/>

# Contact
Expand Down
66 changes: 60 additions & 6 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ onto your Android Studio project once you want to transfer it to a robot.<br/>
- Sample Pipeline
- Input Sources

## Popping out the TeamCode module

EOCV-Sim uses Gradle since v2.0.0, because of this, the project structure is a bit different. For finding the package in which the pipelines have to be placed:</br>
1) Pop out the parent EOCV-Sim project folder by clicking on the horizontal arrow
2) Find the TeamCode module (folder) and pop it out just like before
3) Find the src folder and open it
4) Now you will find the *org.firstinspires.ftc.teamcode* package, in which some sample pipelines are already placed.

These steps are illustrated in this gif:</br>

<img src='images/eocvsim_usage_popup_teamcode.gif' width='60%' height='60%'><br/>

## Pipelines

All of the pipeline classes **should be** placed under the *org.firstinspires.ftc.teamcode* package, in the *TeamCode* module. This way, they will be
As said before, all of the pipeline classes **should be** placed under the *org.firstinspires.ftc.teamcode* package, in the *TeamCode* module. This way, they will be
automatically detected by the simulator and will be selectionable from the GUI.

<img src='images/eocvsim_screenshot_structure.png' width='301' height='183'><br/>
<img src='images/eocvsim_screenshot_structure.png' width='25%' height='25%'><br/>

*(Also, the simulator already comes by default with some EasyOpenCV samples)*<br/>

Expand All @@ -28,7 +40,7 @@ To create a new java class, follow these steps:<br/>

Here's a quick gif illustrating these steps:<br/>

<img src='images/eocvsim_usage_createclass.gif' width='512' height='288'><br/>
<img src='images/eocvsim_usage_createclass.gif' width='75%' height='75%'><br/>

If you want your class to be a pipeline, it **should also** extend the EOCV's OpenCvPipeline abstract class and override the processFrame() method.<br/><br/>
Here's a empty pipeline template, with the SamplePipeline class we created before:
Expand Down Expand Up @@ -66,16 +78,58 @@ public class SamplePipeline extends OpenCvPipeline {
}
```

### For more detailed information about pipelines, make sure to check out the [EasyOpenCV docs](https://github.com/OpenFTC/EasyOpenCV/blob/master/doc/user_docs/pipelines_overview.md)

## Input Sources

To allow multiple ways to test your pipeline, the simulator comes with so called *Input Sources*, which are the ones that will give your pipeline the input mats, As of right now, the sim has two types of Input Sources:
To allow multiple ways to test your pipeline, the simulator comes with so called *Input Sources*, which are the ones in charge of giving your pipeline the input Mats, As of right now, the sim has two types of Input Sources:

- Image Source:</br></br>
These will feed your pipeline with a static Mat from an image loaded in your computer hard drive.</br></br>
These will feed your pipeline with a static Mat from an image loaded in your computer hard drive.</br>
To save resources, your pipeline will just run once when you select an image source, but you can optionally resume the pipeline execution by clicking the "Pause" button under the pipeline selector.</br></br>
- Camera Source:</br></br>
These will feed your pipeline with a constantly changing Mat from a specified camera plugged in your computer.</br></br>
These will feed your pipeline with a constantly changing Mat from a specified camera plugged in your computer.</br>
Unlike the image sources, these will not pause the execution of you pipeline by default, but you can click the "Pause" button to pause it at any time.

### Creating an Input Source

1)

## Telemetry

There's also an SDK-like Telemetry implementation in the sim.
In 1.1.0 (when it was introduced) you could simply access it from your pipeline since it was an instance variable ```telemetry```.

But, starting 2.0.0, to make it more alike to an actual EOCV pipeline, you need to implement a public constructor which takes a Telemetry parameter, then creating and setting an instance variable from that constructor:

```java
package org.firstinspires.ftc.teamcode;

import org.opencv.core.Mat;
import org.openftc.easyopencv.OpenCvPipeline;

import org.firstinspires.ftc.robotcore.external.Telemetry;

public class TelemetryPipeline extends OpenCvPipeline {

Telemetry telemetry;

public TelemetryPipeline(Telemetry telemetry) {
this.telemetry = telemetry;
}

@Override
public Mat processFrame(Mat input) {
telemetry.addData("[Hello]", "World!");
telemetry.update();
return input; // Return the input mat
}

}
```

Which then produces the following result:<br/>

<img src='images/eocvsim_usage_telemetry.png' width='25%' height='25%'><br/>

For further information about telemetry, you can check out the [SDK docs on Telemetry](https://ftctechnh.github.io/ftc_app/doc/javadoc/org/firstinspires/ftc/robotcore/external/Telemetry.html), note that not all the methods are implemented for EOCV-Sim
Binary file removed images/eocv_installation_changeview.gif
Binary file not shown.
Binary file modified images/eocvsim_screenshot_installation_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/eocvsim_screenshot_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/eocvsim_usage_createclass.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eocvsim_usage_popup_teamcode.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eocvsim_usage_telemetry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b90422

Please sign in to comment.