Пример #1
0
 def __init__(self, para=GpsPara()):
     SensorBase.__init__(self)
     self.sensorType = SensorType.gps
     self.para = para
     self._posMea = np.zeros(3)
     # the history data is used to implement the latency
     self._posHisReal = queue.Queue()
Пример #2
0
 def __init__(self):
     SensorBase.__init__(self)
     # the directions in which the player can
     # climbe at that thing. Vertical for example
     # means the player can climb up and down but
     # not left or right
     self.direction = "vertical"
     self.setFly = True
Пример #3
0
    def __sensorAction(self):
        if not self._actOnCollide:
            SensorBase.ignore(self, "sensorAction" + self.sensorID)
        if self.messageShown: return

        if self.translated:
            base.messenger.send("showMessage", [_(self.message)])
        else:
            base.messenger.send("showMessage", [self.message])
        self.messageShown = True
Пример #4
0
 def __init__(self, imu_para=mpu6050):
     """
     :param imu_para:
     """
     SensorBase.__init__(self)
     self.para = imu_para
     self.sensorType = SensorType.imu
     self.angularMea = np.zeros(3)
     self.gyroBias = (1 * np.random.random(3) - 0.5) * self.para.gyroZroToleranceInit
     self.accMea = np.zeros(3)
     self.accBias = (1 * np.random.random(3) - 0.5) * self.para.accZroToleranceInit
Пример #5
0
def on_message(client, userdata, msg):
    print(
        time.strftime("%d-%m-%Y %H:%M:%S", time.localtime()) + " " +
        msg.topic + " " + str(msg.payload))
    sensor = SensorBase(msg.topic, msg.payload)
    sensor.guardar()
    sensor.mostrar()
Пример #6
0
 def sensorAction(self):
     SensorBase.accept(self, "sensorAction" + self.sensorID,
                       self.__sensorAction)
     self.requestAct()
Пример #7
0
 def deactivateSensor(self):
     self.ignoreEvents()
     SensorBase.ignore(self, "doAction")
     SensorBase.ignore(self, "sensorAction" + self.sensorID)
     SensorBase.ignore(self, "checkSensorEvents")
Пример #8
0
 def activateSensor(self):
     self.acceptEvents()
     SensorBase.accept(self, "doAction", self.sensorAction)
     if self._actOnCollide:
         SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
Пример #9
0
 def setActOnCollide(self, act):
     self._actOnCollide = act
     if act:
         SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
Пример #10
0
 def __init__(self):
     SensorBase.__init__(self)
Пример #11
0
 def deactivateSensor(self):
     self.ignoreEvents()
     SensorBase.ignore(self, "canStartWallRun")
     SensorBase.ignore(self, "doInteligentAction")
     SensorBase.ignore(self, "sensorAction" + self.sensorID)
     SensorBase.ignore(self, "checkSensorEvents")
Пример #12
0
 def __sensorAction(self):
     if not self._actOnCollide:
         SensorBase.ignore(self, "sensorAction" + self.sensorID)
     base.messenger.send("setCharFlyMode", [self.setFly, self.direction])
     self.setFly = not self.setFly
Пример #13
0
 def __sensorAction(self):
     SensorBase.accept(self, "canStartWallRun", self.doWallRun)
     base.messenger.send("setWallCollision", [self.modelGeom.node()])
Пример #14
0
 def stopWallRun(self, node):
     if node == self.modelGeom.node():
         SensorBase.ignore(self, "canStartWallRun")
         base.messenger.send("checkWallCollision", [self.modelGeom.node()])
         base.messenger.send("stopWallRun")
Пример #15
0
 def doWallRun(self):
     SensorBase.ignore(self, "canStartWallRun")
     base.messenger.send("startWallRun")
Пример #16
0
 def __sensorAction(self):
     if not self._actOnCollide:
         SensorBase.ignore(self, "sensorAction" + self.sensorID)
     base.messenger.send("exitLevel")
Пример #17
0
 def sensorAction(self):
     if not self.messageShown:
         SensorBase.accept(self, "sensorAction" + self.sensorID,
                           self.__sensorAction)
         self.requestAct()
Пример #18
0
 def __init__(self):
     SensorBase.__init__(self)
     self.translated = False
     self.message = ""
     self.messageShown = False
Пример #19
0
 def activateSensor(self):
     self.acceptEvents()
     SensorBase.accept(self, "doInteligentAction", self.sensorAction)
     SensorBase.accept(self, "stopCollideSensor", self.stopWallRun)
     SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)