Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Network Tables Issue (http://www.chiefdelphi.com/forums/showthread.php?t=154820)

arushshah1 06-02-2017 12:18

Network Tables Issue
 
I'm trying to create a PID visualization system using python and matplotlib. I'm putting the values of the joystick on the smart dashboard but I'm unable to get the value through python using pynetworktables. Here's my code to access the values.

Code:

from networktables import NetworkTable

NetworkTable.setIPAddress("roboRIO-6203-frc.local")
NetworkTable.setClientMode()
NetworkTable.initialize()

table = NetworkTable.getTable("SmartDashboard")
left = table.getNumber("left")

I get the error KeyError: '/SmartDashboard/left'

I'm on the team network and I've confirmed that "left" is being published to the Smart Dashboard. Any reason why this isn't working?

virtuald 06-02-2017 12:21

Re: Network Tables Issue
 
Quote:

Originally Posted by arushshah1 (Post 1641094)
I'm trying to create a PID visualization system using python and matplotlib. I'm putting the values of the joystick on the smart dashboard but I'm unable to get the value through python using pynetworktables. Here's my code to access the values.

Code:

from networktables import NetworkTable

NetworkTable.setIPAddress("roboRIO-6203-frc.local")
NetworkTable.setClientMode()
NetworkTable.initialize()

table = NetworkTable.getTable("SmartDashboard")
left = table.getNumber("left")

I get the error KeyError: '/SmartDashboard/left'

I'm on the team network and I've confirmed that "left" is being published to the Smart Dashboard. Any reason why this isn't working?

NetworkTables values aren't available instantly, it takes a short period of time to connect to the server and synchronize.

arushshah1 06-02-2017 12:33

Re: Network Tables Issue
 
Is there a way to check whether or not the connection has been made?

virtuald 06-02-2017 12:41

Re: Network Tables Issue
 
Quote:

Originally Posted by arushshah1 (Post 1641116)
Is there a way to check whether or not the connection has been made?

Yes. Have you read the documentation or looked through the examples yet? I recommend doing so.

http://robotpy.readthedocs.io/projec...stener-example

arushshah1 06-02-2017 18:08

Re: Network Tables Issue
 
Nice, thank you!


All times are GMT -5. The time now is 22:36.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi