Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
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)