Skip to content

Add getters for the gains, timestep and output limits of Pid #378

Done

Description

@kmolan

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

  1. added
    help wanted
    good first issue
    ergonomics
    control
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    controlergonomicsgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions