Repository navigation
pidgeon 1.0.0: correctness fixes, Iggy removal, docs rewrite - #22
Merged
Merged
Conversation
- Fix 10 bugs in the core and the std wrappers, each proven by a regression test that fails on 0.3.x: conditional anti-windup lock-up, back-calculation divergence, default builder failing, unvalidated setters panicking in clamp, NaN-poisoned stats, wrong overshoot, wall-clock statistics, deadband leaking into the OnError derivative, overflow returning Ok(NaN). - Add PidTerms and last_terms(); make the setters consistent and validated. - Remove the Iggy-based `debugging` feature, the pidgeoneer dashboard and the demo script. The ratatui drone example is the visualization story. - Keep the `wasm` feature and add a wasm32 check to CI. - Rewrite the README and crate docs, add a temperature_control example, and cut dead code and narration comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Restore 0.3 signatures and shapes: PidError without non_exhaustive and with MutexPoisoned std-only, ControllerStatistics with its four f64 fields, set_output_limits/set_settled_threshold returning (), and deadband taking abs(). Bug fixes that only change values stay. - PidController::set_output_limits now panics immediately on invalid limits instead of on the next compute(). - Edition 2024, rust-version 1.85, with a CI job that checks the library on 1.85. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library uses a matches! guard instead of a let-chain, so it still builds on Rust 1.85. The examples need 1.88 for ratatui anyway, so they take clippy's let-chain and is_multiple_of suggestions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Three audits went through the whole crate: math and correctness, ease of use, and cruft. This PR is the result, and it bumps pidgeon to 1.0.0.
Code written against 0.3 still compiles
1.0 keeps the 0.3 API. Every public signature, field and enum variant is unchanged, except for the removed
debuggingfeature (see below). To prove it, main's owncore_tests.rs,std_tests.rsanddrone_altitude_control.rswere compiled unmodified against this branch: all 14 tests compile and pass, and the example compiles.Bugs fixed (each proven by a test that fails on
mainand passes here)regression_tests::conditional_anti_windup_unwinds_integral_beyond_limitconditional_anti_windup_output_matches_stored_integraldt/Ttdiverged oncedt > 2*Tt; it now uses backward Eulerdt/(Tt+dt)back_calculation_is_stable_when_dt_exceeds_tracking_time,back_calculation_matches_backward_eulerControllerConfig::builder().build()always failed: the default limits were ±inf, whichbuild()rejecteddefault_builder_buildsDerivativeMode::OnErrordifferentiated the error after the deadbandon_error_derivative_ignores_deadbandOk(NaN)and poisoned the stateoverflow_is_an_error_not_a_nanset_output_limits(5, -5)stored bad limits, and the nextcompute()panicked insidef64::clampstd_regression_tests::set_output_limits_panics_at_once_and_keeps_old_limits,thread_safe_set_output_limits_rejects_bad_limitsaverage_errorNaN foreverrejected_sample_does_not_poison_statisticsdtstatistics_use_controller_time_not_wall_clockmax_overshootwas really the largest error, which for a step is just the step sizeovershoot_is_distance_past_setpoint_not_initial_errorBehaviour that changes (no code changes needed)
PidController::set_output_limitswith invalid limits now panics right away with a clear message, instead of on the nextcompute().ThreadSafePidController::set_output_limitsreturnsErr, as its signature always said it could.dt), and statistics restart when the setpoint changes.PidState::prev_errorholds the raw error, so the deadband no longer leaks into theOnErrorderivative.Breaking on purpose
debuggingfeature is removed, along withdebug.rs, the debug example, thepidgeoneerdashboard andrun_pidgeon_demo.sh. Anyone withfeatures = ["debugging"]gets a Cargo error. To watch a controller live, use the ratatuidrone_altitude_controlexample, which reads the P/I/D terms from the newlast_terms().stdandno_stdmode. Running the tests and examples needs Rust 1.88, because ratatui's dependencies require it.Kept
wasmfeature is unchanged, and CI now checks it onwasm32-unknown-unknown.Additions
PidTermsandlast_terms()on both controllers.update_configandset_anti_windup_modeonPidController;set_anti_windup_mode,set_anti_windup,config()andstate()onThreadSafePidController.ControllerConfig::to_builder(), plus extra derives.pure_pid_computebenchmark.temperature_controlexample.Docs and cleanup
CLAUDE.mdmatches the code.no_std, wasm32 and MSRV checks.Verified locally
cargo test(38 unit + 10 doc),fmt --check,clippy --all-targets -D warnings, theno_stdcheck, wasm32 clippy with--features wasm, benches clippy,build --examples,cargo doc -D warnings,cargo publish --dry-run.cargo checkof the library,stdandno_std.Not run: the drone TUI example is interactive, so it was built but not executed.
The
CHANGELOG.mdentry is left to release-plz.🤖 Generated with Claude Code