Go to Post Right, play to win. Play to win the event or play to win one match? This year, unfortunately, they are not the same thing. - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2017, 12:18
arushshah1 arushshah1 is offline
Registered User
FRC #6203
 
Join Date: Mar 2016
Location: Hackensack, NJ
Posts: 15
arushshah1 is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2017, 12:21
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,108
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Network Tables Issue

Quote:
Originally Posted by arushshah1 View Post
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.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2017, 12:33
arushshah1 arushshah1 is offline
Registered User
FRC #6203
 
Join Date: Mar 2016
Location: Hackensack, NJ
Posts: 15
arushshah1 is an unknown quantity at this point
Re: Network Tables Issue

Is there a way to check whether or not the connection has been made?
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2017, 12:41
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,108
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Network Tables Issue

Quote:
Originally Posted by arushshah1 View Post
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
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2017, 18:08
arushshah1 arushshah1 is offline
Registered User
FRC #6203
 
Join Date: Mar 2016
Location: Hackensack, NJ
Posts: 15
arushshah1 is an unknown quantity at this point
Re: Network Tables Issue

Nice, thank you!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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