All Projects → robotpy → pynetworktables2js

robotpy / pynetworktables2js

Licence: MIT License
Forwards NetworkTables traffic to a web page, allowing you to write custom dashboards for your robot using HTML/Javascript

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to pynetworktables2js

examples
Repository of RobotPy example projects
Stars: ✭ 25 (-37.5%)
Mutual labels:  frc, robotpy
robotpy-cscore
Python bindings for the cscore image processing library
Stars: ✭ 17 (-57.5%)
Mutual labels:  frc, robotpy
FRC-NT-Client
WPI NetworkTables Client for Node
Stars: ✭ 20 (-50%)
Mutual labels:  frc, networktables
pyfrc
python3 library designed to make developing RobotPy-based code easier!
Stars: ✭ 46 (+15%)
Mutual labels:  frc, robotpy
frc-characterization
Tools to help FRC teams measure the physical parameters of their robot
Stars: ✭ 55 (+37.5%)
Mutual labels:  frc, robotpy
FRC-Java-Tutorial
A tutorial on how to program a robot for use in the FIRST Robotics Competition
Stars: ✭ 52 (+30%)
Mutual labels:  frc
NU18
Code for 2018's robot.
Stars: ✭ 13 (-67.5%)
Mutual labels:  frc
FRC-Krawler
FIRST Robotics scouting app brought to you by Team 2052
Stars: ✭ 20 (-50%)
Mutual labels:  frc
roborio-opencv
Scripts to build OpenCV for the RoboRIO
Stars: ✭ 13 (-67.5%)
Mutual labels:  frc
roborio-vm
Scripts to create QEMU virtual machine from the RoboRIO image file
Stars: ✭ 33 (-17.5%)
Mutual labels:  frc
statbotics
📈 Modernizing Data Analytics for FRC Robotics
Stars: ✭ 20 (-50%)
Mutual labels:  frc
robotics-training
Team 1257's repository for training new members
Stars: ✭ 18 (-55%)
Mutual labels:  frc
pathplanner
UI for generating trajectories with Pathfinder, based off of Vannaka's Motion Profile Generator
Stars: ✭ 21 (-47.5%)
Mutual labels:  frc
photonvision
PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
Stars: ✭ 115 (+187.5%)
Mutual labels:  frc
LibDS
Library for controling FRC robots
Stars: ✭ 29 (-27.5%)
Mutual labels:  frc
thirdcoast
Third Coast swerve drive and telemetry API for FRC robots
Stars: ✭ 35 (-12.5%)
Mutual labels:  frc
tbapy
📈 Python wrapper for The Blue Alliance API.
Stars: ✭ 39 (-2.5%)
Mutual labels:  frc
first-rust-competition
Rusty Robots: https://crates.io/crates/wpilib and https://crates.io/crates/cargo-frc
Stars: ✭ 45 (+12.5%)
Mutual labels:  frc
PowerUp-2018
The FRC 2018 programming repository for FRC Team 3695, Foximus Prime
Stars: ✭ 16 (-60%)
Mutual labels:  frc
StuyLib
Award-Winning FRC Library by StuyPulse Team 694
Stars: ✭ 17 (-57.5%)
Mutual labels:  frc

pynetworktables2js

A cross platform library that forwards NetworkTables key/values over a WebSocket, so that you can easily write a Driver Station Dashboard for your robot in HTML5 + JavaScript.

This library does not provide a full dashboard solution, but is intended to provide the necessary plumbing for one to create one with only knowledge of HTML/JavaScript. Because the communications layer uses NetworkTables, you can connect to all FRC languages (C++, Java, LabVIEW, Python).

Note

NetworkTables is a protocol used for robot communication in the FIRST Robotics Competition, and can be used to talk to Shuffleboard/SmartDashboard. It does not have any security, and should never be used on untrusted networks.

Documentation

Documentation can be found at http://pynetworktables2js.readthedocs.org/

Installation

Easy install (Windows only)

  1. Download the latest pynetworktables2js.exe from GitHub at https://github.com/robotpy/pynetworktables2js/releases .
  2. Extract the exe from the zipfile, and copy it to your directory of HTML/JS files.
  3. Double click the exe to run it!

Note

By default, it will connect to 127.0.0.1. To connect to a robot, you will need to pass the exe arguments to tell it where the robot is. Use --help to see the available options.

Manual install

Make sure to install python 3 on your computer, and on Windows you can execute:

py -3 -m pip install pynetworktables2js

On Linux/OSX you can execute:

pip install pynetworktables2js

Note

Technically, there's nothing stopping you from installing this on your robot, as there is a python interpreter available on the roboRIO (RobotPy). However, due to FRC bandwidth limitations, it's probably best to run the UI + server on your driver station laptop.

Why make an HTML/Javascript dashboard?

TL;DR: It's simpler.

pynetworktables2js lowers the barrier of entry for teams that want an additional way to tune/control their robot with a minimal amount of programming.

Lots of students and mentors know how to create simple web pages to display content, and there's lots of resources out there for creating dynamic content for webpages that use javascript. There is a lot of visually appealing content that others have created using web technologies -- why not leverage those resources to make something cool to control your robot?

Usage

You can just distribute your HTML files, and run a pynetworktables server using the following command from inside the directory:

python3 -m pynetworktables2js

Or on Windows:

py -3 -m pynetworktables2js

This will start a pynetworktables2js server using Tornado (which is installed by default) and it will serve the current directory. You can navigate your browser (I recommend Chrome) to http://127.0.0.1:8888 and see your website.

You will want to also pass either the --robot or --team switch:

py -3 -m pynetworktables2js --robot roborio-XXXX-frc.local
py -3 -m pynetworktables2js --team XXXX

Dashboard mode currently doesn't work, as the underlying support in pynetworktables hasn't been implemented yet for the newer FRC Driver Station.

Customized python server

There are two example servers distributed with pynetworktables2js, one that uses tornado, and one that uses aiohttp. Either one should work.

Go to the 'example' directory distributed with pynetworktables2js, and run:

python3 tornado_server.py --robot 127.0.0.1

If you want to try this out with your current robot, you can do:

python3 tornado_server.py --robot roborio-XXX.local

If you are running pynetworktables2js on your driver station laptop, you can receive robot IP information directly from the Driver Station (handy during actual competitions):

python3 tornado_server.py --dashboard

If you navigate your browser (I recommend Chrome) to http://127.0.0.1:8888, all of the current NetworkTables values will be shown as they change.

One way of testing this out is use FIRST's TableViewer application (you can launch it using the "Outline Viewer" WPILib menu item in Eclipse), and start it in server mode.

Feel free to copy the example directory to create your own customized dashboard. Just add your custom files to the www directory.

Contributing new changes

pynetworktables2js is intended to be a project that all members of the FIRST community can quickly and easily contribute to. If you find a bug, or have an idea that you think others can use:

  1. Fork this git repository to your GitHub account
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push -u origin my-new-feature)
  5. Create new Pull Request on GitHub

One place in particular I would love to see contributions is in adding useful JavaScript functions/objects that make creating dashboards even easier!

Authors

Leon Tan of FRC Team 1418 did the initial research/work to get this working, and created an initial working prototype for Team 1418's 2015 Dashboard, which was instrumental to winning an Innovation In Control award at the 2015 Greater DC Regional.

Dustin Spicuzza cleaned stuff up, rewrote things, added more functionality, wrote documentation, and packaged it so other teams could use it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].