mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-20 16:52:10 +08:00
openpilot v0.8.8 release
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
class FirstOrderFilter():
|
||||
class FirstOrderFilter:
|
||||
# first order filter
|
||||
def __init__(self, x0, ts, dt):
|
||||
self.k = (dt / ts) / (1. + dt / ts)
|
||||
def __init__(self, x0, rc, dt):
|
||||
self.x = x0
|
||||
self.dt = dt
|
||||
self.update_alpha(rc)
|
||||
|
||||
def update_alpha(self, rc):
|
||||
self.alpha = self.dt / (rc + self.dt)
|
||||
|
||||
def update(self, x):
|
||||
self.x = (1. - self.k) * self.x + self.k * x
|
||||
self.x = (1. - self.alpha) * self.x + self.alpha * x
|
||||
return self.x
|
||||
|
||||
Reference in New Issue
Block a user