def format_health(self): ''' obj = { 'Type': 'Health', 'Time': self.timer.time(), 'Readers': self.field_state.names_to_count } return json.dumps(obj) ''' msg = Health() msg.uptime = self.timer.time() print ("readers=" + str(self.field_state.names_to_count)) return msg
def _health_loop(self): while True: msg = Health() msg.uptime = time.time() - self.startTime self.lcm.publish("Flagger/Health", msg.encode()) time.sleep(0.25)