from networktables import NetworkTable
NetworkTable.setIPAddress("roborio-4480-frc.local")
NetworkTable.setClientMode()
NetworkTable.initialize()
sd - NetworkTable.getTable("SmartDashboard")
while True:
try:
print('distance:', sd.getNumber('Clicky1'))
except KeyError:
print('distance: N/A')
So I get a KeyError for when it tries to pull “Clicky1”. Am I supposed to put more code on the robot to define the Clicky1 name? Or is there a way to make sure I am connected for sure to the robot? Sorry for all the questions.
If you’re using LabVIEW then it will not work until we upgrade the implementation to NetworkTables 3.0 (tracked at this github issue). However, it should work correctly with Java/C++ NetworkTables client/servers, despite the warning about incompatible revisions.
The global listener sample is great for figuring out if the other side has placed anything in NetworkTables.
Peter has been working on a full migration to NT 3.0, but it’s a lot of effort and not done yet. I talked to Peter last night and he said he was going to look at putting together something quick this week that would allow us to be compatible with LabVIEW, as the question has come up a few times.
Cool. I’ve pushed an alpha release of this (2016.0.0alpha1) to pypi in case someone else needs it – you’ll need to specify the --pre argument to pip in order to install it.