  class FirstOrderFilter():
    # first order filter
    def __init__(self, x0, ts, dt):
      self.k = (dt / ts) / (1. + dt / ts)
      self.x = x0
  
    def update(self, x):
      self.x = (1. - self.k) * self.x + self.k * x
      return self.x
 
</s> remove class FirstOrderFilter():
 </s> add class FirstOrderFilter: </s> remove     self.x = (1. - self.k) * self.x + self.k * x
 </s> add     self.x = (1. - self.alpha) * self.x + self.alpha * x </s> remove     self.lane_width_certainty += 0.05 * (l_prob * r_prob - self.lane_width_certainty)
 </s> add     self.lane_width_certainty.update(l_prob * r_prob) </s> remove     self.lane_width_estimate = 3.7
    self.lane_width_certainty = 1.0
 </s> add     self.lane_width_estimate = FirstOrderFilter(3.7, 9.95, DT_MDL)
    self.lane_width_certainty = FirstOrderFilter(1.0, 0.95, DT_MDL)
  def __init__(self, x0, rc, dt):
  class FirstOrderFilter():
    # first order filter
  def __init__(self, x0, rc, dt):
  def __init__(self, x0, rc, dt):
      self.x = x0
  
    def update(self, x):
      self.x = (1. - self.k) * self.x + self.k * x
      return self.x
keep keep replace replace keep keep keep keep keep
 Use first order filter (#21411)

* Use first order filter in INDI

* use first order filter in LP as well

* Update selfdrive/controls/lib/lane_planner.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

* RC->rc

* division safe

Co-authored-by: Willem Melching <willem.melching@gmail.com> 
common/filter_simple.py