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

[pid_controller] Fix logic for feedforward_mode with single reference interface #1520

Merged

Conversation

Juliaj
Copy link
Contributor

@Juliaj Juliaj commented Feb 4, 2025

Address #1270. The scope of the fix only covers single reference interface. The changes for two reference interfaces will be covered in different PR.

Testing of the code changes was done with ros-controls/ros2_control_demos#710.

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.29%. Comparing base (28845e6) to head (fdfff96).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
pid_controller/src/pid_controller.cpp 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1520      +/-   ##
==========================================
+ Coverage   84.26%   84.29%   +0.03%     
==========================================
  Files         123      123              
  Lines       11358    11400      +42     
  Branches      961      966       +5     
==========================================
+ Hits         9571     9610      +39     
- Misses       1471     1474       +3     
  Partials      316      316              
Flag Coverage Δ
unittests 84.29% <93.33%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
pid_controller/test/test_pid_controller.cpp 100.00% <100.00%> (ø)
pid_controller/test/test_pid_controller.hpp 84.78% <ø> (ø)
pid_controller/src/pid_controller.cpp 67.39% <50.00%> (-1.03%) ⬇️

... and 5 files with indirect coverage changes

.gitignore Outdated Show resolved Hide resolved
pid_controller/src/pid_controller.cpp Outdated Show resolved Hide resolved
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.

TBH, I don't understand the use-case for the set_feedforward_control service, but your change looks correct. Thanks for fixing this.

Would you mind writing a test for both branches, with a non-zero feedforward_gain?

.gitignore Outdated Show resolved Hide resolved
pid_controller/src/pid_controller.cpp Outdated Show resolved Hide resolved
pid_controller/src/pid_controller.cpp Outdated Show resolved Hide resolved
pid_controller/src/pid_controller.cpp Outdated Show resolved Hide resolved
@Juliaj
Copy link
Contributor Author

Juliaj commented Feb 6, 2025

Would you mind writing a test for both branches, with a non-zero feedforward_gain?

I added a test case to cover the single interface. For the use case of two reference interfaces, I need some time to review the current code especially around measured_state_values_ handling. I would also like to update some of the existing tests with more validation steps. I can do these in a follow up PR.

@Juliaj
Copy link
Contributor Author

Juliaj commented Feb 7, 2025

@catcracker, this is to address the suggestions you made in #1260 (comment). If you have some bandwidth, could you review and give it a spin?

@christophfroehlich christophfroehlich linked an issue Feb 10, 2025 that may be closed by this pull request
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.

Would you mind writing a test for both branches, with a non-zero feedforward_gain?

I added a test case to cover the single interface. For the use case of two reference interfaces, I need some time to review the current code especially around measured_state_values_ handling. I would also like to update some of the existing tests with more validation steps. I can do these in a follow up PR.

sure, let's do that. A simple request for testing the actual command value without feedforward. (or is there another existing test, but I can't find it now).

pid_controller/test/test_pid_controller.cpp Outdated Show resolved Hide resolved
@Juliaj
Copy link
Contributor Author

Juliaj commented Feb 13, 2025

@christophfroehlich , @saikishor , I updated the code per your feedback. Could you give it another look when you have the chance ?

P.S. Additional tests have been added to #1538.

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.

Thx for the latest added test

@christophfroehlich christophfroehlich enabled auto-merge (squash) February 13, 2025 13:36
@christophfroehlich christophfroehlich added the backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble. label Feb 13, 2025
saikishor
saikishor previously approved these changes Feb 13, 2025
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.

LGTM
Thanks for the tests
Just a couple minor and good to be merged ;)

pid_controller/test/test_pid_controller.cpp Outdated Show resolved Hide resolved
pid_controller/test/test_pid_controller.cpp Outdated Show resolved Hide resolved
pid_controller/test/test_pid_controller.cpp Outdated Show resolved Hide resolved
pid_controller/test/test_pid_controller.cpp Outdated Show resolved Hide resolved
@saikishor saikishor disabled auto-merge February 13, 2025 16:10
Co-authored-by: Sai Kishor Kothakota <[email protected]>
@christophfroehlich christophfroehlich dismissed stale reviews from saikishor and themself via fcb41c9 February 13, 2025 16:13
@christophfroehlich christophfroehlich merged commit cf8b96e into ros-controls:master Feb 13, 2025
20 of 26 checks passed
mergify bot pushed a commit that referenced this pull request Feb 13, 2025
@Juliaj
Copy link
Contributor Author

Juliaj commented Feb 13, 2025

Thank you, @christophfroehlich and @saikishor for your review feedback. @christophfroehlich , ❤️ much appreciated for the changes you made to help merge this.

@Juliaj Juliaj deleted the pid_controller_feedforward_1270_1 branch February 13, 2025 18:14
christophfroehlich pushed a commit that referenced this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants