|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: How do I use NetworkTables' SubTables?
The TableViewer application does not use NetworkTable objects exclusively, there's quite a bit of back-end.
You know the names of your subsystems; is there a reason you can't just use ITable.getBoolean("NAME_HERE")? |
|
#2
|
|||
|
|||
|
Re: How do I use NetworkTables' SubTables?
I could, but it's kind of annoying to have to edit the driver station program every time I add or remove a subsystem. I'd much prefer dynamicism
|
|
#3
|
||||
|
||||
|
Re: How do I use NetworkTables' SubTables?
Once you connect, you can call NetworkTableClient.getEntryStore().list() to get a list of all the existing key names in your client's copy of the table.
A listener will give you updated keys and values as they come in, so even if you don't get all the existing key names when you first connect, you'll be able to build a complete list of keys pretty quickly if you are sending them out in periodic(). |
|
#4
|
||||
|
||||
|
Re: How do I use NetworkTables' SubTables?
I just reread your post, and something hit me...
Where are you trying to see what values are in the table? The FRC Driver Station software, the dashboard, or another team-written program running on the driver station PC? |
|
#5
|
||||
|
||||
|
Re: How do I use NetworkTables' SubTables?
...and I just checked, and dumping the keys at the beginning is unnecessary. When you connect, it appears you get update events for every existing value in the table, so you can just set up a listener and watch the names and values stream in...
|
|
#6
|
|||
|
|||
|
Re: How do I use NetworkTables' SubTables?
Quote:
Thanks again! |
|
#7
|
||||
|
||||
|
Re: How do I use NetworkTables' SubTables?
super straightforward: I implemented ITableListener, then called networkTableClient.addTableListener (this, true).
If you need to see connections and disconnections, implement IRemoteConnectionListener, and call networkTableClient.addTableListener(this,true). of course, you can have different objects for your listener (so you wouldn't use this), but hopefully you'll get the gist of it. your valueChanged() can be a little tricky: you could get back an array or just a single variable of unknown type, and you don't know ahead of time what it will be. I had a few instance operators in there to sort stuff out. For display purposes, this worked nice: Code:
if (o instanceof Object[]) {
for (Object o1 : (Object[]) o) {
sb.append("\t");
sb.append(o1.toString());
} else {
sb.append("\t");
sb.append(o.toString());
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|