コード例 #1
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
  def attachLaser( self, remission=False, usb=False, pose=None, index=None, errLog=None ):
    if index == None:
      strIndex = ''
    else:
      strIndex = str(index)

    if self.replyLog is None:
      if usb:
        laser = LaserUSB( remission=remission, errLog=errLog )
      else:
        laser = LaserIP( remission=remission )
      name = timeName( "logs/src_laser"+strIndex+"_", "log" )
      if self.metaLog:
        self.metaLog.write("LASERLOG:\t" + name + "\n")
        self.metaLog.flush()
      self.registerDataSource( 'laser'+strIndex, SourceLogger( laser.scan, name ).get )
      if remission:
        name = timeName( "logs/src_remission"+strIndex+"_", "log" )
        if self.metaLog:
          self.metaLog.write("REMISSIONLOG:\t" + name + "\n")
          self.metaLog.flush()
        self.registerDataSource( 'remission'+strIndex, SourceLogger( laser.remission, name ).get )
    else:
      laser = DummyGPS() # just start
      if self.metaLog:
        laserSrcLog = self.metaLogName( "LASERLOG:" )
      else:
        laserSrcLog = self.replyLog[:-18]+"src_laser"+strIndex+"_"+self.replyLog[-17:]
      print "LASERLOG:", laserSrcLog
      self.registerDataSource( 'laser'+strIndex, SourceLogger( None, laserSrcLog ).get )
      if remission:
        if self.metaLog:
          remissionSrcLog = self.metaLogName( "REMISSIONLOG:" )
        else:
          remissionSrcLog = self.replyLog[:-18]+"src_remission"+strIndex+"_"+self.replyLog[-17:]
        print "REMISSIONLOG:", remissionSrcLog
        self.registerDataSource( 'remission'+strIndex, SourceLogger( None, remissionSrcLog ).get )
    if index == None:
      self.laser = laser
      self.laserData = None
      self.laserDataTimestamp = None
      self.remissionData = None
      self.laser.pose = pose
      self.addExtension( laserDataExtension )
    else:
      assert( index == 2 )
      self.laser2 = laser
      self.laserData2 = None
      self.laserData2Timestamp = None
      self.remissionData2 = None
      self.laser2.pose = pose
      self.addExtension( laserDataExtension2 )
