コード例 #1
0
    def __init__(self, robot=None):
        super(HumanLocationProcessor, self).__init__()
        if robot == None:
            from Robots.careobot import CareOBot
            self._robot = CareOBot()
        else:
            self._robot = robot

        robId = self._dao.getRobotByName(self._robot.name)['robotId']
        self._targetName = self._robot.name
        self._storedLoc = lambda: self._dao.getRobot(robId)
        self._curLoc = lambda: self._robot.getLocation(False)
        
        self._updateLoc = lambda locid, x, y, orientation: self._dao.saveRobotLocation(robId, locid, x, y, orientation)
コード例 #2
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
コード例 #3
0
 def __init__(self):
     self._robotName = CareOBot().name
     self._dao = DataAccess()
     self._sr = StateResolver()
コード例 #4
0
ファイル: updateServices.py プロジェクト: ninghang/accompany
import locations
import sensors
from history import SensorLog
from Robots.careobot import CareOBot, PoseUpdater

from config import server_config
import sys

if __name__ == '__main__':
    robot = CareOBot()
    z = sensors.ZigBee(server_config['udp_listen_port'])
    g = sensors.GEOSystem(server_config['mysql_geo_server'],
                            server_config['mysql_geo_user'],
                            server_config['mysql_geo_password'],
                            server_config['mysql_geo_db'],
                            server_config['mysql_geo_query'])
    l = locations.RobotLocationProcessor(robot)
    rp = PoseUpdater(robot)

    sz = SensorLog(z.channels, 'ZigBee')
    sg = SensorLog(g.channels, 'GEO')
    sr = SensorLog(rp.channels, rp.robot.name)

    z.start()
    sz.start()

    g.start()
    sg.start()

    rp.start()
    sr.start()