diff --git a/mustard.py b/mustard.py index 8e1940d..e378e0b 100644 --- a/mustard.py +++ b/mustard.py @@ -64,6 +64,7 @@ from visualiser import VisualiserPose6q from visualiser import VisualiserBoundingBoxes from visualiser import VisualiserOpticFlow + from visualiser import VisualiserImu from timestamps import getLastTimestamp except ModuleNotFoundError: if __package__ is None or __package__ == '': @@ -74,6 +75,7 @@ from bimvee.visualiser import VisualiserPose6q from bimvee.visualiser import VisualiserBoundingBoxes from bimvee.visualiser import VisualiserOpticFlow + from bimvee.visualiser import VisualiserImu from bimvee.timestamps import getLastTimestamp from viewer import Viewer @@ -101,7 +103,7 @@ class DictEditor(GridLayout): dict = DictProperty(None) def on_dict(self, instance, value): - # 2020_03_10 Sim: Why only import Spinner here? at the top of the file + # 2020_03_10 Sim: Why only import Spinner here? at the top of the file # it was causing a crash when starting in a thread - no idea why from kivy.uix.spinner import Spinner for n, topic in enumerate(sorted(value)): @@ -121,6 +123,9 @@ def on_dict(self, instance, value): elif 'flow' in topic: spinner.text = 'flowMap' check_box.active = True + elif 'imu' in topic: + spinner.text = 'imu' + check_box.active = True self.add_widget(spinner) self.add_widget(TextInput(text=topic)) @@ -163,10 +168,6 @@ def add_viewer_and_resize(self, data_dict, channel_name=''): settings[data_type] = {} if data_type == 'dvs': visualiser = VisualiserDvs(data_dict[data_type]) - settings[data_type] = {'polarised': {}, - 'contrast': {}, - 'pol_to_show': {} - } settings[data_type]['polarised'] = {'type': 'boolean', 'default': True } @@ -185,20 +186,18 @@ def add_viewer_and_resize(self, data_dict, channel_name=''): visualiser = VisualiserFrame(data_dict[data_type]) elif data_type == 'pose6q': visualiser = VisualiserPose6q(data_dict[data_type]) - settings[data_type] = {'interpolate': {}, - 'perspective': {}} settings[data_type]['interpolate'] = {'type': 'boolean', 'default': True } settings[data_type]['perspective'] = {'type': 'boolean', 'default': True } + settings[data_type]['label_multiple_bodies'] = {'type': 'boolean', + 'default': True + } channel_name = channel_name + '\nred=x green=y, blue=z' elif data_type == 'point3': visualiser = VisualiserPoint3(data_dict[data_type]) - settings[data_type] = {'perspective': {}, - 'yaw': {}, - 'pitch': {}} settings[data_type]['perspective'] = {'type': 'boolean', 'default': True } @@ -216,12 +215,29 @@ def add_viewer_and_resize(self, data_dict, channel_name=''): } elif data_type == 'boundingBoxes': visualiser = VisualiserBoundingBoxes(data_dict[data_type]) - settings[data_type] = {'with_labels': {}} settings[data_type]['with_labels'] = {'type': 'boolean', 'default': True } elif data_type == 'flowMap': visualiser = VisualiserOpticFlow(data_dict[data_type]) + elif data_type == 'imu': + visualiser = VisualiserImu(data_dict[data_type]) + settings[data_type]['perspective'] = {'type': 'boolean', + 'default': True + } + settings[data_type]['rotation_scale'] = {'type': 'range', + 'default': 50, + 'min': 0, + 'max': 100, + 'step': 1 + } + settings[data_type]['smoothing'] = {'type': 'range', + 'default': 0, + 'min': 0, + 'max': 100, + 'step': 1 + } + channel_name = channel_name + '\nred=x green=y, blue=z' else: print("Warning! {} is not a recognized data type. Ignoring.".format(data_type)) continue diff --git a/viewer.py b/viewer.py index 252cc56..2408772 100644 --- a/viewer.py +++ b/viewer.py @@ -69,7 +69,7 @@ def __init__(self, **kwargs): def on_visualisers(self, instance, value): if self.visualisers is not None and self.visualisers: for v in self.visualisers: # TODO manage cases with multiple of below data_types - if v.data_type in ['dvs', 'frame', 'pose6q', 'point3', 'flowMap']: + if v.data_type in ['dvs', 'frame', 'pose6q', 'point3', 'flowMap', 'imu']: self.colorfmt = v.get_colorfmt() self.data_shape = v.get_dims() buf_shape = (dp(self.data_shape[0]), dp(self.data_shape[1])) @@ -125,7 +125,7 @@ def update_settings(self, parent_widget, settings_dict): def on_data(self, instance, value): for data_type in self.data.keys(): - if data_type in ['dvs', 'frame', 'pose6q', 'point3', 'flowMap']: + if data_type in ['dvs', 'frame', 'pose6q', 'point3', 'flowMap', 'imu']: self.update_image(self.data[data_type]) elif data_type in ['boundingBoxes']: self.update_b_boxes(self.data[data_type])