Skip to content

FRC4607/Robot-Telemetry

Repository files navigation

Garbage

"Time to get started on this. What should I name it?"
"Name it garbage."
"Sounds good. We can backronym it later."

Garbage is a FRC app designed to quickly identify a robot's mechanical issues and their early warning signs from onboard logging data provided by WPILib Data Logs generated by the robot. It can be broken up into three parts:

  • Python Scripts: Reponsible for pulling logs from the RoboRIO automatically, running their through a series of tests called metrics, and storing the result in a
  • MySQL Database: Acts as an accesable store for the processed data, which is used by
  • Grafana: The user facing portion of the app. Pulls data automatically from the SQL database and displays in in a customer (read: pit crew) friendly format.

Sounds like a good deal? Awesome.

Installation

Prerequisites

  1. Install a relational database of some kind. MySQL was used in development, but any relational database supported by SQLAlchemy and Grafana should be OK (so you can technically use Google Sheets if you wanted).
  2. Install Grafana. Whether you pick the Enterprise or OSS version shouldn't matter.

Python Setup

  1. Clone this repository onto a computer, preferably one that can stay in your pit for the entire event.
  2. Create a new python venv in the folder:
    python -m venv .
  3. Activate the virtual environment.
  4. Install all of the necessary packages from the requirements.txt file:
    pip install -r requirements.txt
  5. Open the file alembic.ini and change the connection URL (the part after sqlalchemy.url =) to match the database you have set up. See the Dialects page on SQLAlchemy's website for more info.
  6. Run alembic upgrade head to initialize the database.

Grafana Setup

  1. Install this traffic light plugin.
  2. Log into Grafana.
  3. Hover over the gear in the bottom left hand corner of the UI and select Data sources.
  4. Click on Add data source and follow the prompts to add your database.
  5. Click on the dashboards button (the one with the four squares) on the left hand side of the UI.
  6. Click New > Import.
  7. Click on Upload JSON file and select one of the dashboards in the dashboards folder from the cloned repo.
  8. Use the same process to add the other dashboards.

Usage

  • Run python garbage.py -d "[your database url from earlier"] to start the program. For more configuration option run python garbage.py --help.
  • Move .wpilog files into the archive/logs (by default) to analyze them.
  • The repo comes with three example groups (collections of metrics). You can either use them or delete them. Learn how to make your own groups.
  • Run python logfile_uploader.py to start a helper program that will automatically transfer your logs to be analyzed. Enter the IP of your team's RoboRIO (10.TE.AM.2 usually) and it will start. Keep an ethernet cable plugged into your computer and have the pit crew turn on the robot and plug in the cable when the robot gets back so the program can transfer the logs.
  • If you are storing your logs on a USB drive or are using a different username/password combo than lvuser/[no password], you will have to change the script yourself.

  • JSON files with the results of the metrics are stored by default in the archive/metrics directory. The names are just the name of the log file the metrics came from along with a timestamp.
  • Use the selectors at the top of the Grafana dashboards to change which groups and metrics you are viewing. You can see a complete list of your dashboards by going back to the Dashboards tab.

Packages

No packages published