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:
-
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?
-
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.
-
If we wanted to retrieve a sub-table on the SmartDashboard side, would we retrieve it via:
Robot.getTable().getTable(“Camera”).getSubTable(“Target<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?