View Single Post
  #1   Spotlight this post!  
Unread 12-02-2012, 01:22
slibert slibert is offline
Software Mentor
AKA: Scott Libert
FRC #2465 (Kauaibots)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2005
Location: Kauai, Hawaii
Posts: 347
slibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud of
NetworkTable : Tables, SubTables

We are developing cRio software in C++, and using SmartDashboard with a custom Java extension we are developing. Our goal is to have the C++ cRio code detect targets, and display information within a custom WPICameraExtension on the smart dashboard.

On the robot, we create a "Camera" table via NetworkTable::GetTable("Camera"). So far, so good.

Our next step: creating a "SubTable" for each detected Target (via NetworkTable::GetSubTable("Target<TargetNum>").

Some questions are coming up:

1) Within the C++ code, it's not clear how to *create* a SubTable. Do we "new" a NetworkTable and then use PutSubTable()? Or do we invoke NetworkTable::GetTable(subtablename) and then PutSubTable() w/the table that is returned?

2) On the SmartDashboard side, we are retrieving the "Camera" Table via Robot.getTable().getTable("Camera"). Is that correct? The hierarchy does not seem parallel between the Java and C++ code (e.g., the Java API seems to imply a "top-level, unnamed" table, whereas the C++ API seems to imply a set of named tables at the top-level.

3) If we wanted to retrieve a sub-table on the SmartDashboard side, would we retrieve it via:

Robot.getTable().getTable("Camera").getSubTable("T arget<targetnum>")

Or

Robot.getTable().getTable("Target<targetnum>")

I would prefer to use sub-tables, as it seems a more clear way of expressing the "sub-tables" for detected targets. But I'm unclear as to the appropriate method for creating sub-tables before calling "putSubTable()".

Perhaps some diagram showing the hierarchy of "top-level-table", "named table" and "named sub-table" would be helpful.... Or perhaps a code sample?
Reply With Quote