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


Python driver.Driver类代码示例

本文整理汇总了Python中driver.Driver的典型用法代码示例。如果您正苦于以下问题:Python Driver类的具体用法?Python Driver怎么用?Python Driver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, path=None):
        f = open(utils.NAME_FILE, 'r')
        car_name = f.read().strip()
        f.close()

        self.name = car_name
        self.frames = deque(maxlen=5) # frame = {'car_name': (x,y,theta,vx,vy,t), ...}
        self._state = CarState.IDLE
        self._kill = False
        self._last_frame_number = 0
        self._collision_worker = threading.Thread(target=self._detect_collisions)
        self._message_worker = threading.Thread(target=self._process_messages)
        self._main_worker = threading.Thread(target=self._process_collisions)
        self._collisions = dict() # {'car_name': collision_object ...}

        car_ips = dict()
        ips = utils.get_car_ips()

        for name, ip in ips.iteritems():
            if name != self.name:
                car_ips[name] = ip

        self._vicon_client = ViconClient(self.frames)
        self._talker = CarTalker(car_ips)
        self._driver = None

        if path:
            self._driver = Driver(path=path)
        else:
            self._driver = Driver()
开发者ID:jlucier,项目名称:6.S062-car-swarm,代码行数:30,代码来源:car.py

示例2: __init__

    def __init__(self, identifier, **kargs):
        Driver.__init__(self, identifier, **kargs)
        
        # self.identifier = identifier
        # self.host = host
        # self.device = device
        # self.port = port # XML-RPC port

        if 'host' not in kargs.keys():
            raise ValueError("host is requested")

        if 'devices' not in kargs.keys():
            raise ValueError("devices is requested")

        if 'port' not in kargs.keys():
            raise ValueError("port is requested")

        self.xmlrpc = xmlrpclib.ServerProxy("http://%s:%d/" % 
                                            (self.host, self.port))

        # Available gratings
        # TODO: add resolution, blaze angle, etc...
        self.gratings_properties = { 0: {'name': 'G0',
                                         'range': [200.0, 600.0]}, 
                                     1: {'name': 'G1',
                                         'range': [600.0, 1100.0]}, 
                                     2: {'name': 'G2',
                                         'range': [1100.0, 2600.0]}
                                     }


        self.gratings = self.gratings_properties.keys()
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:32,代码来源:monochromator_triax.py

示例3: register

    def register(self, bench):
        self.open()
        connected = self.is_connected()
        if not(connected):
            raise IOError("Keithley Multimeter not connected.")

        Driver.register(self, bench)
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:7,代码来源:keithley_ks.py

示例4: drive_after_test

    def drive_after_test(self):
        self.check_call([
            "codecov", "-X", "gcov", "--required",
            "--file", "./tests/coverage.xml"
        ])

        Driver.drive_after_test(self)
开发者ID:opadron,项目名称:scikit-build,代码行数:7,代码来源:circle_driver.py

示例5: doPort

 def doPort(self, e=None):
     """ open a serial port """
     if self.port == None:
         self.findPorts()
         self.ports += ['Gazebo']
     dlg = wx.SingleChoiceDialog(self,'Port (Ex. COM4 or /dev/ttyUSB0)','Select Communications Port',self.ports)
     #dlg = PortDialog(self,'Select Communications Port',self.ports)
     if dlg.ShowModal() == wx.ID_OK:
         if self.port != None:
             self.port.ser.close()
         print "Opening port: " + self.ports[dlg.GetSelection()]
         try:
             port_name = self.ports[dlg.GetSelection()]
             if port_name == 'Gazebo':
                 self.port = GazeboDriver()
             else:
             # TODO: add ability to select type of driver
             self.port = Driver(self.ports[dlg.GetSelection()], 38400, True) # w/ interpolation
             self.panel.port = self.port
             self.panel.portUpdated()
             self.sb.SetStatusText(self.ports[dlg.GetSelection()] + "@38400",1)
         except RuntimeError as e:
             print 'Error opening port:', e
             self.port = None
             self.sb.SetBackgroundColour('RED')
             self.sb.SetStatusText("Could Not Open Port",0) 
             self.sb.SetStatusText('not connected',1)
             self.timer.Start(20)
         dlg.Destroy()
开发者ID:jpieper,项目名称:nuke-jpieper,代码行数:29,代码来源:PyPose.py

示例6: register

    def register(self, bench):
        # self.open()
        connected = self.is_connected()
        if not(connected):
            raise IOError("Dummy device is not connected.")

        Driver.register(self, bench)
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:7,代码来源:dummy_dummy.py

示例7: reset

    def reset(self):
        print ("ENTERED RESET MODEL\n")
        # Spawn crossings
        dim = self.parameters.get('grid_size')
        self.crossings = []     # Crossings in grid orientation
        row = 0
        # Notice!! Location is [x, y], but in the grid, one first has to access row, then column (so [y][x])
        while row < dim[1]:
            cr_row = []
            col = 0
            while col < dim[0]:
                cr_row.append(Crossing([col, row]))
                col += 1
            self.crossings.append(cr_row)
            row += 1

        # Spawn drivers
        self.drivers = []
        n = self.parameters.get('n_drivers')
        #print ("DRIVERS SPAWNED\n")
        while n > 0:
            driver = Driver('driver' + str(n))
            self.drivers.append(driver)
            #TODO remove print
            #print ("DRIVER ADDED TO LIST\n")
            # Put at a grid edge
            new_loc = driver.respawn(dim[0], dim[1])
            self.crossings[new_loc[1]][new_loc[0]].put_spawn(driver, dim[0]-1, dim[1]-1)
            n -= 1
