Git Product home page Git Product logo

graphy's Introduction

GitHub GitHub all releases

Graphy

Graphy is an open-source PROS library that simplifies graphing data on the v5 brain.

Installation

Use the PROS CLI to install Graphy. If you installed PROS correctly, you should already have the PROS CLI.

  1. Download Graphy@LATEST_VERSION.zip (found here) at the root of your project
  2. Run pros conductor fetch Graphy@LATEST_VERSION.zip at the root of your project
  3. Run pros conductor apply Graphy at the root of your project
  4. Add #include "Graphy/Grapher.hpp" to your header file

Usage

Example code:

#include "Graphy/Grapher.hpp"

// Create grapher
std::shared_ptr<graphy::AsyncGrapher> grapher(new graphy::AsyncGrapher("Flywheel Velocity vs. Time"));

// Add data types
grapher->addDataType("Desired Vel", COLOR_ORANGE);
grapher->addDataType("Actual Vel", COLOR_AQUAMARINE);

// Start grapher task
grapher->startTask();

while(true) {
    // Update data
    grapher->update("Desired Vel", DESIRED_VELOCITY);
    grapher->update("Actual Vel", ACTUAL_VELOCITY);

    pros::delay(10);
}

Documentation:

/**
 * @brief Construct a new Async Grapher object
 *
 * @param title graph title
 * @param rate refresh rate
 */
AsyncGrapher(const std::string &title, const okapi::QTime &rate = 10 * okapi::millisecond);

/**
 * @brief Add new graph data type
 *
 * @param name data type name
 * @param color line color
 */
void addDataType(const std::string &name, const uint32_t color);

/**
 * @brief Update graph
 *
 * @param name data type name
 * @param val updated data value
 */
void update(const std::string &name, double val);

/**
 * @brief Set the refresh rate
 *
 * @param rate refresh rate
 */
void setRefreshRate(const okapi::QTime &rate);

/**
 * @brief Get the current refresh rate
 *
 * @return refresh rate
 */
okapi::QTime getRefreshRate();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GPL-3.0

graphy's People

Contributors

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