コード例 #2
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachCamera(self, cameraExe=None, url="http://192.168.0.99/img.jpg", sleep=None):
   if self.replyLog is None:
     if cameraExe:
       proc = ImageProc(exe=cameraExe, verbose=0, priority=10)
     else:
       proc = DummyProc( sleep=sleep )
     self.camera = Camera( proc,
                           verbose=0,
                           url=url,
                           sleep=sleep )
     name = timeName( "logs/src_camera_", "log" )
     if self.metaLog:
       self.metaLog.write("CAMERALOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'camera', SourceLogger( self.camera.lastResultEx, name ).get )
   else:
     self.camera = DummyCamera()
     if self.metaLog:
       cameraSrcLog = self.metaLogName( "CAMERALOG:" )
     else:
       cameraSrcLog = self.replyLog[:-18]+"src_camera_"+self.replyLog[-17:]
     print "CAMERALOG:", cameraSrcLog
     self.registerDataSource( 'camera', SourceLogger( None, cameraSrcLog ).get )
   self.cameraData = None
   self.addExtension( cameraDataExtension )
コード例 #3
0
 def attachCamera(self,
                  cameraExe=None,
                  url="http://192.168.0.99/img.jpg",
                  sleep=None):
     if self.replyLog is None:
         if cameraExe:
             proc = ImageProc(exe=cameraExe, verbose=0, priority=10)
         else:
             proc = DummyProc(sleep=sleep)
         self.camera = Camera(proc, verbose=0, url=url, sleep=sleep)
         name = timeName("logs/src_camera_", "log")
         if self.metaLog:
             self.metaLog.write("CAMERALOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource(
             'camera',
             SourceLogger(self.camera.lastResultEx, name).get)
     else:
         self.camera = DummyCamera()
         if self.metaLog:
             cameraSrcLog = self.metaLogName("CAMERALOG:")
         else:
             cameraSrcLog = self.replyLog[:
                                          -18] + "src_camera_" + self.replyLog[
                                              -17:]
         print "CAMERALOG:", cameraSrcLog
         self.registerDataSource('camera',
                                 SourceLogger(None, cameraSrcLog).get)
     self.cameraData = None
     self.addExtension(cameraDataExtension)
コード例 #4
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachRemoteCamera(self, address=('localhost', 8431)):
   if self.replyLog is None:
     self.camera = RemoteCamera( address, verbose=0 )
     self.registerDataSource( 'camera', SourceLogger( self.camera.lastResultEx, timeName( "logs/src_camera_", "log" ) ).get )
   else:
     self.camera = DummyGPS() # TODO some dummy device with start(), requestStop() functions
     cameraSrcLog = self.replyLog[:-18]+"src_camera_"+self.replyLog[-17:]
     print "CAMERALOG:", cameraSrcLog
     self.registerDataSource( 'camera', SourceLogger( None, cameraSrcLog ).get )
   self.cameraData = None
   self.addExtension( cameraDataExtension )
コード例 #5
0
ファイル: eduromaxi.py プロジェクト: robotika/eduro
 def attachRFU620(self):
   if self.replyLog is None:
     self.rfu620 = RFU620Reader()
     name = timeName( "logs/src_rfu620_", "log" )
     if self.metaLog:
       self.metaLog.write("RFU620LOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'rfu620', SourceLogger( self.rfu620.getScanData, name ).get )
   else:
     self.rfu620 = DummyGPS()
     assert self.metaLog
     srcLog = self.metaLogName( "RFU620LOG:" )
     print "RFU620LOG:", srcLog
     self.registerDataSource( 'rfu620', SourceLogger( None, srcLog ).get )
   self.rfu620Data = None
   self.addExtension( rfu620DataExtension )
コード例 #6
0
 def attachRemoteCamera(self, address=('localhost', 8431)):
     if self.replyLog is None:
         self.camera = RemoteCamera(address, verbose=0)
         self.registerDataSource(
             'camera',
             SourceLogger(self.camera.lastResultEx,
                          timeName("logs/src_camera_", "log")).get)
     else:
         self.camera = DummyGPS(
         )  # TODO some dummy device with start(), requestStop() functions
         cameraSrcLog = self.replyLog[:-18] + "src_camera_" + self.replyLog[
             -17:]
         print "CAMERALOG:", cameraSrcLog
         self.registerDataSource('camera',
                                 SourceLogger(None, cameraSrcLog).get)
     self.cameraData = None
     self.addExtension(cameraDataExtension)
コード例 #7
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachBarcodeReader(self):
   if self.replyLog is None:
     self.barcode = BarcodeReader()
     name = timeName( "logs/src_barcode_", "log" )
     if self.metaLog:
       self.metaLog.write("BARCODELOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'barcode', SourceLogger( self.barcode.getCode, name ).get )
   else:
     self.barcode = DummyGPS()
     if self.metaLog:
       barSrcLog = self.metaLogName( "BARCODELOG:" )
     else:
       barSrcLog = self.replyLog[:-18]+"src_barcode_"+self.replyLog[-17:]
     print "BARCODELOG:", barSrcLog
     self.registerDataSource( 'barcode', SourceLogger( None, barSrcLog ).get )
   self.barcodeData = None
   self.addExtension( barcodeDataExtension )
コード例 #8
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachGPS(self):
   if self.replyLog is None:
     self.gps = GPS( verbose=0 )
     name = timeName( "logs/src_gps_", "log" )
     if self.metaLog:
       self.metaLog.write("GPSLOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'gps', SourceLogger( self.gps.coord, name ).get )
   else:
     self.gps = DummyGPS()
     if self.metaLog:
       gpsSrcLog = self.metaLogName( "GPSLOG:" )
     else:
       gpsSrcLog = self.replyLog[:-18]+"src_gps_"+self.replyLog[-17:]
     print "GPSLOG:", gpsSrcLog
     self.registerDataSource( 'gps', SourceLogger( None, gpsSrcLog ).get )
   self.gpsData = None
   self.addExtension( gpsDataExtension )
コード例 #9
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachProcessingNode( self ):
   if self.replyLog is None:
     self.node = SocketExtension()
     name = timeName( "logs/src_node_", "log" )
     if self.metaLog:
       self.metaLog.write("NODELOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'node', SourceLogger( self.node.data, name ).get )
   else:
     self.node = DummyGPS() # just start
     if self.metaLog:
       nodeSrcLog = self.metaLogName( "NODELOG:" )
     else:
       nodeSrcLog = self.replyLog[:-18]+"src_node_"+self.replyLog[-17:]
     print "NODELOG:", nodeSrcLog
     self.registerDataSource( 'node', SourceLogger( None, nodeSrcLog ).get )
   self.nodeData = None
   self.addExtension( nodeDataExtension )
コード例 #10
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachRasPi(self):
   if self.replyLog is None:
     self.raspi = RasPi()
     name = timeName( "logs/src_raspi_", "log" )
     if self.metaLog:
       self.metaLog.write("RASPILOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'raspi', SourceLogger( self.raspi.getData, name ).get )
   else:
     self.raspi = DummyGPS()
     if self.metaLog:
       barSrcLog = self.metaLogName( "RASPILOG:" )
     else:
       barSrcLog = self.replyLog[:-18]+"src_raspi_"+self.replyLog[-17:]
     print "RASPILOG:", barSrcLog
     self.registerDataSource( 'raspi', SourceLogger( None, barSrcLog ).get )
   self.raspiData = None
   self.addExtension( raspiDataExtension )
コード例 #11
0
ファイル: eduromaxi.py プロジェクト: TeaPackCZ/eduro
 def attachRFID(self):
   if self.replyLog is None:
     self.rfid = RFID()
     name = timeName( "logs/src_rfid_", "log" )
     if self.metaLog:
       self.metaLog.write("RFIDLOG:\t" + name + "\n")
       self.metaLog.flush()
     self.registerDataSource( 'rfid', SourceLogger( self.rfid.data, name ).get )
   else:
     self.rfid = DummyGPS() # just start
     if self.metaLog:
       rfidSrcLog = self.metaLogName( "RFIDLOG:" )
     else:
       rfidSrcLog = self.replyLog[:-18]+"src_rfid_"+self.replyLog[-17:]
     print "RFIDLOG:", rfidSrcLog
     self.registerDataSource( 'rfid', SourceLogger( None, rfidSrcLog ).get )
   self.rfidData = None
   self.rfidDataRaw = None
   self.addExtension( rfidDataExtension )
コード例 #12
0
 def attachGPS(self):
     if self.replyLog is None:
         self.gps = GPS(verbose=0)
         name = timeName("logs/src_gps_", "log")
         if self.metaLog:
             self.metaLog.write("GPSLOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource('gps',
                                 SourceLogger(self.gps.coord, name).get)
     else:
         self.gps = DummyGPS()
         if self.metaLog:
             gpsSrcLog = self.metaLogName("GPSLOG:")
         else:
             gpsSrcLog = self.replyLog[:-18] + "src_gps_" + self.replyLog[
                 -17:]
         print "GPSLOG:", gpsSrcLog
         self.registerDataSource('gps', SourceLogger(None, gpsSrcLog).get)
     self.gpsData = None
     self.addExtension(gpsDataExtension)
コード例 #13
0
 def attachProcessingNode(self):
     if self.replyLog is None:
         self.node = SocketExtension()
         name = timeName("logs/src_node_", "log")
         if self.metaLog:
             self.metaLog.write("NODELOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource('node',
                                 SourceLogger(self.node.data, name).get)
     else:
         self.node = DummyGPS()  # just start
         if self.metaLog:
             nodeSrcLog = self.metaLogName("NODELOG:")
         else:
             nodeSrcLog = self.replyLog[:-18] + "src_node_" + self.replyLog[
                 -17:]
         print "NODELOG:", nodeSrcLog
         self.registerDataSource('node', SourceLogger(None, nodeSrcLog).get)
     self.nodeData = None
     self.addExtension(nodeDataExtension)
コード例 #14
0
 def attachRasPi(self):
     if self.replyLog is None:
         self.raspi = RasPi()
         name = timeName("logs/src_raspi_", "log")
         if self.metaLog:
             self.metaLog.write("RASPILOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource('raspi',
                                 SourceLogger(self.raspi.getData, name).get)
     else:
         self.raspi = DummyGPS()
         if self.metaLog:
             barSrcLog = self.metaLogName("RASPILOG:")
         else:
             barSrcLog = self.replyLog[:-18] + "src_raspi_" + self.replyLog[
                 -17:]
         print "RASPILOG:", barSrcLog
         self.registerDataSource('raspi', SourceLogger(None, barSrcLog).get)
     self.raspiData = None
     self.addExtension(raspiDataExtension)
コード例 #15
0
 def attachRFID(self):
     if self.replyLog is None:
         self.rfid = RFID()
         name = timeName("logs/src_rfid_", "log")
         if self.metaLog:
             self.metaLog.write("RFIDLOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource('rfid',
                                 SourceLogger(self.rfid.data, name).get)
     else:
         self.rfid = DummyGPS()  # just start
         if self.metaLog:
             rfidSrcLog = self.metaLogName("RFIDLOG:")
         else:
             rfidSrcLog = self.replyLog[:-18] + "src_rfid_" + self.replyLog[
                 -17:]
         print "RFIDLOG:", rfidSrcLog
         self.registerDataSource('rfid', SourceLogger(None, rfidSrcLog).get)
     self.rfidData = None
     self.rfidDataRaw = None
     self.addExtension(rfidDataExtension)
コード例 #16
0
 def attachBarcodeReader(self):
     if self.replyLog is None:
         self.barcode = BarcodeReader()
         name = timeName("logs/src_barcode_", "log")
         if self.metaLog:
             self.metaLog.write("BARCODELOG:\t" + name + "\n")
             self.metaLog.flush()
         self.registerDataSource(
             'barcode',
             SourceLogger(self.barcode.getCode, name).get)
     else:
         self.barcode = DummyGPS()
         if self.metaLog:
             barSrcLog = self.metaLogName("BARCODELOG:")
         else:
             barSrcLog = self.replyLog[:
                                       -18] + "src_barcode_" + self.replyLog[
                                           -17:]
         print "BARCODELOG:", barSrcLog
         self.registerDataSource('barcode',
                                 SourceLogger(None, barSrcLog).get)
     self.barcodeData = None
     self.addExtension(barcodeDataExtension)
コード例 #17
0
    def attachLaser(self,
                    remission=False,
                    usb=False,
                    pose=None,
                    index=None,
                    errLog=None):
        if index == None:
            strIndex = ''
        else:
            strIndex = str(index)

        if self.replyLog is None:
            if usb:
                laser = LaserUSB(remission=remission, errLog=errLog)
            else:
                laser = LaserIP(remission=remission)
            name = timeName("logs/src_laser" + strIndex + "_", "log")
            if self.metaLog:
                self.metaLog.write("LASERLOG:\t" + name + "\n")
                self.metaLog.flush()
            self.registerDataSource('laser' + strIndex,
                                    SourceLogger(laser.scan, name).get)
            if remission:
                name = timeName("logs/src_remission" + strIndex + "_", "log")
                if self.metaLog:
                    self.metaLog.write("REMISSIONLOG:\t" + name + "\n")
                    self.metaLog.flush()
                self.registerDataSource(
                    'remission' + strIndex,
                    SourceLogger(laser.remission, name).get)
        else:
            laser = DummyGPS()  # just start
            if self.metaLog:
                laserSrcLog = self.metaLogName("LASERLOG:")
            else:
                laserSrcLog = self.replyLog[:
                                            -18] + "src_laser" + strIndex + "_" + self.replyLog[
                                                -17:]
            print "LASERLOG:", laserSrcLog
            self.registerDataSource('laser' + strIndex,
                                    SourceLogger(None, laserSrcLog).get)
            if remission:
                if self.metaLog:
                    remissionSrcLog = self.metaLogName("REMISSIONLOG:")
                else:
                    remissionSrcLog = self.replyLog[:
                                                    -18] + "src_remission" + strIndex + "_" + self.replyLog[
                                                        -17:]
                print "REMISSIONLOG:", remissionSrcLog
                self.registerDataSource(
                    'remission' + strIndex,
                    SourceLogger(None, remissionSrcLog).get)
        if index == None:
            self.laser = laser
            self.laserData = None
            self.laserDataTimestamp = None
            self.remissionData = None
            self.laser.pose = pose
            self.addExtension(laserDataExtension)
        else:
            assert (index == 2)
            self.laser2 = laser
            self.laserData2 = None
            self.laserData2Timestamp = None
            self.remissionData2 = None
            self.laser2.pose = pose
            self.addExtension(laserDataExtension2)