Giter Club home page Giter Club logo

pros-grafana-cli's Introduction

Pros Grafana Lib

ย 

PROS Grafana CLI

Github top language

๐Ÿšง This library is still highly experimental ๐Ÿšง


About ย  | ย  Features ย  | ย  Technologies ย  | ย  Requirements ย  | ย  Starting ย  | ย  Usage ย  | ย  Author


๐ŸŽฏ About

This project aims to improve the VEX Robotics development process by allowing statistics to easily be recorded by a V5 brain and in realtime be sent to a Grafana dashboard. The PROS Grafana Library consists of three parts:

  • The PROS C++ template
  • The PROS-Grafana CLI, adding a custom command for brain interaction (this repository)
  • (Unfinished) The optional Grafana plugin allowing for custom visualization of data such as absolute positioning

โœจ Features

โœ”๏ธ Easily track multiple objects at once
โœ”๏ธ Easy chart and visualization creation
โœ”๏ธ Wireless support

๐Ÿš€ Technologies

The following tools were used in this project:

โœ… Requirements

Before starting ๐Ÿ, make sure you have already followed all of the steps in the PROS Grafana Library repository.

๐Ÿ Starting

You can install the PROS Grafana CLI using the following steps:

# Clone the project to the current directory
$ git clone https://github.com/BWHS-Robotics/pros-grafana-cli

# Access
$ cd pros-grafana-cli

# Install the CLI as a pip package 
$ pip install -e . 

Whenever you want to begin recording information, use the following command before you start the program:

$ prosgrafana

The command will also act like a PROS terminal, and will display whatever readings it receives from the brain.

๐Ÿ“ Sending it to Grafana

When you use the command prosgrafana, any data received by the brain will automatically be written to a file labelled guidata.sqlite. Grafana will need to know where this is located on your computer in order to display the information.


Ensure you have already setup a Grafana server by following the steps here. Once installed, the dashboard should be able to be opened by visiting http://localhost:3000, where both the username and password are by default admin:

image

โš™๏ธ Configuring Grafana

As Grafana does not natively support SQLite as a data source, we'll be using the frser-sqlite-datasource plugin. Follow the instructions below to install it:

  • Hover over the Gear icon on the left side of the dashboard and click Plugins
  • In the Search Grafana plugins box, search for SQLite
  • Click on the Install button for the plugin
Settings Navigation

Now that the plugin is installed, go back to the Settings menu and instead select the Data Sources tab. You should see a large blue button labelled Add data source.

image

After pressing it, find SQLite and click the Select button. For the Path input box, enter the absolute path to where your guidata.sqlite file is located. Hitting the Save & test button should result in a green checkbox and the text "Data source is working." An image for reference can be seen here:

Settings Navigation

Grafana should now be ready to read any data from the program and display it in whatever visualization desired.

โž• Creating dashboards

Now that you can access the robot data, you can create a new dashboard by navigating to the following option: image

This should lead you to a new page, where you can add as many panels as you want. In this example, we'll be creating a chart displaying the velocity readings of the chassis.

  • Select the Add an empty panel option
  • In te top right, make sure the type of panel is a Time series
  • In the Query tab, change the Data source to SQLite

Your page should now look something like this:image

We can now move onto the final segment: querying the SQLite file for data.

๐Ÿ“ Writing queries

As the file that stores information is .sqlite, queries will be using the SQL language in order to fetch data. A few examples can be seen below:

Fetching ALL statistics being tracked

SELECT * from data

Fetching a specific value requires knowing the names for variables you gave in the C++ library.

For example, if I named a motor Variable "Left Front Motor" and tracked "Actual Velocity", you would fetch it using this query:

SELECT time, "Left Front Motor Actual Velocity" from data

Notice how time also has to be included for Grafana to know when certain values occur. You can fetch as many variables as you want, however there must be a ',' character between each.

Once you're done, you can hit the "Apply" button and rearrange the chart in any fashion.

โœจ Other features offered by Grafana

Charts are just a tiny portion of what Grafana can do with data. You can find a list of the available visualizations here.


Made with โค๏ธ by Ryder

ย 

Back to top

pros-grafana-cli's People

Contributors

bennybot avatar uz9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.