Skip to content

Contribution diagnostic calculations are incorrect #45

Description

@anssih

Looking at the code, the contribution calculations do not seem correct.

The code has

      i_contrib = pid._integral * ki

but pid._integral has already been multiplied by ki within simple-pid.

For D the code has

      d_contrib = pid._last_output - output if pid._last_output is not None else 0.0

but as far as I can see it should be (error - last_error) / sample period.

The simple-pid module has support for getting the contributions, so AFAICS we could just use that instead:

      p_contrib, i_contrib, d_contrib = pid.components

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions