Documentation
¶
Overview ¶
Packege pidctrl implements a PID controller.
Index ¶
- type MinMaxError
- type PIDController
- func (c *PIDController) Get() float64
- func (c *PIDController) OutputLimits() (min, max float64)
- func (c *PIDController) PID() (p, i, d float64)
- func (c *PIDController) Set(setpoint float64) *PIDController
- func (c *PIDController) SetOutputLimits(min, max float64) *PIDController
- func (c *PIDController) SetPID(p, i, d float64) *PIDController
- func (c *PIDController) Update(value float64) float64
- func (c *PIDController) UpdateDuration(value float64, duration time.Duration) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MinMaxError ¶
type MinMaxError struct {
// contains filtered or unexported fields
}
func (MinMaxError) Error ¶
func (e MinMaxError) Error() string
type PIDController ¶
type PIDController struct {
// contains filtered or unexported fields
}
PIDController implements a PID controller.
func NewPIDController ¶
func NewPIDController(p, i, d float64) *PIDController
NewPIDController returns a new PIDController using the given gain values.
func (*PIDController) Get ¶
func (c *PIDController) Get() float64
Get returns the setpoint of the controller.
func (*PIDController) OutputLimits ¶
func (c *PIDController) OutputLimits() (min, max float64)
OutputLimits returns the min and max output values
func (*PIDController) PID ¶
func (c *PIDController) PID() (p, i, d float64)
PID returns the P, I, and D constants
func (*PIDController) Set ¶
func (c *PIDController) Set(setpoint float64) *PIDController
Set changes the setpoint of the controller.
func (*PIDController) SetOutputLimits ¶
func (c *PIDController) SetOutputLimits(min, max float64) *PIDController
SetOutputLimits sets the min and max output values
func (*PIDController) SetPID ¶
func (c *PIDController) SetPID(p, i, d float64) *PIDController
SetPID changes the P, I, and D constants
func (*PIDController) Update ¶
func (c *PIDController) Update(value float64) float64
Update is identical to UpdateDuration, but automatically keeps track of the durations between updates.
func (*PIDController) UpdateDuration ¶
func (c *PIDController) UpdateDuration(value float64, duration time.Duration) float64
UpdateDuration updates the controller with the given value and duration since the last update. It returns the new output.