开发者ID:PdeRooij,项目名称:DMAS,代码行数:29,代码来源:model.py

示例8: register

    def register(self, bench):
        self.open()
        time.sleep(2)
        connected = self.is_connected()
        if not(connected):
            raise IOError("Lakeshore controller not connected.")

        Driver.register(self, bench)
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:8,代码来源:thermal_lakeshore.py

示例9: __init__

 def __init__(self, parent, clargs):
     Tkinter.Tk.__init__(self,parent)
     Driver.__init__(self,clargs)
    
     self.geometry('%dx%d' % (512, 512))
     self.update()
     self.lsign = 1
     self.act()
开发者ID:jenshnielsen,项目名称:hemelb,代码行数:8,代码来源:steering.py

示例10: register

    def register(self, bench):
        self.open()
        connected = self.is_connected()
        if not(connected):
            raise IOError(
                "TTL board not connected (or ttl software not running).")

        Driver.register(self, bench)
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:8,代码来源:ttl_ni.py

示例11: __init__

    def __init__(self, identifier, **kargs):
        Driver.__init__(self, identifier, **kargs)

        # self.identifier = identifier
        # self.host = host
        # self.device = device
        # self.port = port # XML-RPC port

        # if 'host' not in kargs.keys():
        #     raise ValueError("host is requested")

        # if 'devices' not in kargs.keys():
        #     raise ValueError("devices is requested")

        # if 'port' not in kargs.keys():
        #     raise ValueError("port is requested")

        if 'reb_id' not in kargs:
            raise ValueError("reb_id is requested")

        if 'host' not in kargs:
            self.host = None

        if 'stripe' not in kargs:
            self.stripe = 0

        if 'xmlfile' not in kargs:
            raise ValueError("XML sequencer file is requested")

        if self.hardware == 'REB1':
            self.reb = reb1.REB1(reb_id=self.reb_id, ctrl_host=self.host, stripe_id=[self.stripe])
            self.useCABAC = True
        elif self.hardware == 'WREB1':
            self.reb = wreb.WREB(rriaddress=self.reb_id, ctrl_host=self.host, stripe_id=[self.stripe])
            self.useCABAC = True
            self.reb.useCABACbias = True
        elif self.hardware in ['REB3', 'REB4']:
            self.reb = reb3.REB3(self.bcfile)
            self.useCABAC = False
        else:
            raise ValueError('Unknown type of hardware: %s' % self.hardware)

        # then check FPGA version after connecting
        checkversion = self.reb.fpga.get_version()
        if self.version != checkversion:
            raise ValueError('Wrong version of the FPGA firmware: reading %x instead of %x'
                             % (checkversion, self.version))

        self.reb.xmlfile = self.xmlfile
        self.read_sequencer_file(self.xmlfile)
        self.reb.exptime = self.reb.get_exposure_time()
        
        # CCD and test-related values (for meta)
        self.testID = { 'TESTTYPE': 'TEST', 'IMGTYPE': 'TEST', 'SEQNUM': 0}
        self.sensorID = { 'CCD_MANU': 'NONE', 'CCD_TYPE': 'NONE', 'CCD_SERN': '000-00', 'LSST_NUM': 'NONE'}

        logging.basicConfig(filename='REB-'+ time.strftime('%Y%m%d', time.gmtime()) + '.log',
                            level=logging.DEBUG, format='%(asctime)s: %(message)s')
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:58,代码来源:ccd_reb.py

示例12: register

    def register(self, bench):
        self.open()
        connected = self.is_connected()
        if not connected:
            raise IOError(
                "REB #%d not connected.\n You should run this on the computer connected to the crate." % self.reb_id)

        Driver.register(self, bench)
        self.boardID = self.reb.fpga.get_boardID()
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:9,代码来源:ccd_reb.py

示例13: __init__

    def __init__(self, probe_ids, probe_names, probe_data_type, **kwargs):
        """Initializes the Json URL driver.
        Keyword arguments:
        probe_ids -- list containing the probes IDs
                     (a wattmeter monitor sometimes several probes)
        kwargs -- keyword (url) defining the Json URL driver parameters

        """
        Driver.__init__(self, probe_ids, probe_names, probe_data_type, kwargs)
开发者ID:grid5000,项目名称:kwapi-g5k,代码行数:9,代码来源:json_url.py

示例14: register

    def register(self, bench):
        self.open()
        connected = self.is_connected()
        if not connected:
            raise IOError("DS9 display could not be reached")

        self.default_config()

        Driver.register(self, bench)
开发者ID:lsst-camera-dh,项目名称:pybench-ccd-reb,代码行数:9,代码来源:ds9display.py

示例15: __init__

    def __init__(self, probe_ids, data_type, **kwargs):
        """Initializes the Wattsup driver.

        Keyword arguments:
        probe_ids -- list containing the probes IDs
                     (a wattmeter monitor sometimes several probes)
        kwargs -- keyword (device) defining the device to read (/dev/ttyUSB0)

        """
        Driver.__init__(self, probe_ids, data_type, kwargs)
开发者ID:grid5000,项目名称:kwapi-g5k,代码行数:10,代码来源:wattsup.py


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