diff --git a/robot_log_visualizer/file_reader/signal_provider.py b/robot_log_visualizer/file_reader/signal_provider.py index 41ee3b1..18de7c4 100644 --- a/robot_log_visualizer/file_reader/signal_provider.py +++ b/robot_log_visualizer/file_reader/signal_provider.py @@ -73,11 +73,18 @@ def __populate_text_logging_data(self, file_object): # New way to store the struct array in robometry https://github.com/robotology/robometry/pull/175 if text_ref.shape[0] == len(data[key]["timestamps"]): + # If len(value[text[0]].shape) == 2 then the text contains a string, otherwise it is empty + # We need to manually check the shape to handle the case in which the text is empty data[key]["data"] = [ TextLoggingMsg( text="".join(chr(c[0]) for c in value[text[0]]), level="".join(chr(c[0]) for c in value[level[0]]), ) + if len(value[text[0]].shape) == 2 + else TextLoggingMsg( + text="", + level="".join(chr(c[0]) for c in value[level[0]]), + ) for text, level in zip(text_ref, level_ref) ] diff --git a/robot_log_visualizer/ui/gui.py b/robot_log_visualizer/ui/gui.py index 120cbd2..8bb0f16 100644 --- a/robot_log_visualizer/ui/gui.py +++ b/robot_log_visualizer/ui/gui.py @@ -463,7 +463,6 @@ def plotTabBar_currentChanged(self, index): # select the item in the tree from the path item = self.ui.variableTreeWidget.topLevelItem(0) for subpath in path[1:-1]: - # find the item given its name for child_id in range(item.childCount()): if item.child(child_id).text(0) == subpath: @@ -558,17 +557,14 @@ def __load_mat_file(self, file_name): if not self.meshcat_provider.load_model( self.signal_provider.joints_name, self.signal_provider.robot_name ): + # if not loaded we print an error but we continue msg = "Unable to load the model: " if self.meshcat_provider.custom_model_path: msg = msg + self.meshcat_provider.custom_model_path else: msg = msg + self.signal_provider.robot_name - self.logger.write_to_log( - "Unable to load the model from: " - + self.meshcat_provider.custom_model_path - ) - return + self.logger.write_to_log(msg) # populate tree root = list(self.signal_provider.data.keys())[0]