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


Python NetworkTable.getTable方法代码示例

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


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

示例1: main

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [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 getTable [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: extra_processing

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def extra_processing(pipeline):
    """
    Performs extra processing on the pipeline's outputs and publishes data to NetworkTables.
    :param pipeline: the pipeline that just processed an image
    :return: None
    """
    center_x_positions = []
    center_y_positions = []
    widths = []
    heights = []

    # Find the bounding boxes of the contours to get x, y, width, and height
    for contour in pipeline.filter_contours_output:
        x, y, w, h = cv2.boundingRect(contour)
        center_x_positions.append(x + w / 2)  # X and Y are coordinates of the top-left corner of the bounding box
        center_y_positions.append(y + h / 2)
        widths.append(w)
        heights.append(y)
    # Publish to the '/vision' network table
    table = NetworkTable.getTable("/vision")
    table.putValue("centerX", NumberArray.from_list(center_x_positions))
    table.putValue("centerY", NumberArray.from_list(center_y_positions))
    table.putValue("width", NumberArray.from_list(widths))
    table.putValue("height", NumberArray.from_list(heights)) 
开发者ID:FRC5254,项目名称:GRIP-Raspberry-Pi-3,代码行数:26,代码来源:sample_vision.py

示例4: extra_processing

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def extra_processing(pipeline):
    """
    Performs extra processing on the pipeline's outputs and publishes data to NetworkTables.
    :param pipeline: the pipeline that just processed an image
    :return: None
    """
    center_x_positions = []
    center_y_positions = []
    widths = []
    heights = []

    # Find the bounding boxes of the contours to get x, y, width, and height
    for contour in pipeline.filter_contours_output:
        x, y, w, h = cv2.boundingRect(contour)
        center_x_positions.append(x + w / 2)  # X and Y are coordinates of the top-left corner of the bounding box
        center_y_positions.append(y + h / 2)
        widths.append(w)
        heights.append(y)
    print(center_x_positions)
    # Publish to the '/vision' network table
    table = NetworkTable.getTable("/vision")
    table.putValue("centerX", NumberArray.from_list(center_x_positions))
    table.putValue("centerY", NumberArray.from_list(center_y_positions))
    table.putValue("width", NumberArray.from_list(widths))
    table.putValue("height", NumberArray.from_list(heights)) 
开发者ID:FRC5254,项目名称:GRIP-Raspberry-Pi-3,代码行数:27,代码来源:ip_vision.py

示例5: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def __init__(self, table, silent=False):
        super().__init__()
        LOG.info('NetworkTablePublisher initialized for table "{}"'.format(table))

        try:
            NetworkTable.checkInit()
        except RuntimeError:
            # An exception is raised if NetworkTables was initialized
            pass
        else:
            # Since no exception was raised, NetworkTables is not initialized
            error = 'NetworkTables is not initialized. Call "init_network_tables()" '
            error += 'prior to instantiating this class.'
            raise RuntimeError(error)

        # For access by other methods for debugging
        self.table_name = table

        # We'll be pushing our own values to this table
        self.nt = NetworkTable.getTable(table)

        # Don't log anything to the console if silent
        self.silent = silent 
开发者ID:teamresistance,项目名称:remho,代码行数:25,代码来源:network.py

示例6: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [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

示例7: drive_distance

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def drive_distance(self, initial_call):
        if initial_call:
            self.drive.field_centric = False
            self.sd = NetworkTable.getTable('SmartDashboard')
            self.tracker.enable()

        self.y_ctrl.move_to(self.drive_distance_feet)
        self.sd.putNumber('TESTING: ', self.y_ctrl.get_position())

        if self.y_ctrl.is_at_location():
            self.next_state('finish') 
开发者ID:frc1418,项目名称:2017-robot,代码行数:13,代码来源:auto_tests.py

示例8: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def __init__(self):
        target = None

        nt = NetworkTable.getTable('/camera')
        nt.addTableListener(self._on_target, True, 'target')

        self.aimed_at_angle = None
        self.aimed_at_x = None 
开发者ID:frc1418,项目名称:2017-robot,代码行数:10,代码来源:auto_align.py

示例9: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def __init__(self):
        self.size = None
        self.thresh_low = np.array([self.thresh_hue_lower, self.thresh_sat_lower, self.thresh_val_lower], dtype=np.uint8)
        self.thresh_high = np.array([self.thresh_hue_high, self.thresh_sat_high, self.thresh_val_high], dtype=np.uint8)

        self.nt = NetworkTable.getTable('/camera/processor') 
开发者ID:frc1418,项目名称:2017-robot,代码行数:8,代码来源:image_processor.py

示例10: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def __init__(self, dio_number=0):
        self.range_finder_counter = wpilib.Counter(dio_number, mode=wpilib.Counter.Mode.kPulseLength)
        self.range_finder_counter.setSemiPeriodMode(highSemiPeriod=True)
        self.range_finder_counter.setSamplesToAverage(10)
        self._smoothed_d = 0.0
        self.sd = NetworkTable.getTable('SmartDashboard') 
开发者ID:thedropbears,项目名称:pysteamworks,代码行数:8,代码来源:range_finder.py

示例11: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [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

示例12: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [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

示例13: init_networktables

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [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

示例14: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def __init__(self):
        self.nt = NetworkTable.getTable('/camera')
        
        #Cameras
        self.piston_cam = cs.UsbCamera('Piston Cam', 0)
        self.piston_cam.setVideoMode(cs.VideoMode.PixelFormat.kMJPEG, 160, 120, 35) #160 vs. 120
        
        self.piston_cam.setExposureAuto()
        self.piston_cam.getProperty('backlight_compensation').set(5)
        
        #self.piston_cam.setExposureManual(35)
        #self.piston_cam.setBrightness(65)
        #test = self.piston_cam.getProperty("exposure_absolute")
        #print(self.piston_cam.getProperty("exposure_absolute"))
        
        
        self.piston_server = cs.MjpegServer('httpserver', 1181)
        self.piston_server.setSource(self.piston_cam)
        
        if self.secondary_cam:
            self.light_ring_cam = cs.UsbCamera('Light Ring Cam', 0)
            self.light_ring_cam.setVideoMode(cs.VideoMode.PixelFormat.kMJPEG, 320, 240, 20)
            
            # This only seems to affect automatic exposure mode
            # -> higher value means it lets more light in when facing a big light
            self.light_ring_cam.getProperty('backlight_compensation').set(5)
            
            #Image Processing
            self.cvsink = cs.CvSink('cvsink')
            self.cvsink.setSource(self.light_ring_cam)
            
            self.cvsource = cs.CvSource('cvsource', cs.VideoMode.PixelFormat.kMJPEG, 320, 240, 20)
            
            #Streaming Servers
            
            
            
            #self.ring_stream = cs.MjpegServer("ring server", 1182)
            #self.ring_stream.setSource(self.light_ring_cam)
            
            if self.STREAM_CV:
                self.cv_stream = cs.MjpegServer('cv stream', 1183)
                self.cv_stream.setSource(self.cvsource)
            
            #Blank mat
            self.img = np.zeros(shape=(320, 240, 3), dtype=np.uint8)
            
            self.processor = ImageProcessor() 
开发者ID:frc1418,项目名称:2017-robot,代码行数:50,代码来源:vision.py

示例15: setup

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import getTable [as 别名]
def setup(self):
        """
        Called after injection.
        """

        # Put all the modules into a dictionary
        self.modules = {
            'front_right': self.fr_module,
            'front_left': self.fl_module,
            'rear_left': self.rl_module,
            'rear_right': self.rr_module
        }

        self.sd = NetworkTable.getTable('SmartDashboard')

        self._requested_vectors = {
            'fwd': 0,
            'strafe': 0,
            'rcw': 0
        }

        self._requested_angles = {
            'front_right': 0,
            'front_left': 0,
            'rear_left': 0,
            'rear_right': 0
        }

        self._requested_speeds = {
            'front_right': 0,
            'front_left': 0,
            'rear_left': 0,
            'rear_right': 0
        }

        self._predicted_position = {
            'fwd': 0,
            'strafe': 0,
            'rcw': 0
        }

        self.predict_position = False

        # Variables that allow enabling and disabling of features in code
        self.allow_reverse = False
        self.squared_inputs = True
        self.snap_rotation = False
        self.wait_for_align = False
        self.threshold_input_vectors = True

        self.width = (22/12)/2
        self.length = (18.5/12)/2

        self.request_wheel_lock = False 
开发者ID:frc1418,项目名称:2017-robot,代码行数:56,代码来源:swervedrive.py


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