Skip to content

Conversation

@silanus23
Copy link

@silanus23 silanus23 commented Sep 29, 2025

I have tried to solve the issue on #365. Tried to go with the way of low_pass_filter:

  • Added support both std::vector<double> and geometry_msgs::msg::WrenchStamped.
  • Created a header in control_toolbox and making it use control_filters header.
  • Expanded tests in a way that it tests all data types and their results in the new style.

Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Copilot AI review requested due to automatic review settings September 29, 2025 08:44
@silanus23 silanus23 marked this pull request as draft September 29, 2025 08:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the exponential filter implementation to use a common backend filter from control_toolbox instead of maintaining separate logic. The refactoring introduces support for additional data types including std::vector<double> and geometry_msgs::msg::WrenchStamped.

  • Adds a new ExponentialFilter class in control_toolbox with template support for multiple data types
  • Updates control_filters::ExponentialFilter to delegate filtering operations to the control_toolbox implementation
  • Expands test coverage with comprehensive tests for the new data types and edge cases

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
control_toolbox/include/control_toolbox/exponential_filter.hpp New template-based exponential filter implementation with support for multiple data types
control_toolbox/include/control_filters/exponential_filter.hpp Refactored to use control_toolbox backend with specialized templates for WrenchStamped and vector
control_toolbox/src/control_filters/exponential_filter.cpp Added plugin exports for new supported data types
control_toolbox/test/control_filters/test_exponential_filter.cpp Comprehensive test suite covering all supported data types and edge cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

silanus23 and others added 2 commits September 29, 2025 11:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@silanus23 silanus23 marked this pull request as ready for review September 30, 2025 06:33
@silanus23 silanus23 mentioned this pull request Oct 1, 2025
8 tasks
@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 93.45794% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.73%. Comparing base (d12a587) to head (79f4b3f).

Files with missing lines Patch % Lines
...box/include/control_toolbox/exponential_filter.hpp 76.19% 2 Missing and 3 partials ⚠️
...box/include/control_filters/exponential_filter.hpp 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
+ Coverage   83.01%   83.73%   +0.71%     
==========================================
  Files          29       30       +1     
  Lines        1967     2078     +111     
  Branches      110      112       +2     
==========================================
+ Hits         1633     1740     +107     
  Misses        268      268              
- Partials       66       70       +4     
Flag Coverage Δ
unittests 83.73% <93.45%> (+0.71%) ⬆️

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

Files with missing lines Coverage Δ
...x/test/control_filters/test_exponential_filter.cpp 100.00% <100.00%> (ø)
...box/include/control_filters/exponential_filter.hpp 65.00% <60.00%> (-1.67%) ⬇️
...box/include/control_toolbox/exponential_filter.hpp 76.19% <76.19%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Thanks for the contribution. I think this can be simplified a bit, but maybe I've overseen something.

Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
@silanus23
Copy link
Author

@christophfroehlich Sorry for late response uncontrollabe delay. I copied the low_pass_filter structure. Seems like those specializations are unnecessary . Thanks for the review!

@christophfroehlich
Copy link
Contributor

no worries, thanks for coming back on this. I have removed the specialization in the master branch already, have a look.

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.

Thanks for the follow-up, there is only one open conversation left.

Signed-off-by: silanus23 <berkantali23@outlook.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

christophfroehlich and others added 2 commits November 1, 2025 21:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Some thoughts about filters::exponentialSmoothing, what do you think?


#include "control_toolbox/exponential_filter.hpp"
#include "control_toolbox/exponential_filter_parameters.hpp"
#include "control_toolbox/filters.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "control_toolbox/filters.hpp"

This is not needed any more here, right?

Traits::assign(storage_in, data_in);

// Exponential filter update: y[n] = α * x[n] + (1-α) * y[n-1]
old_value_ = storage_in * alpha_ + old_value_ * (1.0 - alpha_);
Copy link
Contributor

Choose a reason for hiding this comment

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

but here we could use filters::exponentialSmoothing if we also change that to a templated method, right?

static inline double exponentialSmoothing(
double current_raw_value, double last_smoothed_value, double alpha)
{
return alpha * current_raw_value + (1 - alpha) * last_smoothed_value;
}

we would increase code coverage for free then ;)

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.

3 participants