项目作者: einride

项目描述 :
PID controllers for Go.
高级语言: Go
项目地址: git://github.com/einride/pid-go.git
创建时间: 2020-12-22T18:04:40Z
项目社区:https://github.com/einride/pid-go

开源协议:MIT License

下载


PID Go

PkgGoDev
GoReportCard
Codecov


logo

PID controllers for Go.

Examples

pid.Controller

A basic PID controller.

  1. import (
  2. "fmt"
  3. "time"
  4. "go.einride.tech/pid"
  5. )
  6. func ExampleController() {
  7. // Create a PID controller.
  8. c := pid.Controller{
  9. Config: pid.ControllerConfig{
  10. ProportionalGain: 2.0,
  11. IntegralGain: 1.0,
  12. DerivativeGain: 1.0,
  13. },
  14. }
  15. // Update the PID controller.
  16. c.Update(pid.ControllerInput{
  17. ReferenceSignal: 10,
  18. ActualSignal: 0,
  19. SamplingInterval: 100 * time.Millisecond,
  20. })
  21. fmt.Printf("%+v\n", c.State)
  22. // Reset the PID controller.
  23. c.Reset()
  24. fmt.Printf("%+v\n", c.State)
  25. // Output:
  26. // {ControlError:10 ControlErrorIntegral:1 ControlErrorDerivative:100 ControlSignal:121}
  27. // {ControlError:0 ControlErrorIntegral:0 ControlErrorDerivative:0 ControlSignal:0}
  28. }

_Reference ≫_

pid.AntiWindupController

A PID-controller with low-pass filtering of the derivative term, feed forward
term, a saturated control output and anti-windup.

Reference ≫

pid.TrackingController

a PID-controller with low-pass filtering of the derivative term, feed forward
term, anti-windup and bumpless transfer using tracking mode control.

Reference ≫