diff --git a/compat.py b/compat.py index b996bbd..41b3790 100644 --- a/compat.py +++ b/compat.py @@ -146,6 +146,7 @@ class Dummy: def __init__(self, _rate, type='acc', buffer_len=1): self.rate = _rate self._rate = _rate + self.accuracy = 3 self.type = type self.last_time = time.monotonic_ns() self.q = iq((0.0, 0.0, 0.0), buffer_len) diff --git a/look.kv b/look.kv index d409d98..5d38e48 100644 --- a/look.kv +++ b/look.kv @@ -5,7 +5,7 @@ size_hint: [1, .05] orientation: "horizontal" Button: - text: "To Orientation" + text: "ORIENTATION" bold: True on_press: root.manager.transition.direction = 'left' @@ -29,7 +29,7 @@ size_hint: [1, .05] orientation: "horizontal" Button: - text: "To Accelerometer" + text: "FORCE" bold: True on_press: root.manager.transition.direction = 'right' @@ -50,7 +50,6 @@ id: graph0 y_grid_label : True y_grid: True - xlabel : 'Azimuth' xmax : 200 ymax: 180 ymin: -180 @@ -62,7 +61,6 @@ id: graph1 y_grid_label : True y_grid: True - xlabel : 'Pitch' xmax : 200 ymax: 90 ymin: -90 @@ -77,7 +75,6 @@ xmax : 200 ymax: 180 ymin: -180 - xlabel : 'Roll' y_ticks_minor : 20 y_ticks_major : 40 diff --git a/main.py b/main.py index bd4a68c..92fec5b 100644 --- a/main.py +++ b/main.py @@ -252,7 +252,8 @@ def get_value(self, dt): self.worker.q.put(('orientation', (self.event_time, event_time_idx, points, points_t))) self.update_cnt += 1 - self.ids.label.text = f'Cnt #{self.worker.event_count} Rate{snsr.accuracy}: {snsr.rate:.1f} ' + lookup = {3:'H', 2: 'M', 1:'L'} + self.ids.label.text = f'#{self.worker.event_count} | rate:{snsr.rate:.1f}@{lookup.get(snsr.accuracy,"?")}' if self.update_cnt == GRAPH_DRAW_EVERY_FRAMES or detected: self.update_cnt = 0 @@ -265,6 +266,8 @@ def get_value(self, dt): to = -int(sensor_manager.ori.rate/4) midpoints = np.median(points[:, fro:to], axis=-1) + labels = ['Azimuth', 'Pitch', 'Roll'] + for i, plot in enumerate(self.plots): gr = getattr(self.ids, f'graph{i}') values = points[i] @@ -276,6 +279,7 @@ def get_value(self, dt): #center graphs midpoint = int(np.round(midpoints[i])) + gr.xlabel = f'{labels[i]} @ {midpoint}' ZOOM_DEGREES = 20 gr.ymax = midpoint + ZOOM_DEGREES gr.ymin = midpoint - ZOOM_DEGREES @@ -284,6 +288,7 @@ def get_value(self, dt): cache = self.gr_cache.pop(gr, None) if cache is not None: gr.ymax, gr.ymin, gr.y_ticks_major = cache + gr.xlabel = f'{labels[i]} @ {np.median(values[-10:]):.1f}' gr.xmax = len(values) plot.points = enumerate(values)