Skip to content

Add gain getters to MahonyFilter and MadgwickFilter #379

Done

Description

@kmolan

What: the gains of the two attitude filters are set with with_* builders, but a caller cannot read them back. Add these methods, each with #[inline] and #[must_use]:

  • MahonyFilter::proportional_gain(&self) -> T and MahonyFilter::integral_gain(&self) -> T
  • MadgwickFilter::correction_gain(&self) -> T and MadgwickFilter::bias_gain(&self) -> T

Copy the existing orientation and gyroscope_bias getters in the same files.

Where: crates/multicalc/src/estimation/mahony_filter.rs and crates/multicalc/src/estimation/madgwick_filter.rs. Tests go in crates/multicalc/tests/suite/estimation/attitude_filter.rs.

How to test: cargo test -p multicalc. Assert the defaults of new(SO3::identity()): Mahony 1.0 and 0.1, Madgwick 0.1 and 0.01. Assert that each with_* builder round-trips, for example MahonyFilter::new(SO3::identity()).with_proportional_gain(2.5).proportional_gain() == 2.5. Do the same in f32.

Activity

  1. added
    help wanted
    good first issue
    ergonomics
    estimation
    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

    ergonomicsestimationgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions