-
Notifications
You must be signed in to change notification settings - Fork 118
Add std::vector<double> option to the low pass filter #340
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
Add std::vector<double> option to the low pass filter #340
Conversation
christophfroehlich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
In principle we have this missing in every filter, which is applicable to a double. Maybe we should use the upstream MultiChannelFilter instead? https://github.com/ros/filters/blob/ros2/include/filters/filter_base.hpp#L285C7-L285C29 |
If we did that we would need a new header and class for each filter type correct? For example: What does MultiChannel buy us over the current approach? You still need to write Technically in the hardware_interface I'm writing I am directly using the control_toolbox::LowPassFilter because I don't have any access to the node the interface is running in and that seems to be a requirement to use a That is I assume because my hw_interface doesn't have access to this ROS stuff it segfaults if I try to call configure() on a |
|
Oh, I see your point. Using the LPF without |
saikishor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the minor comments, @MarqRazz have you considered using Eigen::VectorXd instead of std::vector? I think it is better to use Eigen::VectorXd
xguay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the changes that have already been requested.
May want to consider wrapping one update with the other so there's only one source of logic. It's unusual but I'd suggest wrapping the vector version in the original. i.e. put the value in a vector then feed it to the vector based updater. It will create a single source of logic. You also get the benefit of doing checks once, instead of every index like you would if you wrapped the other way.
So internally you think it would be better to convert between Eigen and std::vector on each update()? What does switching to Eigen add for us here? |
|
The |
Try with a sequential executor |
I tried and it didn't help so I could be wrong about what is hanging, but it is flaky. Can you enable the tests and lets see how it goes? I'm also testing this on the I was surprised that I needed to declare my parameters in testing the vector double calculation and it isn't required in the others. Here is the full output of the other package failing. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ros2-master #340 +/- ##
===============================================
- Coverage 77.67% 77.41% -0.26%
===============================================
Files 29 29
Lines 1272 1333 +61
Branches 85 92 +7
===============================================
+ Hits 988 1032 +44
- Misses 239 250 +11
- Partials 45 51 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
I mean not only internally, but also to the method's inputs and outputs. Eigen is especially efficient if the vector is larger. Moreover, it has some operations that lets you do operations on whole vector at same time |
I would suggest we add another type in a different PR. I am using |
christophfroehlich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor suggestion, otherwise this looks fine!
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
|
Thanks for the quick responses guys! ❤️ Could we please back port to Jazzy 🙏 |
saikishor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a minor thing
saikishor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b1f2619
into
ros-controls:ros2-master
(cherry picked from commit b1f2619)
This PR adds the option to create a
LowPassFilterobject with typestd::vector<double>(seeing that most system interfaces are this type 😄 )The velocity data from my robot is noisy so I needed to clean it up


to