pid

package
v0.0.0-...-a41b70d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	// Output returns an output associated with the given input.
	Output(float64) float64
}

Controller is the interface for generic controllers that generate an output based on some input parameter.

func NewDController

func NewDController(kd float64) Controller

NewDController returns a new instance of a DController that uses the given kd multiplier.

func NewIController

func NewIController(ki float64) Controller

NewIController returns a new instance of an IController that uses the given ki multiplier.

func NewPController

func NewPController(kp float64) Controller

NewPController returns a new instance of a PController that uses the given kp multiplier.

func NewPIDController

func NewPIDController(kp, ki, kd, minOutput, maxOutput float64) Controller

NewPIDController returns a new PIDController instance that use the given kp, ki and kd values as multipliers for the associated individual components (proportional, integral and derivative). minOutput and maxOutput are used to clamp the output to known minimum and maximum values.

type DController

type DController struct {
	// contains filtered or unexported fields
}

DController is a Controller with only a derivative component.

func (*DController) Output

func (d *DController) Output(currentError float64) float64

Output returns the derivative output associated with the given currentError.

type IController

type IController struct {
	// contains filtered or unexported fields
}

IController is a Controller with only an integral component.

func (*IController) Output

func (i *IController) Output(currentError float64) float64

Output returns the integral output associated with the given currentError.

type PController

type PController struct {
	// contains filtered or unexported fields
}

PController is a Controller with only a proportional component.

func (*PController) Output

func (p *PController) Output(currentError float64) float64

Output returns the proportional output associated with the given currentError.

type PIDController

type PIDController struct {
	// contains filtered or unexported fields
}

PIDController is a Controller with proportional, integral and derivative components.

func (*PIDController) Output

func (p *PIDController) Output(currentError float64) float64

Output returns the sum of the individual components (proportional, integral, derivative) associated with the given input after clamping the result to the minimum/maximum allowed values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL