View Single Post
  #1   Spotlight this post!  
Unread 13-02-2014, 16:19
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Unhappy Can I loop through a NetworkTable?

Hey! I'm trying to get NetworkTables working, and I have a list of things I want to send to the driver station. So I'm putting values into a Subtable on the robot, and trying to read them on the DS.

Is there a way to loop through every value in an ITable (which NetworkTables extends)? I assume there is, because the TableViewer program can do it (I compiled it but can't figure it out)

Here's the code I use for putting the info into the NetworkTable.

Code:
public void sendSubsystemInfo() {
        Vector list = Warp7Robot.subsystem.subsystemList;
        NetworkTable subtable = (NetworkTable) table.getSubTable("Subsystems");

        for (int i = 0; i < list.size(); i++) {
            Subsystem s = (Subsystem) list.elementAt(i);
            subtable.putBoolean(s.getName(), s.isEnabled());
        }
    }

Last edited by Aero : 13-02-2014 at 18:34.
Reply With Quote