afa24fb872
Added a test target. Switched the PID and anything else possible float32. Changed TiLimit to be the total contribution. Added a deadband.
14 lines
182 B
Go
14 lines
182 B
Go
package mathex
|
|
|
|
// Clip a value between limits.
|
|
func Clipf(v, min, max float32) float32 {
|
|
switch {
|
|
case v < min:
|
|
return min
|
|
case v > max:
|
|
return max
|
|
default:
|
|
return v
|
|
}
|
|
}
|