enhance(ros2agnocast): avoid unnecessary get_topic_names_and_types in topic info_agnocast#1236
Draft
enhance(ros2agnocast): avoid unnecessary get_topic_names_and_types in topic info_agnocast#1236
get_topic_names_and_types in topic info_agnocast#1236Conversation
Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
get_topic_names_and_types in topic info_agnocast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Optimize
ros2 topic info_agnocastby removing the expensiveget_topic_names_and_types()call that fetched all topics just to look up the type of a single topic.Problem
The command made 3 ROS2 API calls:
get_topic_names_and_types()— fetched all topics to find the type of the target topicget_publishers_info_by_topic()— called insideprint_publishers_infoget_subscriptions_info_by_topic()— called insideprint_subscribers_infoChange
get_topic_names_and_types()entirelyget_publishers_info_by_topic()andget_subscriptions_info_by_topic()once inmain, extract the topic type from the results, and pass them to the print functionsRelated links
How was this PR tested?
bash scripts/test/e2e_test_1to1.bash(required)bash scripts/test/e2e_test_2to2.bash(required)bash scripts/test/run_requires_kernel_module_tests.bash(required)Notes for reviewers
Version Update Label (Required)
Please add exactly one of the following labels to this PR:
need-major-update: User API breaking changesneed-minor-update: Internal API breaking changes (heaphook/kmod/agnocastlib compatibility)need-patch-update: Bug fixes and other changesImportant notes:
need-major-updateorneed-minor-update, please include this in the PR title as well.fix(foo)[needs major version update]: barorfeat(baz)[needs minor version update]: quxrun-build-testlabel. The PR can only be merged after the build tests pass.See CONTRIBUTING.md for detailed versioning rules.