Coder Social home page Coder Social logo

jishnusen / frc-grapher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sumigovindaraju/frc-grapher

0.0 1.0 0.0 1.59 MB

A Python app that graphs data sent from the roboRIO of an FRC robot over NetworkTables.

License: MIT License

JavaScript 30.90% HTML 28.40% Python 40.71%

frc-grapher's Introduction

FRC-Grapher

A Python app that graphs data sent from the roboRIO of an FRC robot over NetworkTables.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development, testing, and use.

Prerequisites

This requires RobotPy NetworkTables and SimpleWebSocketServer. To install just run:

$ pip3 install -r './requirements.txt'

Installing

Follow this guide to install FRC-Grapher locally.

First clone this repository:

$ git clone https://github.com/SumiGovindaraju/FRC-Grapher.git

Install prerequisites (see Prerequisites). Then create a directory called cache/.

To run FRC-Grapher, start the Python WebSocket server and open index.html:

$ ./main.py

To start the dummy NetworkTables server, run:

$ ./python test_server.py

For testing, start the Python WebSocket server, open index.html, and then start the dummy NetworkTables server last.

To see a list of command-line arguments available, run:

$ ./main.py --help

Usage

To add SmartDashboard keys to the graph, click "Add Dataset" in the navbar, type in the the SmartDashboard key into the modal, and click the "Add Dataset" button.

To save the current key configuration to a file, click "Save Configuration" in the navbar. To run this program with the saved configuration, run the Python WebSocket server with the -c or --config flag.

FRC-Grapher graphs Value vs. Time graphs. The Time data is sent over NetworkTables using the key frc-grapher-timestamp and is measured in seconds in the dummy server. Here are some examples of how to do this on the robot:

Java:

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

// When the robot code is initialized
double startTime = Timer.getFPGATimestamp();

// In each periodic cycle
SmartDashboard.putNumber("frc-grapher-timestamp", Timer.getFPGATimestamp() - startTime);

C++:

#include "WPILib.h"

using namespace frc;

// When the robot code is initialized
double startTime = Timer::GetFPGATimestamp();

// In each periodic cycle	
SmartDashboard::PutNumber("frc-grapher-timestamp", Timer::GetFPGATimestamp() - startTime);

Keep in mind that if multiple values are sent for a single timestamp, FRC-Grapher caches and graphs only the latest value, and discards any previous values for that specific timestamp.

FRC-Grapher automatically caches data during the match in a JSON file in the cache/ directory, named for the starting datetime of execution. To graph the cached data, run:

$ python main.py -r [path to JSON cache file]

The default IP address for the NetworkTables server is localhost, which is what the dummy NetworkTables server runs on. To run this program where the NetworkTables server is the roboRIO, run:

$ python main.py -i [IP address of robot]

See this for information on your robot's IP address.

Screenshots

FRC-Grapher in action: FRC-Grapher in action

Adding a SmartDashboard Key: Adding a SmartDashboard Key

Downloadable Screenshot of Graph: Downloadable Screenshot of Graph

Built With

Authors

  • Sumi Govindaraju

License

This project is licensed under the MIT License - see the LICENSE file for details

frc-grapher's People

Contributors

sumigovindaraju 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.