pidctrl

package module
v0.0.0-...-7b13bca Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2016 License: MIT Imports: 3 Imported by: 13

README

pidctrl

A PIDController implementation in Go.

API Documentation

http://godoc.org/github.com/felixge/pidctrl

TODO

There are several modified PID algorithms, these could be be implemented via flags / additional methods.

License

MIT License, see LICENSE.txt file.

Documentation

Overview

Packege pidctrl implements a PID controller.

see http://en.wikipedia.org/wiki/PID_controller

Index

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.

see http://en.wikipedia.org/wiki/PID_controller#Pseudocode

Jump to

Keyboard shortcuts

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