An open API service indexing awesome lists of open source software.

https://github.com/frc4607/robot-telemetry

Hoot and WPILog Analysis System for our FRC robots
https://github.com/frc4607/robot-telemetry

ctre frc grafana logging telemetry

Last synced: 2 months ago
JSON representation

Hoot and WPILog Analysis System for our FRC robots

Awesome Lists containing this project

README

          

# 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](https://docs.wpilib.org/en/stable/docs/software/telemetry/datalog.html) 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](https://grafana.com/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](https://www.mysql.com/) was used in development, but any relational database supported by [SQLAlchemy](https://docs.sqlalchemy.org/en/20/dialects/index.html) and [Grafana](https://grafana.com/docs/grafana/latest/datasources/https://grafana.com/docs/grafana/latest/datasources/) should be OK (so you can technically use [Google](https://github.com/betodealmeida/shillelagh/) [Sheets](https://grafana.com/grafana/plugins/grafana-googlesheets-datasource/) if you wanted).
2. Install [Grafana](https://grafana.com/grafana/download). 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 using the appropriate script for your OS from the Scripts folder in the venv. For example, on Windows you would run:
`.\Scripts\Activate.ps1`
4. Install all of the necessary packages from the requirements.txt file:
`pip install -r requirements.txt`
1. 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](https://docs.sqlalchemy.org/en/20/dialects/index.html) page on SQLAlchemy's website for more info.
2. Run `alembic upgrade head` to initialize the database.

### Grafana Setup

1. Install [this traffic light plugin](https://grafana.com/grafana/plugins/snuids-trafficlights-panel/?tab=installation).
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](docs/groups.md).
- 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.