rakusan2 / FRC-NT-Client

WPI NetworkTables Client for Node
https://www.npmjs.com/package/wpilib-nt-client
MIT License
21 stars 5 forks source link

Is it possible to connect to a specific network table? #7

Open ScarletMetal opened 5 years ago

ScarletMetal commented 5 years ago

Hello, I'm trying to incorporate the use of this library into one of my project and there is one thing that I don't understand - how do I connect to a specific NetworkTable? In my team's code we use a number of different tables (ImageProcessing, Preferences Etc) and I need to connect to different tables depending on the situations.

Thank you for your time

rakusan2 commented 5 years ago

Thank you for asking

First there are 3 things to know

  1. Each bot has only a single Network Tables server
  2. In its simplest form a Network Tables server is a key-value database
    • Where in 3.0 Flags were added to each key to enable persistence
  3. This library is very simple in that it is only meant to be a connection and translation layer between the server and your application

Now for how Keys work

Each Key can basically be thought of as a linux path to a file.

For example: /SmartDashboard/Controller/MoveY /------Table-----/-SubTable-/-Variable Name

In addition there is also a special Variable Name ~type~ which the dashboard utilizes to specify how the SubTables are shown.