当前位置: 首页>>代码示例>>Python>>正文


Python NetworkTable.setClientMode方法代码示例

本文整理汇总了Python中networktables.NetworkTable.setClientMode方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkTable.setClientMode方法的具体用法?Python NetworkTable.setClientMode怎么用?Python NetworkTable.setClientMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在networktables.NetworkTable的用法示例。


在下文中一共展示了NetworkTable.setClientMode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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() 
开发者ID:Elysium1937,项目名称:Millennium-Eye,代码行数:20,代码来源:Falafel.py

示例2: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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() 
开发者ID:Elysium1937,项目名称:Millennium-Eye,代码行数:18,代码来源:Falafel Vision Processing.py

示例3: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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') 
开发者ID:FRC5254,项目名称:GRIP-Raspberry-Pi-3,代码行数:22,代码来源:usb_vision.py

示例4: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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() 
开发者ID:frc1418,项目名称:RobotRecorder,代码行数:17,代码来源:recorder.py

示例5: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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 
开发者ID:Sabercat-Robotics-4146-FRC,项目名称:Vision_Processing-2016,代码行数:42,代码来源:saber_track.py

示例6: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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') 
开发者ID:FRC5254,项目名称:GRIP-Raspberry-Pi-3,代码行数:33,代码来源:sample_vision.py

示例7: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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') 
开发者ID:FRC5254,项目名称:GRIP-Raspberry-Pi-3,代码行数:32,代码来源:ip_vision.py

示例8: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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!" 
开发者ID:Team4761,项目名称:2016-Vision,代码行数:9,代码来源:network.py

示例9: init_networktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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 
开发者ID:Team4761,项目名称:2016-Vision,代码行数:14,代码来源:vision.py

示例10: init_network_tables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import setClientMode [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 
开发者ID:teamresistance,项目名称:remho,代码行数:13,代码来源:network.py


注:本文中的networktables.NetworkTable.setClientMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。