Git Product home page Git Product logo

ftcvision's Introduction

FTC-Sees!

FTC Vision Library Build Status Documentation Status

Computer Vision library for FTC based on OpenCV, featuring beacon color and position detection, as well as an easy-to-use VisionOpMode format and many additional detection features planned in the future.

Installing from Scratch

  1. Clone FTCVision into a clean directory (outside your robot controller app) using the following command: git clone --depth=1 https://github.com/lasarobotics/ftcvision.
  2. Open the FTCVision project using Android Studio
  3. Copy your OpModes from your robot controller directory into the appropriate directory within ftc-robotcontroller. Then, modify the FtcOpModeRegister appropriately to add your custom OpModes.
  4. Before running the app for the first time, install the "OpenCV Manager" from the Google Play Store to enable Vision processing.
  5. Run and test the code! Let us know if you encounter any difficulties.
  6. You can now write your own VisionOpMode!

Installing into Existing Project

  • Clone FTCVision into a clean directory (outside your robot controller app) using the following command: git clone --depth=1 https://github.com/lasarobotics/ftcvision.
  • Navigate to the FTCVision directory that you just cloned and copy the ftc-visionlib and opencv-java folders into your existing robot controller app.
  • Open your robot controller app in Android Studio. Make sure you have the Project mode selected in the project browser window (so you can see all of the files in your project).
  • Find your settings.gradle file and append the following two lines:
include ':opencv-java'
include ':ftc-visionlib'
  • Find the AndroidManifest.xml under your ftc-robotcontroller folder, sometimes named sample or similar.
  • Insert the following uses-permission tag in the appropriate location (look at the rest of the file for context).
<uses-permission android:name="android.permission.CAMERA" android:required="true" />
  • Find your build.gradle in the parent folder of AndroidManifest.xml and insert the following line under dependencies:
compile project(':ftc-visionlib')
compile project(':opencv-java')
  • Update Gradle configuration by pressing the green "Sync Project with Gradle Files" button in the header (this may take a minute)
  • Copy in Vision opmodes (those that end in VisionSample.java, located in [vision-root]/ftc-robotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes) from the FTCVision directory into your opmode directory.
  • Before running the app for the first time, install the "OpenCV Manager" from the Google Play Store to enable Vision processing.
  • Run and test the code! Let us know if you encounter any difficulties.
  • You can now write your custom VisionOpMode!
  • (Optional) Add Vision testing app (see pictures of it below!) by copying all files from ftc-cameratest into the root of your project. Then, add include ':ftc-cameratest' to your settings.gradle in the root of your project. To run the camera test app, click the green "Sync Project with Gradle Files" button to update your project, then select ftc-cameratest from the dropdown.

Installing via Git Submodule (advanced)

When installing via Git submodule, every person cloning your repo will need to run git submodule init and git subomodule update for every new clone. However, you also get the advantage of not copying all the files yourself and you can update the project to the latest version easily by navigating inside the ftc-vision folder then running git pull.

  • Inside the root of your project directory, run
git submodule init
git submodule add https://github.com/lasarobotics/ftcvision ftc-vision
  • Follow the guide "Installing into Existing Project" starting from the third bullet point. Please note that since everything will be in the ftc-vision folder and thus directories will need to be modified. Once you get to the step that modifies settings.gradle, add the following lines:
project(':opencv-java').projectDir = new File('ftc-vision/opencv-java')
project(':ftc-visionlib').projectDir = new File('ftc-vision/ftc-visionlib')
project(':ftc-cameratest').projectDir = new File('ftc-vision/ftc-cameratest') <- only if you want to enable the camera testing app
  • You can now write your custom VisionOpMode!

Status

This library is complete as of World Championship 2016. If you have any questions or would like to help, send a note to smo-key (contact info on profile) or open an issue. Thank you!

Documentation Documentation Status

Documentation for the stable library is available at http://ftcvision.lasarobotics.org.

Does it work?

Yes! FTCVision can detect a beacon 0.5-4 feet away with 90% accuracy in 0.2 seconds. Here are some pictures. ๐Ÿ˜ƒ

Accuracy Test

Can it detect the beacon?

Old Accuracy Test

Can it detect the beacon?

Distance Test

A test from 8 feet away

Basic Analysis Demo

FAST isn't the greatest

Ambient Analysis (Color and Rotation Detection) Test

A test from 8 feet away

Analysis Methods

FAST vs. COMPLEX

  • The FAST method analyzes frames at around 5 FPS. It looks for the primary colors in the image and correlates these to locate a beacon.
  • The COMPLEX method analyzes frames at around 2-4 FPS. It uses statistical analysis to determine the beacon's location.
  • Additionally, a REALTIME method exists that retrieves frames and analyzes them as fast as possible (up to 15 FPS).

Goals

  • To make it easy for teams to use the power of OpenCV on the Android platform
  • Locate the lit target (the thing with two buttons) within the camera viewfield
  • Move the robot to the lit target, while identifying the color status of the target
  • Locate the button of the target color and activate it

Progress

  • Beacon located successfully with automated environmental and orientation tuning.
  • A competition-proof OpMode scheme created so that the robot controller does not need to be modified to use the app.
  • Now supports nearly every phone since Android 4.2, including both the ZTE Speed and Moto G.

ftcvision's People

Contributors

smo-key avatar russellsayshi avatar homu avatar brendanhollaway avatar ehsanmasdar avatar willfisher avatar arnavmohan avatar

Watchers

James Cloos avatar Tom Scherlis avatar Ciaran Beckford avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.