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

Fix raw view #94

Merged
merged 2 commits into from
Feb 11, 2021
Merged
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
6 changes: 5 additions & 1 deletion rqt_bag/src/rqt_bag/plugins/raw_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
# compatibility fix for python2/3
try:
long
bytes_to_str = str
except NameError:
long = int
def bytes_to_str(x):
return codecs.utf_8_decode(str(x).encode(), 'ignore')[0]


class RawView(TopicMessageView):
name = 'Raw'
Expand Down Expand Up @@ -204,7 +208,7 @@ def _add_msg_object(self, parent, path, name, obj, obj_type):

elif type(obj) in [str, bool, int, long, float, complex, rospy.Time]:
# Ignore any binary data
obj_repr = codecs.utf_8_decode(str(obj).encode(), 'ignore')[0]
obj_repr = bytes_to_str(obj)

# Truncate long representations
if len(obj_repr) >= 50:
Expand Down