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

[rostopic] Fix rostopic echo for non rosmsg field #909

Merged
merged 4 commits into from
Sep 30, 2016
Merged
Changes from 1 commit
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: 6 additions & 0 deletions tools/rostopic/src/rostopic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,12 @@ def eval_fn(m):

def create_value_transform(echo_nostr, echo_noarr):
def value_transform(val):
if not isinstance(val, genpy.Message):
if echo_nostr and isinstance(val, str):
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this instead:

return '<string length: %s>' % len(val)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

elif echo_noarr and isinstance(val, list):
return None
Copy link
Member

@dirk-thomas dirk-thomas Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I don't see how we could print the type information (<array type: ??? ...>):

return '<array length: %s>' % len(val)

return val

class TransformedMessage(genpy.Message):
# These should be copy because changing these variables
Expand Down