def update(self): if (self.last_known_status): if (self.last_known_status.current_battery[0] != -2): self.batteryCurrentLabel.setText( "%2.1fA" % self.last_known_status.current_battery[0]) else: self.batteryCurrentLabel.setText( "??.?A" ) if (self.last_known_status.current_motor[0] != -2): self.motorCurrentLabel.setText( "%2.1fA" % self.last_known_status.current_motor[0]) else: self.motorCurrentLabel.setText( "??.?A" ) if (self.force_estop): if (not self.last_known_config or self.last_known_config["estop"] != 1): msg = trigger_t() msg.utime = time.time()*1000*1000 self.lc.publish(self.estop_channel, msg.encode()) self.estopWidget.setStyleSheet(""" .QWidget { border: 5px solid gray; border-radius: 5px; background-color: rgb(250, 20, 20); } """) else: self.estopWidget.setStyleSheet(""" .QWidget { border: 5px solid gray; border-radius: 5px; background-color: rgb(230, 150, 20); } """) else: if (self.last_known_config and self.last_known_config["estop"] == 0): self.estopWidget.setStyleSheet(""" .QWidget { border: 5px solid gray; border-radius: 5px; background-color: rgb(20, 200, 20); } """) elif (self.last_known_config and self.last_known_config["estop"] == 1): self.estopWidget.setStyleSheet(""" .QWidget { border: 5px solid gray; border-radius: 5px; background-color: rgb(250, 20, 20); } """) if (self.active_command_mode): if (time.time() - self.last_sent_command > self.COMMAND_SEND_PERIOD): msg = adm_config_t() for attr in msg.__slots__: setattr(msg, attr, -2) msg.utime = time.time()*1000*1000 msg.command = self.commandSlider.value()/1000.0 self.lc.publish(self.config_set_channel, msg.encode()) self.last_sent_command = time.time()
def publish_estop(self): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish("_ESTOP", msg.encode())
def throw_estop(lc): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 lc.publish("_ESTOP", msg.encode())
def reset_sim(self): sendTime = time.time() reset_msg = trigger_t() reset_msg.utime = 0 self.lc.publish("RESET", reset_msg.encode())
def start_sim(self): sendTime = time.time() start_msg = trigger_t() start_msg.utime = 0 self.lc.publish("START", start_msg.encode())
def sendEStop(): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 lc.publish("_ESTOP", msg.encode())
def sendNavReset(self): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish("RESET", msg.encode())
def sendTare(self): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish("TARE", msg.encode())
def handleResetButton(self): sendTime = time.time() reset_msg = trigger_t() reset_msg.utime = int((sendTime - self.startTime)* 1000000) self.lc.publish("SIM_RESET",reset_msg.encode())
def handleReflashButton(self): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish(self.reflash_channel, msg.encode())
def handleEstopButton(self): self.force_estop = True msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish(self.estop_channel, msg.encode())
def sendFaultClear(self): msg = trigger_t() msg.utime = time.time() * 1000 * 1000 self.lc.publish("CLEAR_FAULT", msg.encode())