本文整理匯總了Python中networktables.NetworkTable.initialize方法的典型用法代碼示例。如果您正苦於以下問題:Python NetworkTable.initialize方法的具體用法?Python NetworkTable.initialize怎麽用?Python NetworkTable.initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類networktables.NetworkTable
的用法示例。
在下文中一共展示了NetworkTable.initialize方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
NetworkTable.setIPAddress('10.19.37.2')
NetworkTable.setClientMode()
NetworkTable.initialize()
sd = NetworkTable.getTable('SmartDashboard')
#ms_list = []
while True:
time.sleep(0.1)
start_time = datetime.now()
# returns the elapsed milliseconds since the start of the program
vision(sd)
dt = datetime.now() - start_time
ms = (dt.days * 24 * 60 * 60 + dt.seconds) * 1000 + dt.microseconds / 1000.0
#ms_list.append(ms)
print ms
#print np.mean(ms_list)
cv2.destroyAllWindows()
示例2: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
NetworkTable.setIPAddress('10.19.37.2')
NetworkTable.setClientMode()
NetworkTable.initialize()
sd = NetworkTable.getTable('SmartDashboard')
#ms_list = []
while True:
time.sleep(0.1)
start_time = datetime.now()
# returns the elapsed milliseconds since the start of the program
vision(sd)
dt = datetime.now() - start_time
ms = (dt.days * 24 * 60 * 60 + dt.seconds) * 1000 + dt.microseconds / 1000.0
print ms
cv2.destroyAllWindows()
示例3: init_filters
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def init_filters( self, filters ):
if filters != "": # if there are actually filters given,
filters = filters.split(" ") # split the filters by spaces, "red blue" => [ "red", "blue" ]
self.filters = filters # set the global filters
for i in filters: # cycle throught the filters
self.init_trackbar( i ) # initializing a trackbar for each filter
self.limits[ i ] = [ self.get_upper_trackbar( i ) , self.get_lower_trackbar( i ) ] # add a limit trackbar values
self.interactive = True # make the session interactive
else:
self.filters = [] # make filters empty when no filters given
self.interactive = False # if no filters were given, the session is not interactive
# Initialize trackbar with window name
# Usage: self.init_trackbar( "window_name" )
# will make a window with the given name and initialize trackbars that
# represent the HSV minimum and maximum values to filter
示例4: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
print('Initializing NetworkTables')
NetworkTable.setClientMode()
NetworkTable.setIPAddress('localhost')
NetworkTable.initialize()
print('Creating video capture')
cap = cv2.VideoCapture(0)
print('Creating pipeline')
pipeline = GripPipeline()
print('Running pipeline')
while cap.isOpened():
have_frame, frame = cap.read()
if have_frame:
pipeline.process(frame)
extra_processing(pipeline)
print('Capture closed')
示例5: __init__
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def __init__(self, options):
NetworkTable.setIPAddress(options.ip)
NetworkTable.setClientMode()
NetworkTable.initialize()
logger.debug('Networktables Initialized')
self.current_session = None
self.sd = NetworkTable.getTable('/')
self.sd.addConnectionListener(self)
with open(options.config) as config_file:
self.config = json.load(config_file)
self.run()
示例6: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
NetworkTable.setTeam('0000') # TODO set your team number
NetworkTable.initialize()
cap = cv2.VideoCapture(0)
pipeline = GripPipeline()
while True:
ret, frame = cap.read()
if ret:
pipeline.process(frame) # TODO add extra parameters if the pipeline takes more than just a single image
extra_processing(pipeline)
示例7: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
NetworkTable.setTeam(1699)
NetworkTable.initialize(server="10.16.99.2")
cap = cv2.VideoCapture(0)
pipeline = Pipeline()
while True:
ret, frame = cap.read()
if ret:
pipeline.process(frame) # TODO add extra parameters if the pipeline takes more than just a single image
extra_processing(pipeline)
示例8: __init__
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def __init__( self, capture, log, settings ):
# port="",filters="", hsv=False, original=True, in_file="", out_file="", display=True
self.limits = {}
# Pass the log object
self.log = log
log.init( "initializing saber_track Tracker" )
self.settings = settings
# If the port tag is True, set the
if settings["port"] != "":
logging.basicConfig( level=logging.DEBUG )
NetworkTable.setIPAddress( settings["port"] )
NetworkTable.setClientMode( )
NetworkTable.initialize( )
self.smt_dash = NetworkTable.getTable( "SmartDashboard" )
# initialize the filters. If the filter is the default: "", it will not create trackbars for it.
self.init_filters( settings["filters"] )
# Deal with inputs and outputs
self.settings["out_file"] = str( self.settings["out_file"] ) # set the file that will be written on saved
if settings["in_file"] != "":
self.log.init( "Reading trackfile: " + settings["in_file"] + ".json" )
fs = open( name + ".json", "r" ) # open the file under a .json extention
data = json.loads( fs.read() )
self.limits.update( data )
fs.close( )
# Localize the caputure object
self.capture = capture
# if there are any color limits (Upper and Lower hsv values to track) make the tracking code runs
self.track = len( self.limits ) > 0
self.log.info( "Tracking: " + str(self.track) )
# The self.init_filters( filters ) function will take a string of filters and break it up by spaces
# Each whitespace isolated string will become the name of a limit and trackbar.
# Example, the self.init_filters( "hello world") would split the string into two windows, "hello" and "world"
# The windows will be trackbars and will get their own tracking bounding box, tag, and binary color window
示例9: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
print('Initializing NetworkTables')
#TODO: change to ip address for your roboRIO
NetworkTable.setIPAddress("10.52.54.98") #IP address of roboRIO
NetworkTable.setClientMode()
NetworkTable.initialize()
print('Creating video capture')
#TODO: pick input method and set address for IP camera
#USB Camera
cap = cv2.VideoCapture(0)
#IP Camera
#cap = cv2.VideoCapture("http://10.52.54.3/mjpg/video.mjpg") #address of video stream
bytes = ''
first = False
print('Creating pipeline')
pipeline = GripPipeline()
print('Running pipeline')
while cap.isOpened():
have_frame, frame = cap.read()
if have_frame:
pipeline.process(frame)
extra_processing(pipeline)
print('Capture closed')
示例10: main
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def main():
print('Initializing NetworkTables')
NetworkTable.setIPAddress("10.52.55.98")
NetworkTable.setClientMode()
NetworkTable.initialize()
print('Creating video capture')
cap = cv2.VideoCapture("http://10.52.55.3/mjpg/video.mjpg")
print("here")
bytes = ''
first = False
print('Creating pipeline')
pipeline = GripPipeline()
print('Running pipeline')
while cap.isOpened():
have_frame, frame = cap.read()
if have_frame:
pipeline.process(frame)
extra_processing(pipeline)
print('Capture closed')
示例11: __init__
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def __init__(self):
print "Initializing NetworkTables..."
NetworkTable.setClientMode()
NetworkTable.setIPAddress("roborio-4761-frc.local")
NetworkTable.initialize()
self.table = NetworkTable.getTable("vision")
print "NetworkTables initialized!"
示例12: init_networktables
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def init_networktables():
#TODO: Check to see if NetworkTables is already initialized
if not using_networktables:
raise Exception("Attempted to initialize NetworkTables while NetworkTables is disabled!")
NetworkTable.setIPAddress(args.networktables_ip)
NetworkTable.setClientMode()
NetworkTable.initialize()
global table
table = NetworkTable.getTable("vision")
log.info("Initialized NetworkTables")
# Loads dict into networktables
示例13: init_network_tables
# 需要導入模塊: from networktables import NetworkTable [as 別名]
# 或者: from networktables.NetworkTable import initialize [as 別名]
def init_network_tables(ip='127.0.0.1'):
"""Initialize NetworkTables as a client to receive and send values
:param ip: ip address or hostname of the server
"""
NetworkTable.setIPAddress(ip)
NetworkTable.setClientMode()
NetworkTable.initialize()
LOG.info('Network Tables connected as client to {}'.format(ip))
# TODO receiver and publisher can probably be combined into one cozy rx.Subject