Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle data samples with varying shape #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions rqt_bag_plugins/src/rqt_bag_plugins/plot_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,25 @@ def _resample_thread(self):
# the minimum and maximum values present within a sample
# If the data has spikes, this is particularly bad because they
# will be missed entirely at some resolutions and offsets
if x[path] == [] or (entry[2] - self.start_stamp).to_sec() - x[path][-1] >= self.timestep:
y_value = entry[1]
for field in path.split('.'):
index = None
if field.endswith(']'):
field = field[:-1]
field, _, index = field.rpartition('[')
y_value = getattr(y_value, field)
if index:
index = int(index)
y_value = y_value[index]
y[path].append(y_value)
x[path].append((entry[2] - self.start_stamp).to_sec())
try:
if x[path] == [] or (entry[2] - self.start_stamp).to_sec() - x[path][-1] >= self.timestep:
y_value = entry[1]
for field in path.split('.'):
index = None
if field.endswith(']'):
field = field[:-1]
field, _, index = field.rpartition('[')
y_value = getattr(y_value, field)
if index:
index = int(index)
y_value = y_value[index]
y[path].append(y_value)
x[path].append((entry[2] - self.start_stamp).to_sec())
except IndexError as ex:
rospy.loginfo_throttle_identical(
1, "Failure accessing {}[{}] in {}: {}".format(field, index, path, str(ex)))
pass


# TODO: incremental plot updates would go here...
# we should probably do incremental updates based on time;
Expand Down