Conditional deserialization of message for ros2 topic hz (backport #1005)
#1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #983
Added a conditional statement to set the
rawflag when creating subscriptions for topics based on the value offilter_expr. If the--filterflag is used,filter_expris not None and deserializing subscriptions are created. Otherwisefilter_expris None and 'raw' subscriptions are created.As for the
bwverb, it already uses 'raw' subscriptions and there is no case where desrialization of topics is required. Hence no changes made there.Manual Testing
$ ros2 topic hz /topic average rate: 2.002 min: 0.500s max: 0.500s std dev: 0.00000s window: 1 average rate: 2.000 min: 0.499s max: 0.501s std dev: 0.00105s window: 3 average rate: 2.000 min: 0.499s max: 0.501s std dev: 0.00084s window: 5$ ros2 topic hz /topic --filter 'int(m.data.rpartition(\"! \")[-1]) % 2 == 0' average rate: 1.000 min: 1.000s max: 1.000s std dev: 0.00000s window: 1 average rate: 1.000 min: 0.999s max: 1.000s std dev: 0.00024s window: 2 average rate: 1.000 min: 0.999s max: 1.001s std dev: 0.00065s window: 3