Scorpions Robotics #7672

FRC Rapid React Vision Processing

GitHub PyPI - Python Version Code Style: Black OpenCV

CodeFactor Codacy Badge CodeQL

Runs on:

NVIDIA Jetson Nano 4Gb

How do we process the vision?

We use the Open Source Computer Vision Library OpenCV with Cascade Classifier features to detect and track the target.

Details:

  1. Detect the host computer’s OS, hostname and IP address.

  2. Initialize NetworkTables client and stream server, then connect to the “vision” table.

  3. Define the camera according to the OS and parameters.

  4. Define the cascade classifier path. (The classifier we used is trained to detect FRC Power Ports, and can be downloaded from here)

  5. while True:

    • Read the image from the camera.
    • Detect the target using the cascade_classifier.detectMultiScale() method.
    • If the target is detected, draw a rectangle around it.
    • Display the image.
    • Send the target’s position to the NetworkTables.
    • Wait for the next frame.

 

Compatible Operating Systems:

  • Windows   Windows 7 or newer

  • macOS   macOS 10.6 or newer

  • Linux   Most linux distros

 

Installation:

  1. Clone the repository. git clone https://github.com/Scorpions-Robotics/vision-2022.git

  2. Install the required dependencies. pip install --upgrade -r requirements.txt

  3. On Linux you have to install extra dependencies.

    • cd misc/bash/
    • chmod +x *
    • ./install_os_dependencies.sh

 

Usage:

  1. Copy settings.ini.template and rename it to settings.ini. Then edit it to your needs.

  2. Run the vision.py file to start the vision processing.

 

Important Note:

  • Always make sure to run the file from the root directory of the project.

  • Always keep the dependencies up to date.

  • Always use the latest stable version of this project.

 

Our Social Media Accounts and Discord Server

Instagram YouTube Discord

 

Contact

 

Contributing:

  1. If you have any suggestions, or found any bugs, please open an issue or create a pull request.

  2. Don’t hesitate to open an issue if you have any questions about the code.

 

Authors

 

License

This project is licensed under the Apache-2.0 license. All rights reserved.

GitHub

View Github