Skip to content

Commit

Permalink
🐛 Fix the loading of the text logging when the message is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Oct 6, 2023
1 parent ba3ce7a commit 83060a8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions robot_log_visualizer/file_reader/signal_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]

Expand Down

0 comments on commit 83060a8

Please sign in to comment.