Go to Post why does everyone think im so violent? - Kim Masi [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 18-05-2016, 23:13
dithier dithier is offline
Registered User
FRC #0501
 
Join Date: May 2016
Location: Manchester
Posts: 5
dithier is an unknown quantity at this point
Can't put data or get data from network table using pynetworktables

Hello,

This season we used RoboRealm for vision and used their network tables to talk to our RoboRio which is running Java and didn't have a problem. We decided to switch to opencv (python), but have not had any luck with pynetworktables even though we're following the examples online. We're using pynetwortables version 2015.3.4 and python 2.7.11 through Anaconda 4.0.0 on a Windows machine. The code relating to the network tables that we have is:

from networktables import NetworkTable
import logging
logging.basicConfig(level=logging.DEBUG)
NetworkTable.setIPAddress('10.5.1.11')
NetworkTable.setClientMode()
NetworkTable.initialize()

sd = NetworkTable.getTable("SmartDashboard")
sd.putNumber('Distance', distance)

(Note: in the regular code distance is a defined variable and SmartDashboard is the correct name of our dashboard)

When we run this we don't get an error, but our table doesn't get updated with the variable and its value. When we try getting numbers from the table with sd.getNumber('variable') then we get a keyError.

Additionally, if I run the code,stop it, and then run it again I get an error saying the table has already been initialized. However if I exit spyder (the IDLE) I'm using in between each time I run the code I don't get the error.

Does anyone have any idea why these things are happening and how to fix them?

Thanks in advance!
Reply With Quote
 


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 02:40.

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