def handle_vectorXf_t(self, channel, data): self.plotterMutex.acquire() try: msg = vectorXf_t.decode(data) if (self.ptr > 0 and self.timeDataHist[self.ptr - 1] > float(msg.utime) / 1000000): self.resetDataBuf() self.timeDataHist[self.ptr] = float(msg.utime) / 1000000 for i in range(11): if (i < msg.rows): if self.ptr == self.histLength - 1 and self.good_ptr == self.histLength - 1: # todo: this is horrendously inefficient self.podDataHist[i] = np.roll(self.podDataHist[i], -1) self.podDataHist[i][self.ptr] = msg.data[i] if self.ptr == self.histLength - 1 and self.good_ptr == self.histLength - 1: self.timeDataHist = np.roll(self.timeDataHist, -1) self.good_ptr = max(self.ptr, self.good_ptr) self.ptr = min(self.ptr + 1, self.histLength - 1) except Exception as e: print e self.plotterMutex.release()
def handle_sim_imu_t(self, channel, data): msg = vectorXf_t.decode(data) offset = [ None, None, self.glWidget.global_offset[3] * 0.9 + msg.data[0] * 0.1, None, None, None ] self.glWidget.set_offset(None, offset) self.glWidget.update()
def handle_auto_braking_t(self, channel, data): msg = vectorXf_t.decode(data) brake_default_color = self.glWidget.get_default_color("Brakes") braking_color = [1.0, 0.0, 0.0, 0.5] des_color = [ msg.data[0] / 8000. * braking_color[i] + (1.0 - msg.data[0] / 8000) * brake_default_color[i] for i in range(3) ] self.glWidget.set_color("Brakes", des_color) self.glWidget.update()
def handle_vectorXf_t(self, channel, data): msg = vectorXf_t.decode(data) self.timeDataHist[self.ptr] = float(msg.utime) / 1000000 for i, ind in enumerate(self.indices): if (ind < msg.rows): if self.ptr == self.histLength - 1 and self.good_ptr == self.histLength - 1: # todo: this is horrendously inefficient self.analogDataHist[i] = np.roll(self.analogDataHist[i], -1) self.analogDataHist[i][self.ptr] = msg.data[ind] if self.ptr == self.histLength - 1 and self.good_ptr == self.histLength - 1: self.timeDataHist = np.roll(self.timeDataHist, -1) self.good_ptr = max(self.ptr, self.good_ptr) self.ptr = min(self.ptr + 1, self.histLength - 1)
def handle_vectorXf_t(self, channel, data): msg = vectorXf_t.decode(data) if (msg.rows > 0): if (msg.data[0] > 900 and abs(msg.data[1]) < 0.1) or (msg.data[0] > 995): self.sim_not_done = False
def new_arm_timeout_handler(self, channel, data): msg = vectorXf_t.decode(data) if (msg.rows > 0): self.latest_bac_countdown = msg.data[0] self.last_heard_arm_countdown = time.time()
def handle_imu_t(self, channel, data): msg = vectorXf_t.decode(data) offset = [None, None, None, msg.data[1], -msg.data[0],-msg.data[2]] self.glWidget.set_offset(None, offset) self.glWidget.update()
def handle_vectorXf_t(self, channel, data): msg = vectorXf_t.decode(data) for i, ind in enumerate(self.indices): if (ind < msg.rows): self.analogLabels[i].setText("A" + str(ind) + ": " + str(msg.data[ind]))