|
|
|
| Honey, will you tether your soul to mine? |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Creating a custom NetworkTable?
Like a number of other teams, Team 4050 is getting into vision processing this year for the first time. Our processing is pretty rudimentary but so far seems really reliable in picking out the gear lift.
Again, like others, we're looking to run our vision code on a Raspberry Pi. (We were originally planning to use a Jetson, but that introduced more hurdles.) However, the issue that we have run into is our complete inexperience with NetworkTables. We want to create a custom NetworkTable that contains the data that the RPi needs to communicate to the roboRIO so that it knows how to control the robot (e.g., turn left, go forward at 50% speed, etc.) Our lead programmer and I have spent a bunch of time researching NetworkTables; however, in every example that we've found, it assumes that the NT already exists. We feel we understand the client side of things. What we need to know is how to create the NetworkTable so that it's there for the client to update. Any suggestions, advice, or examples would be greatly appreciated. |
|
#2
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
Networktables.getTable() will create a new table with that name if it doesn't already exist. Ditto for getSubtable()
|
|
#3
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
Quote:
Code:
NetworkTable.setClientMode(); NetworkTable.setTeam(xxxx); NetworkTable.initialize(); From that point, you can call Code:
NetworkTable table = NetworkTable.getTable("Table_Name_Here");
Note that on the robot, NetworkTables is already set up, so you only need to call the getTable function. |
|
#4
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
Quote:
Thanks to a post in another thread (https://www.chiefdelphi.com/forums/s...17#post1524417) I also figured out that I didn't have the "Windows/amd64" ntcore library in my NetworkTables.jar. (I'm currently working on my Win7 laptop.) I got that resolved. I now can successfully write to a NetworkTable and see the new tables and values in Outline Viewer. This just made my week! Thank you! |
|
#5
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
If you were using python (a lot of teams find OpenCV easier to use in python), the pynetworktables documentation has a lot of examples of various networktables things you can look at: http://robotpy.readthedocs.io/projec.../examples.html
Curiously enough, I hadn't ever thought about the fact that one might think that a 'table' needs to be created. I'll add a note about that to our docs. |
|
#6
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
Quote:
As far as the table creation, I work with databases in my 8-5, so in my mind, a table doesn't exist unless you create it explicitly. Kind of funny how experience can help determine perspectives. |
|
#7
|
|||
|
|||
|
Re: Creating a custom NetworkTable?
Quote:
For example, getTable("/").putNumber("foo/bar", 5) and getTable("/foo").putNumber("bar", 5) are exactly equivalent (both set the key "/foo/bar" to 5). |
|
#8
|
||||
|
||||
|
Re: Creating a custom NetworkTable?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|