Skip to content

PID controller class #63

@ethanmusser

Description

@ethanmusser

Feature request for a proportional-derivative (or perhaps proportional-integral-derivative) controller class.

Desired Behavior

Users can utilize the PD/PID controller class for applicable use-cases, or implement their own, more advanced controllers through child classes.

Minimal Proposed Implementation

  • ControllerBase: An abstract class template that is templated for input type. Contains generic functions applicable to controllers, including:
    • ControllerBase - Default constructor.
    • Update - Pure virtual method that computes the controller output from the latest signal and set-point.
    • set_set_point
    • set_gains (maybe, might live in the child classes)
  • PIDController: A child class to Controller that implements a discrete-time PID controller.

Desired Features

  • ControllerBase:
    • Templated for various scalar types, Eigen vectors, std::vector, and std::array.
  • PIDController:
    • Deadband and saturation
    • Custom error functions (e.g., e^2, sqrt(e)) via a function handle
    • Support for both:
      • passing in the error terms on update
      • computing these terms internally (e.g., derivative term based on previous proportional term and dt)

Later Features

  • Support for defining a controller from a transfer function.
  • ControllerBase child classes for more controllers, including:
    • BandBangController
    • ActiveDampingController

References

This code might be a good jumping-off point for the PID controller.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgood first issueGood for newcomerspriority-medMedium priority issuesquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions