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


Python NetworkTable.initialize方法代码示例

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


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

示例1: init_networktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def init_networktables(ipaddr):
    logger.info("Connecting to robot %s" % ipaddr)
    Networktable.setIPAddress(ipaddr)
    Networktable.setClientMode()
    Networktable.initialize()
    logger.info("Initialized networktables")
    logger.info("Waiting...")
开发者ID:DrWateryCat,项目名称:Python-HTML5-NetworkTables-Dashboard,代码行数:9,代码来源:main.py

示例2: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
    def __init__(self, fakerobot):
        try:
            if fakerobot:
                NetworkTable.setIPAddress("localhost")
            else:
                NetworkTable.setIPAddress("roboRIO-4915-FRC")
            NetworkTable.setClientMode()
            NetworkTable.initialize()

            self.sd = NetworkTable.getTable("SmartDashboard")
            self.visTable = self.sd.getSubTable("Vision")
            self.connectionListener = ConnectionListener()
            self.visTable.addConnectionListener(self.connectionListener)
            self.visTable.addTableListener(self.visValueChanged)
            self.targetState = targetState.TargetState(self.visTable)
            self.targetHigh = True
            self.autoAimEnabled = False
            self.imuHeading = 0
            self.fpsHistory = []
            self.lastUpdate = time.time()

        except:
            xcpt = sys.exc_info()
            print("ERROR initializing network tables", xcpt[0])
            traceback.print_tb(xcpt[2])
开发者ID:KNX32542,项目名称:2016-Stronghold,代码行数:27,代码来源:robotCnx.py

示例3: initNetworktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def initNetworktables():
    logging.basicConfig(level=logging.DEBUG)         # to see messages from networktables
    NetworkTable.setIPAddress('127.0.0.1')
    # NetworkTable.setIPAddress('roborio-5260.local')
    NetworkTable.setClientMode()
    NetworkTable.initialize()
    return NetworkTable.getTable('Pi')
开发者ID:greg7mdp,项目名称:frc-shooter-software,代码行数:9,代码来源:towertrack.py

示例4: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def main():
    cap = cv2.VideoCapture(1)
    
    #Network Tables Setup
    logging.basicConfig(level=logging.DEBUG)
    NetworkTable.setIPAddress('10.32.56.2')
    NetworkTable.setClientMode()
    NetworkTable.initialize()
    nt = NetworkTable.getTable('SmartDashboard')

    while cap.isOpened():

        _,frame=cap.read()
        hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
        #Range for green light reflected off of the tape. Need to tune.
        lower_green = np.array(constants.LOWER_GREEN, dtype=np.uint8)
        upper_green = np.array(constants.UPPER_GREEN, dtype=np.uint8)

        #Threshold the HSV image to only get the green color.
        mask = cv2.inRange(hsv, lower_green, upper_green)
        #Gets contours of the thresholded image.
        _,contours, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
        #Draw the contours around detected object
        cv2.drawContours(frame, contours, -1, (0,0,255), 3)

        #Get centroid of tracked object.
        #Check to see if contours were found.
        if len(contours)>0:
            #find largest contour
            cnt = max(contours, key=cv2.contourArea)
            #get center
            center = get_center(cnt)
            cv2.circle(frame, center, 3, (0,0,255), 2)
            if(center[0] != 0 and center[1]!=0):
                center_str_x = "x = "+str(center[0])
                center_str_y = "y = "+str(center[1])
                font = cv2.FONT_HERSHEY_SIMPLEX
                cv2.putText(frame, "Center", constants.TEXT_COORDINATE_1, font, 0.7, (0,0,255), 2)
                cv2.putText(frame, center_str_x, constants.TEXT_COORDINATE_2, font, 0.7, (0,0,255), 2)
                cv2.putText(frame, center_str_y, constants.TEXT_COORDINATE_3, font, 0.7, (0,0,255), 2)
                angle, direction = get_offset_angle(center[0], center[1])
                cv2.putText(frame, "Angle: "+str(angle),constants.TEXT_COORDINATE_4, font, 0.7, (0,0,255), 2)
                nt.putNumber('CameraAngle', angle)
                cv2.putText(frame, "Turn "+direction, constants.TEXT_COORDINATE_5, font, 0.7, (0,0,255), 2)
                if direction == right:
                    nt.putNumber('Direction', 0)
                else:
                    nt.putNumber('Direction', 1)

        #show image
        cv2.imshow('frame',frame)
        cv2.imshow('mask', mask)
        cv2.imshow('HSV', hsv)

        #close if delay in camera feed is too long
        k = cv2.waitKey(1) & 0xFF
        if k == 27:
            break

    cv2.destroyAllWindows()
