RobotPy web-based low fidelity FRC robot simulation package
Project description
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).
Documentation
Documentation can be found at http://pynetworktables2js.readthedocs.org/
Installation
Make sure to install python 2 or 3 on your computer, and on Windows you can execute:
py -m pip install pynetworktables2js
On Linux/OSX you can execute:
pip install pynetworktables2js
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
There are two example servers distributed with pynetworktables2js, one that uses tornado, and one that uses aiohttp. Either one should work.
No-copy server
You can just distribute your HTML files, and run a pynetworktables server using the following command from inside the directory:
python -m pynetworktables2js
Or on Windows:
py -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.
Customized python server
Go to the ‘example’ directory distributed with pynetworktables2js, and run:
python tornado_server.py --robot 127.0.0.1
If you want to try this out with your current robot, you can do:
python 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):
python 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:
Fork this git repository to your github account
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Add some feature')
Push to the branch (git push -u origin my-new-feature)
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pynetworktables2js-2015.2.3.tar.gz
.
File metadata
- Download URL: pynetworktables2js-2015.2.3.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c66767dc05c8e4e8bf3698559984435799c9c26f54e33f5bee53a18ad7dff5c |
|
MD5 | 8be49b12f8a7bfc0e02ad9d9314be80e |
|
BLAKE2b-256 | 80d3f116bfa42ca33cbf3b9da1f74b5cf68b462b87314f4380f8a999c5719c07 |