Optimize joint state broadcaster execution time#2159
Open
saikishor wants to merge 2 commits intoros-controls:masterfrom
Open
Optimize joint state broadcaster execution time#2159saikishor wants to merge 2 commits intoros-controls:masterfrom
saikishor wants to merge 2 commits intoros-controls:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2159 +/- ##
==========================================
- Coverage 84.79% 84.77% -0.03%
==========================================
Files 151 151
Lines 14833 14846 +13
Branches 1286 1289 +3
==========================================
+ Hits 12578 12586 +8
- Misses 1784 1788 +4
- Partials 471 472 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| // Used for optimization when publish_dynamic_joint_states is false | ||
| std::vector<size_t> joint_state_interface_indices_; | ||
|
|
||
| // Pre-computed pointers to name_if_value_mapping_ values for joint state interfaces |
Contributor
There was a problem hiding this comment.
Sorry for nitpicking :)
Suggested change
| // Pre-computed pointers to name_if_value_mapping_ values for joint state interfaces | |
| // Caches pointers to name_if_value_mapping_ values for joint state interfaces |
Here I think caches suits better.
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.
Hello!
When testing the joint state broadcaster on high-frequency systems, it is observed that it is taking around 120-140 microseconds of execution, and it doesn't improve even when we choose to set the parameter
publish_dynamic_joint_states: false. So, upon closer look, it seems like it always does the whole map lookup of the interfaces and it is consuming quite some time. When running 2 of these broadcaster it consumes half of our cycle time.This PR proposes minor improvements that reduce the execution time by 70%
With the current state:

With the proposed fix:

Tested on TALOS robot by setting parameter
publish_dynamic_joint_states: false