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 current error. // Generally speaking, the oujtput will be used to minimize this error. Output(currentError float64) float64 // Adjust allows adjusting the internal state of the controller to // counteract known effects (integral windup, etc.). Adjust(adjustment 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) Adjust ¶
func (d *DController) Adjust(adjustment float64)
Adjust does nothing for now.
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) Adjust ¶
func (i *IController) Adjust(adjustment float64)
Adjust modifies the integral term to counteract windup.
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) Adjust ¶
func (p *PController) Adjust(adjustment float64)
Adjust does nothing for now.
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) Adjust ¶
func (p *PIDController) Adjust(adjustment float64)
Adjust does nothing for now.
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.