Skip to content

Warn when PIDController.calculate() is called without a set setpoint #8605

@pusheeeeeeeen

Description

@pusheeeeeeeen

Is your feature request related to a problem? Please describe.
I was recently refactoring some code using a PIDController, and ended up (intentionally) removing a call to setSetpoint(). However, I forgot to update the call to calculate() to use the two-argument overload with a setpoint, meaning that it was calculating based on the default setpoint of 0.0.

Describe the solution you'd like
Print a warning or error if the one-argument overload for calculate() is called before a setpoint has been set, making use of the existing m_haveSetpoint field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: wpimathMath librarytype: featureBrand new functionality, features, pages, workflows, endpoints, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions