  
      if CS.vEgo < 0.3 or not active:
        lqr_log.active = False
        lqr_output = 0.
        self.reset()
      else:
        lqr_log.active = True
  
        # LQR
        u_lqr = float(desired_angle / self.dc_gain - self.K.dot(self.x_hat))
 
</s> remove       u_lqr = float(self.angle_steers_des / self.dc_gain - self.K.dot(self.x_hat))
 </s> add       u_lqr = float(desired_angle / self.dc_gain - self.K.dot(self.x_hat)) </s> remove   def update(self, active, CS, CP, lat_plan):
 </s> add   def update(self, active, CS, CP, VM, params, lat_plan): </s> remove         error = self.angle_steers_des - angle_steers_k
 </s> add         error = desired_angle - angle_steers_k </s> remove     # reset to current steer angle if not active or overriding
    if active:
      curvature_desired = next_curvature
      desired_curvature_rate = next_curvature_rate
    else:
      curvature_desired = measured_curvature
      desired_curvature_rate = 0.0

    # negative sign, controls uses different convention
    self.desired_steering_wheel_angle_deg = -float(math.degrees(curvature_desired * VM.sR)/curvature_factor) + steering_wheel_angle_offset_deg
    self.desired_steering_wheel_angle_rate_deg = -float(math.degrees(desired_curvature_rate * VM.sR)/curvature_factor)
 </s> add     self.desired_curvature = next_curvature
    self.desired_curvature_rate = next_curvature_rate
      output_steer = 0.
  
      if CS.vEgo < 0.3 or not active:
        lqr_log.active = False
        lqr_output = 0.
      output_steer = 0.
        self.reset()
      else:
        lqr_log.active = True
  
        # LQR
        u_lqr = float(desired_angle / self.dc_gain - self.K.dot(self.x_hat))
keep keep keep add keep keep keep keep keep keep
 LateralPlanner should only compute curvature (#20289)

* get curvature from planner

* no need to check active

* remove that

* remove self

* liveParams not needed

* cast

* fix test bug

* fixes

* fix ui.py

* fix radians

* update refs

* update refs

* bump cereal

* bump cereal

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
selfdrive/controls/lib/latcontrol_lqr.py