Example #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()
 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
Example #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
Example #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
Example #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()
Example #6
0
 def sensorAction(self):
     SensorBase.accept(self, "sensorAction" + self.sensorID,
                       self.__sensorAction)
     self.requestAct()
Example #7
0
 def deactivateSensor(self):
     self.ignoreEvents()
     SensorBase.ignore(self, "doAction")
     SensorBase.ignore(self, "sensorAction" + self.sensorID)
     SensorBase.ignore(self, "checkSensorEvents")
Example #8
0
 def activateSensor(self):
     self.acceptEvents()
     SensorBase.accept(self, "doAction", self.sensorAction)
     if self._actOnCollide:
         SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
Example #9
0
 def setActOnCollide(self, act):
     self._actOnCollide = act
     if act:
         SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
Example #10
0
 def __init__(self):
     SensorBase.__init__(self)
Example #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")
 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
Example #13
0
 def __sensorAction(self):
     SensorBase.accept(self, "canStartWallRun", self.doWallRun)
     base.messenger.send("setWallCollision", [self.modelGeom.node()])
Example #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")
Example #15
0
 def doWallRun(self):
     SensorBase.ignore(self, "canStartWallRun")
     base.messenger.send("startWallRun")
Example #16
0
 def __sensorAction(self):
     if not self._actOnCollide:
         SensorBase.ignore(self, "sensorAction" + self.sensorID)
     base.messenger.send("exitLevel")
Example #17
0
 def sensorAction(self):
     if not self.messageShown:
         SensorBase.accept(self, "sensorAction" + self.sensorID,
                           self.__sensorAction)
         self.requestAct()
Example #18
0
 def __init__(self):
     SensorBase.__init__(self)
     self.translated = False
     self.message = ""
     self.messageShown = False
Example #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)