Ejemplo n.º 1
0
    def addHistory(self, ruleName, imageBytes=None, imageType=None):
        """ updates the action history table, blocking until all data is retrieved and stored """
        """ returns true on successful update """

        from Robots.robotFactory import Factory
        cob = Factory.getCurrentRobot()
        dao = DataAccess()
        dateNow = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        location = dao.getRobotByName(cob.name)['locationId']

        historyId = dao.saveHistory(dateNow, ruleName, location)

        if (historyId > 0):
            dao.saveSensorHistory(historyId)

            if imageType == None:
                imageType = ActionHistory._defaultImageType

            if imageBytes == None:
                imageBytes = cob.getImage(retFormat=imageType)

            if imageBytes != None:
                dao.saveHistoryImage(historyId, imageBytes, imageType)

        return historyId > 0
Ejemplo n.º 2
0
 def __init__(self):
     super(LocationProcessor, self).__init__()
     self._dao = DataAccess()
     self._storedLoc = lambda: {'locationName': '', 'xCoord': 0, 'yCoord': 0, 'orientation': 0, 'driftThreshold': 0 }
     self._curLoc = lambda: ('', (0, 0, 0))
     self._updateLoc = lambda locid, x, y, orientation: True
     self._targetName = ''
Ejemplo n.º 3
0
 def __init__(self):
     self._dao = DataAccess()
     self._preferences = self._dao.users.getUserPreferences()
     self._robot = Factory.getCurrentRobot()
     self._threadLights = myThreadLights(1, "Thread-Lights", self._robot)
     self._threadHead = myThreadHead(2, "Thread-Head", self._robot)
     self._threadBase = myThreadBase(3, "Thread-BaseDirect", self._robot)
     self._threadTray = myThreadTray(4, "Thread-Tray", self._robot)
Ejemplo n.º 4
0
    def addHistory(self, ruleName, imageBytes=None, imageType=None):
        
        cob = CareOBot()
        dao = DataAccess()
        dateNow = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        location = dao.getRobotByName(cob.name)['locationId']
        
        historyId = dao.saveHistory(dateNow, ruleName, location)
        
        if(historyId > 0):
            dao.saveSensorHistory(historyId)

            if imageType == None:
                imageType = ActionHistory._defaultImageType

            if imageBytes == None:
                imageBytes = cob.getImage(retFormat=imageType)

            if imageBytes != None:
                dao.saveHistoryImage(historyId, imageBytes, imageType)
        
        return historyId > 0
Ejemplo n.º 5
0
 def __init__(self, threadID, name, robot):
     threading.Thread.__init__(self)
     self._threadID = threadID
     self._robot = robot
     self._name = name
     self._dao = DataAccess()
Ejemplo n.º 6
0
 def __init__(self):
     self._robotName = CareOBot().name
     self._dao = DataAccess()
     self._sr = StateResolver()
Ejemplo n.º 7
0
 def __init__(self):
     self._dao = DataAccess()
Ejemplo n.º 8
0
 def __init__(self):
     self._dao = DataAccess()
     self._scenarios = Scenario()
     self._host = "nathan@sf1-1-pc1"
     self._robot = Factory.getCurrentRobot()
Ejemplo n.º 9
0
 def __init__(self):
     self._dao = DataAccess()
     self._basePath = os.path.join(
         os.path.dirname(os.path.realpath(__file__)), 'images')
Ejemplo n.º 10
0
 def __init__(self, channels, name=''):
     super(SensorLog, self).__init__()
     self._dao = DataAccess().sensors
     self._channels = channels
     self._logCache = {}
     self._name = name
Ejemplo n.º 11
0
 def __init__(self):
     self._dao = DataAccess()
     self._robot = Factory.getRobot('UH Sunflower')
     self._thread1 = myThreadLights(1, "Thread-1", self._robot)
     self._thread2 = myThreadHead(2, "Thread-2", self._robot)