Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

robotpy/pynetworktables2js

Repository files navigation

Use Alternatives Instead

pynetworktables2js was created when web browsers could not support networktables.Now with networktables 4 (NT4), web browsers can directly talk to networktables servers.pynetworktables2js should no longer be used.

Alternatives include:

  • nt4.js - A pure javascript library for an NT4.1 client
  • ntcore-ts-client - A typescript library for an NT4.0 client
  • ntcore-react - A typescript library for using networktables with React



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 toprovide the necessary plumbing for one to create one with only knowledgeof HTML/JavaScript. Because the communications layer uses NetworkTables, youcan connect to all FRC languages (C++, Java, LabVIEW, Python).

Note

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

Documentation

Documentation can be found athttp://pynetworktables2js.readthedocs.org/

Installation

Easy install (Windows only)

  1. Download the latest pynetworktables2js.exe from GitHub athttps://github.com/robotpy/pynetworktables2js/releases .
  2. Extract the exe from the zipfile, and copy it to your directory of HTML/JSfiles.
  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 canexecute:

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 onyour robot, as there is a python interpreter available on theroboRIO (RobotPy). However, due to FRC bandwidth limitations,it's probably best to run the UI + server on your driver stationlaptop.

Why make an HTML/Javascript dashboard?

TL;DR: It's simpler.

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

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

Usage

You can just distribute your HTML files, and run a pynetworktables serverusing 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 installedby default) and it will serve the current directory. You can navigate yourbrowser (I recommend Chrome) tohttp://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.localpy -3 -m pynetworktables2js --team XXXX

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

Customized python server

There are two example servers distributed with pynetworktables2js, one thatusestornado, and one that usesaiohttp. 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 canreceive robot IP information directly from the Driver Station (handy duringactual competitions):

python3 tornado_server.py --dashboard

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

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

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

Contributing new changes

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

  1. Fork this git repositoryto 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 usefulJavaScript 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, whichwas instrumental to winning an Innovation In Control award at the 2015 GreaterDC Regional.

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp