Go to Post It is a difficult balancing act - we're engineers because we like to solve problems, and to take a step back and let someone else solve it, with what may be a poorer solution, is darn hard. - DonRotolo [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
  #3   Spotlight this post!  
Unread 12-05-2016, 22:08
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Python Network Tables Raspberry Pi 2

Quote:
Originally Posted by team-4480 View Post
In the Driver Station example you linked, the IP is set through sys.arg. For me, I just skip that and set the IP directly like this:
Code:
NetworkTable.setIPAddress("10.XX.XX.XX")#Your IP goes here
So the entire code would look like this if you were using the example(This is untested but is similar to what I used before):
Code:
import time
from networktables import NetworkTable

# To see messages from networktables, you must setup logging
import logging
logging.basicConfig(level=logging.DEBUG)


NetworkTable.setIPAddress("10.XX.XX.XX")#Change the address to your own
NetworkTable.setClientMode()
NetworkTable.initialize()

sd = NetworkTable.getTable("SmartDashboard")

i = 0
while True:
    try:
        print('robotTime:', sd.getNumber('robotTime'))
    except KeyError:
        print('robotTime: N/A')

    sd.putNumber('dsTime', i)
    time.sleep(1)
    i += 1
Just makes sure to change IP address and that should be a working example. Let me know if it still doesn't work!
So if I am running this on a raspberry pi 2 I would put the ip adress of the roboRio? If so should I change the roboRio to a static IP address such as 10.xx.yy.?? --> xx.yy would be team name but what would the ?? be at the end?

Thanks for you help.
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 08:24.

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