Skip to content

Use preallocated feedback from JTC to avoid heap allocation#2160

Open
saikishor wants to merge 1 commit into
ros-controls:masterfrom
pal-robotics-forks:jtc/preallocate_feedback
Open

Use preallocated feedback from JTC to avoid heap allocation#2160
saikishor wants to merge 1 commit into
ros-controls:masterfrom
pal-robotics-forks:jtc/preallocate_feedback

Conversation

@saikishor

Copy link
Copy Markdown
Member

This PR adds a preallocated feedback variable to avoid head allocation in the RT loop. This PR was tested along with ros-controls/realtime_tools#486 to improve the realtimeness of the JTC

Thank you

@saikishor saikishor added backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. labels Feb 10, 2026
@codecov

codecov Bot commented Feb 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.79%. Comparing base (f72f813) to head (cbd0256).
⚠️ Report is 61 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2160   +/-   ##
=======================================
  Coverage   84.79%   84.79%           
=======================================
  Files         151      151           
  Lines       14833    14833           
  Branches     1286     1286           
=======================================
  Hits        12578    12578           
  Misses       1784     1784           
  Partials      471      471           
Flag Coverage Δ
unittests 84.79% <100.00%> (ø)

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

Files with missing lines Coverage Δ
...jectory_controller/joint_trajectory_controller.hpp 50.00% <ø> (ø)
...ory_controller/src/joint_trajectory_controller.cpp 83.88% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The idea LGTM, but I suggest moving the initialization to a different place

Comment on lines +1938 to +1941

// Pre-allocate feedback message to avoid heap allocation in RT loop
preallocated_feedback_ = std::make_shared<FollowJTrajAction::Feedback>();
preallocated_feedback_->joint_names = params_.joints;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has nothing to do with the hold_position message.
let's move this to the on_configure, or rename the method.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right. Sorry

@bmagyar bmagyar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions Bot added the stale label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. stale

Projects

Status: WIP

Development

Successfully merging this pull request may close these issues.

3 participants