You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add getters for the gains, timestep and output limits of Pid #378
What: Pid stores its three gains, its timestep and its output limits, but the only value a caller can read back is integral(). A caller cannot log the gains in use or check them after set_gains. The other controllers have getters, for example GeometricAttitudeController::integral_gain, attitude_gain and rate_gain. Add these methods, each with #[inline] and #[must_use]:
proportional_gain(&self) -> T
integral_gain(&self) -> T
derivative_gain(&self) -> T
timestep(&self) -> T
output_limits(&self) -> (T, T), which returns (minimum, maximum)
integral_gain is the gain. It is not the accumulated term that integral() returns.
Where: crates/multicalc/src/control/pid.rs. Copy the getters in crates/multicalc/src/control/geometric_attitude.rs. Tests go in crates/multicalc/tests/suite/control/pid.rs.
How to test: cargo test -p multicalc. Build Pid::new(2.0, 0.5, 0.1, 0.01).unwrap(), and assert that each getter returns the value passed in, and that output_limits() is (f64::NEG_INFINITY, f64::INFINITY). Call with_output_limits(-3.0, 4.0) and assert (-3.0, 4.0). Call set_gains(1.0, 0.2, 0.05) and assert the three new gains.
Activity