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

[Joint State Broadcaster] Move urdf::Model initialization from on_activate to on_configure to enhance real-time performance #1269

Merged

Conversation

TakashiSato
Copy link
Contributor

This PR aims to enhance real-time performance during the activation of the Joint State Broadcaster, which was introduced in #1233.

The urdf::Model initialization (here), previously executed within the on_activate function, incurred a substantial amount of time, leading to significant jitter in the Controller Manager's real-time loop.

To address this, the initialization of the urdf::Model has been relocated from on_activate to on_configure, as it can be effectively performed beforehand. In my testing environment, this modification has resulted in a remarkable improvement, accelerating the on_activate process by approximately 40 times (reducing the time from 5ms to 0.12ms).

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Makes sense for me, thanks!

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.40%. Comparing base (20f6f0b) to head (9d33a34).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1269      +/-   ##
==========================================
- Coverage   80.42%   80.40%   -0.02%     
==========================================
  Files         105      105              
  Lines        9354     9356       +2     
  Branches      818      821       +3     
==========================================
  Hits         7523     7523              
  Misses       1557     1557              
- Partials      274      276       +2     
Flag Coverage Δ
unittests 80.40% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
..._state_broadcaster/src/joint_state_broadcaster.cpp 86.53% <100.00%> (-0.65%) ⬇️

... and 4 files with indirect coverage changes

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Sure. Makes sense.

Thank you for the PR

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

great catch, thank you!

@bmagyar bmagyar merged commit 1c4d58e into ros-controls:master Aug 24, 2024
18 of 20 checks passed
@TakashiSato TakashiSato deleted the feature/reduce_jsb_activation_time branch August 25, 2024 12:18
RobertWilbrandt pushed a commit to RobertWilbrandt/ros2_controllers that referenced this pull request Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants