View Single Post
  #6   Spotlight this post!  
Unread 01-03-2016, 22:25
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 217
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Vision With GRIP

I now have the problem of connecting to GRIP. GRIP seems to be the server and in order to access the variables, you need to use the ClientMode. The problem with that is you need the IP of the server. GRIP is going to be running on our Driver Station and the IP will not stay the same.

How am I supposed to connect to GRIP?

Here is the working code(Just using GRIP locally by setting both to 127.0.0.1):
Code:
import sys
import time
from networktables import NetworkTable
import networktables
 
ip = "127.0.0.1"
 
NetworkTable.setIPAddress(ip)
NetworkTable.setClientMode()
NetworkTable.initialize()
 
table = NetworkTable.getTable('/GRIP/myContoursReport')
default = networktables.NumberArray()
 
while True:
    try:
        table.retrieveValue('centerX', default)
    except KeyError:
        pass
    else:
        print default
    time.sleep(1)
Thanks!
Reply With Quote