Repository navigation
fix: reject a PID d_filter_alpha of 0 - #20
Merged
Merged
Conversation
With alpha 0 the derivative filter never moved, so the derivative gain had no effect after init and the last derivative term stayed as a constant output offset after set_config. The accepted range is now (0, 1.0]; init and set_config return FPC_STATUS_INVALID_PARAM for 0. Refs #19
3 tasks done
4 tasks done
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.
Layer 1 of 1. A separate PR fixes the bumpless-transfer integral step.
What and why
fxp_lerp(D, R, 0)returnsD, so ad_filter_alphaof 0 froze the derivative term: it stayed 0 afterfpc_pid_init, and afterfpc_pid_set_configthe last term stayed as a constant output offset that onlyfpc_pid_resetcleared.fpc_pid_derivenow rejectsd_filter_alpha <= 0, so the range is (0, 1.0]. This matches the existing rule that a nonzero gain must not round to an inert term.test_invalid_config_rejectedrejects 0 throughinitand accepts the smallest positive value,FXP_RAW(1).test_set_config_clamps_staterejects 0 throughset_configand checks that the state is unchanged.docs/api.mdanddocs/design.mdstate the range (0, 1.0], and the CHANGELOG has aFixedentry.Acceptance criteria
Dmoves towards the raw derivative on every step.alpha = 0through bothinitandset_config. With the old< 0check, the suite fails.docs/api.mdanddocs/design.mdstate the range that is accepted.Checks
meson testunder ASan and UBSan: 2/2. The coverage gate is 100% of lines and branches.misch run --baseline,misch deviations,scripts/format.sh.-Dwerror=true: all build.Refs #19