Quote:
Originally Posted by team-4480
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.