-
Notifications
You must be signed in to change notification settings - Fork 112
Add derivative filter and discretization #471
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
base: ros2-master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## ros2-master #471 +/- ##
===============================================
+ Coverage 78.86% 78.93% +0.06%
===============================================
Files 29 29
Lines 1893 2046 +153
Branches 119 123 +4
===============================================
+ Hits 1493 1615 +122
- Misses 332 362 +30
- Partials 68 69 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Hi, @christophfroehlich! I still need to fix the existing tests and add new ones. However, the equations are quite large, and the compute_command function has grown a lot. Do you think it’s acceptable (with better organization), or should something be changed? |
IMHO it is acceptable to go further in this direction, thanks! |
Overview
Adds a configurable derivative filter. It also introduces separate discretization method selectors for the I and D terms. Forward Euler remains the default to preserve existing behavior.
What was added/changed in this PR
tf
) applied to the D term.i_method
andd_method
(e.g.,"forward_euler"
,"backward_euler"
,"trapezoidal"
), with"forward_euler"
as the default.tf == 0
.d_term_last_
,d_error_last_
,i_term_last_
,aw_term_last_
) to support trapezoidal (Tustin) and filtered updates.About tests
The packages compile correctly and have passed the pre‑commit and colcon tests. New tests are being added based on formula values to compare with those from
compute_command
.Related PR's
Attachments
Full derivation of the discrete-time PID used in this PR. The document shows the step-by-step development of the equations.
ros2_control_new_discretization_feature.pdf
Why is this a draft?
Final notes
I'm very open to any recommendations to improve this code.