-
Notifications
You must be signed in to change notification settings - Fork 161
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 echo for big array messages #126
Conversation
ros2topic/ros2topic/verb/echo.py
Outdated
@@ -201,7 +201,7 @@ def msg_to_ordereddict(msg, truncate_length=None): | |||
# We rely on __slots__ retaining the order of the fields in the .msg file. | |||
for field_name in msg.__slots__: | |||
value = getattr(msg, field_name, None) | |||
value = _convert_value(value) | |||
value = _convert_value(value, truncate_length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since truncate_length
is a keyword argument please pass it explicitly as such: truncate_length=truncate_length
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dirk-thomas thanks for review, updated the code.
Issue1: ros2 topic echo pointcould2(big arrays), has no response, updated the logical to make more sensible. a. (by default) full_length=false, truncate_length=128, then print max 128 (fix big arrays issue) b. pass truncate_length=X, then print max X. c. pass full_length=true (whatever truncate_length), then set truncate_length=None and print full_length. Issue2: missed truncate_length to _convert_value(). Since truncate_length is a key argument, pass it explicitly to _convert_value() Signed-off-by: Chris Ye <chris.ye@intel.com>
77066b2
to
90572bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks @yechun1 for the patch!
One surprising thing (but not directly related to this change) is that we sometimes end up with '...' and sometimes with '.....' for the truncated part (note it's 5 and not 6 dots, pretty surprising). As this is a minor detail compared to the improvement provided by this PR, I'll merge this as is a look at or ticket the minor display hiccup e.g.:
|
Is the "minor display hiccup" introduced by this PR or can it be reproduced without? If it is the former this shouldn't be merged until the "hiccup" is addressed. If it is the latter this can be safely merged and the "hiccup" should be fixed (or at least ticketed if the time to fix it is significant). |
As the truncation doesnt work without this patch, not sure how to reproduce it without applying this. I'll have a quick look at the hiccup later today and will merge this + ticket or fix the hiccup before end of day |
root caused the issue related with previous code which inside nested _convert_value function. Execute: "ros2 topic echo /topic -l 2" with test code, first time convert data to (first if, for t in (bytes, list, str, tuple))
second time call nested convert_value by (second elfi, for t in (list, tuple)) while "ros2 topic echo /topic -l 3" is correct Is it possible to remove nested function for _convert_value, it's a little difficult to understand. |
* Complete launch file name for launch files not arguments Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Expose get_launch_file_paths Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Suppress invalid file completions Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Complete launch files in first argument Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Don't complete recursive launch files Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Typo in comment Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * style Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Add is_launch_file and expose it Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Reuse argcomplete machinery for paths Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * dict() instead of dictionary comprehension Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Remove unnecessary basename() call Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Compatibility with argcomplete==1.8.1 Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * is_launch_file takes normal arg Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Issue1: ros2 topic echo pointcould2(big arrays), has no response, updated the logical to make more sensible.
Issue2: pass truncate_length to _convert_value(), this should be required.
Signed-off-by: Chris Ye chris.ye@intel.com
connect to #127