Skip to content

Negative I coefficients (i.e. setDirection(true)) are broken with respect to setMaxIOutput() #14

@bmartin427

Description

@bmartin427

If the I coefficient is negative, then the expression maxError=maxIOutput/I will be negative, resulting in the later expression errorSum=clamp(errorSum+error,-maxError,maxError) always returning maxError or largest possible negative value. The very next tick this will bump against the minOutput and get reset, with the result that any negative I coefficient will cause the output to continuously alternate between a small value and a large negative value every other tick.

I think the maxError expression needs to divide by abs(I).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions