Repository navigation
Initialize the wrench filter state with NaN explicitly - #693
Merged
christophfroehlich merged 1 commit intoNov 11, 2026
Merged
christophfroehlich merged 1 commit into
christophfroehlich merged 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions
Bot
requested review from
MarqRazz,
Maverobot,
aprotyas,
destogl and
mhubii
November 10, 2026 17:08
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #693 +/- ##
==========================================
+ Coverage 83.72% 83.77% +0.05%
==========================================
Files 32 32
Lines 2224 2231 +7
Branches 130 130
==========================================
+ Hits 1862 1869 +7
Misses 277 277
Partials 85 85
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change making wrench filter initialization independent of Eigen include order.
No open issues 🎉
What changed in this PR
Makes wrench filter initialization independent of Eigen include order and constructor behavior, so unseeded filters initialize from the first sample rather than garbage or zero.
Changes:
- Explicitly fills
WrenchStampedfilter storage with NaN. - Removes the public header’s
EIGEN_INITIALIZE_MATRICES_BY_NANdefinition. - Adds a first-sample regression test with Eigen included before the filter headers.
| File | Description |
|---|---|
control_toolbox/test/low_pass_filter_tests.cpp |
Includes Eigen first and tests that an unseeded wrench filter returns its first input. |
control_toolbox/include/control_toolbox/filter_traits.hpp |
Replaces macro-dependent initialization with explicit NaN values. |
Review effort: Balanced
This was referenced Nov 11, 2026
christophfroehlich
pushed a commit
that referenced
this pull request
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The `WrenchStamped` filter traits relied on `EIGEN_INITIALIZE_MATRICES_BY_NAN`, defined in `filter_traits.hpp`, to mark the filter state as uninitialized. The macro has no effect if Eigen was included before this header, and inline Eigen constructors can also be bound to the definition from another shared library loaded in the same process. In that case, the state is uninitialized memory instead of NaN, so `LowPassFilter` (and `ExponentialFilter`) do not initialize from the first sample but start from garbage/zero.
Observed in the admittance_controller (ros-controls/ros2_controllers#560): after activation, the filtered wrench ramps up from zero, i.e., the gravity compensation outputs a fake force (~20 N in the test) for the first updates.
Changes:
🤖 Generated with Claude Code