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
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
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
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()
def sensorAction(self): SensorBase.accept(self, "sensorAction" + self.sensorID, self.__sensorAction) self.requestAct()
def deactivateSensor(self): self.ignoreEvents() SensorBase.ignore(self, "doAction") SensorBase.ignore(self, "sensorAction" + self.sensorID) SensorBase.ignore(self, "checkSensorEvents")
def activateSensor(self): self.acceptEvents() SensorBase.accept(self, "doAction", self.sensorAction) if self._actOnCollide: SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
def setActOnCollide(self, act): self._actOnCollide = act if act: SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)
def __init__(self): SensorBase.__init__(self)
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
def __sensorAction(self): SensorBase.accept(self, "canStartWallRun", self.doWallRun) base.messenger.send("setWallCollision", [self.modelGeom.node()])
def stopWallRun(self, node): if node == self.modelGeom.node(): SensorBase.ignore(self, "canStartWallRun") base.messenger.send("checkWallCollision", [self.modelGeom.node()]) base.messenger.send("stopWallRun")
def doWallRun(self): SensorBase.ignore(self, "canStartWallRun") base.messenger.send("startWallRun")
def __sensorAction(self): if not self._actOnCollide: SensorBase.ignore(self, "sensorAction" + self.sensorID) base.messenger.send("exitLevel")
def sensorAction(self): if not self.messageShown: SensorBase.accept(self, "sensorAction" + self.sensorID, self.__sensorAction) self.requestAct()
def __init__(self): SensorBase.__init__(self) self.translated = False self.message = "" self.messageShown = False
def activateSensor(self): self.acceptEvents() SensorBase.accept(self, "doInteligentAction", self.sensorAction) SensorBase.accept(self, "stopCollideSensor", self.stopWallRun) SensorBase.accept(self, "checkSensorEvents", self.__sensorAction)