开发者ID:apache8080,项目名称:FRC_VisionTracking_2016,代码行数:62,代码来源:tower_tracking.py

示例5: init_networktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def init_networktables(ipaddr):

    logger.info("Connecting to networktables at %s" % ipaddr)
    NetworkTable.setIPAddress(ipaddr)
    NetworkTable.setClientMode()
    NetworkTable.initialize()
    logger.info("Networktables Initialized")
开发者ID:Retro3223,项目名称:dashboard2016,代码行数:9,代码来源:tornado_server.py

示例6: __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!"
开发者ID:Team4761,项目名称:2016-Vision,代码行数:9,代码来源:network.py

示例7: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
 def __init__(self, ip, name):
     NetworkTable.setIPAddress(ip)
     NetworkTable.setClientMode()
     NetworkTable.initialize()
     self.visionNetworkTable = NetworkTable.getTable(name)
     if constants.SENDTOSMARTDASHBOARD:
         constants.smartDashboard = NetworkTable.getTable("SmartDashboard")
开发者ID:core2062,项目名称:CORE2016-VISION,代码行数:9,代码来源:networkTableManager.py

示例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) )
开发者ID:Sabercat-Robotics-4146-FRC,项目名称:Vision_Processing-2016,代码行数:37,代码来源:saber_track.py

示例9: setupVisionTable

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def setupVisionTable():
	global visionTable
	NetworkTable.setIPAddress("10.46.69.21")
	NetworkTable.setClientMode()
	NetworkTable.initialize()
	visionTable = NetworkTable.getTable("vision")
	setRunVision(False)
	turnOffLight()
开发者ID:frc4669,项目名称:ESMJetson2016,代码行数:10,代码来源:Vision.py

示例10: 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))
开发者ID:teamresistance,项目名称:remho,代码行数:10,代码来源:network.py

示例11: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
 def __init__(self):
     
     NetworkTable.initialize()
     self.tf = TargetFinder.TargetFinder()
     self.tf.enabled = True
     
     cv2.namedWindow('img')
 
     for s in self.settings:
         self._create_trackbar(s)
开发者ID:frc2423,项目名称:2016,代码行数:12,代码来源:test.py

示例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")
开发者ID:Team4761,项目名称:2016-Vision,代码行数:12,代码来源:vision.py

示例13: setup

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def setup(robot_ip, table_id, connection_listener_class=None):
    print("Connecting to NetworkTable '{}' on Robot at '{}'".format(table_id, robot_ip))
    NetworkTable.setIPAddress(robot_ip)
    NetworkTable.setClientMode()
    NetworkTable.initialize()

    table = NetworkTable.getTable(table_id)

    if connection_listener_class:
        table.addConnectionListener(connection_listener_class())

    return table
开发者ID:RavenRoboticsTeam1288,项目名称:Remige,代码行数:14,代码来源:networktables_client.py

示例14: init_networktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def init_networktables(options):

    if options.dashboard:
        logger.info("Connecting to networktables in Dashboard mode")
        NetworkTable.setDashboardMode()
    else:
        logger.info("Connecting to networktables at %s", options.robot)
        NetworkTable.setIPAddress(options.robot)
        NetworkTable.setClientMode()
    
    NetworkTable.initialize()
    logger.info("Networktables Initialized")
开发者ID:RobotsByTheC,项目名称:WebDashboard2016,代码行数:14,代码来源:aiohttp_server.py

示例15: init_filter

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import initialize [as 别名]
def init_filter():
    '''Function called by mjpg-streamer to initialize the filter'''
    
    # Connect to the robot
    NetworkTable.setIPAddress('127.0.0.1')
    NetworkTable.setClientMode()
    NetworkTable.initialize()
    
    #os.system("v4l2-ctl -d /dev/video1 -c exposure_auto=1 -c exposure_absolute=20")
    #os.system("v4l2-ctl -d /dev/video2 -c exposure_auto=1 -c exposure_absolute=10")
    
    filter = TargetFinder()
    return filter.quad_normals
开发者ID:frc2423,项目名称:2016,代码行数:15,代码来源:TargetFinder.py


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