  
    def update(self, sm, CP, VM):
      v_ego = sm['carState'].vEgo
      active = sm['controlsState'].active
      steering_wheel_angle_offset_deg = sm['liveParameters'].angleOffsetDeg
      steering_wheel_angle_deg = sm['carState'].steeringAngleDeg
  
      # Update vehicle model
      x = max(sm['liveParameters'].stiffnessFactor, 0.1)
      sr = max(sm['liveParameters'].steerRatio, 0.1)
      VM.update_params(x, sr)
      curvature_factor = VM.curvature_factor(v_ego)
      measured_curvature = -curvature_factor * math.radians(steering_wheel_angle_deg - steering_wheel_angle_offset_deg) / VM.sR
  
  
      md = sm['modelV2']
      self.LP.parse_model(sm['modelV2'])
      if len(md.position.x) == TRAJECTORY_SIZE and len(md.orientation.x) == TRAJECTORY_SIZE:
        self.path_xyz = np.column_stack([md.position.x, md.position.y, md.position.z])
 
</s> remove   def update(self, sm, CP, VM):
 </s> add   def update(self, sm, CP): </s> remove     self.angle_steers_des = 0.0
    self.angle_steers_des_mpc = 0.0
    self.angle_steers_des_time = 0.0
 </s> add     self.desired_curvature = 0.0
    self.desired_curvature_rate = 0.0 </s> remove   def update(self, sm, CP, VM, PP):
 </s> add   def update(self, sm, CP): </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
    measured_curvature = sm['controlsState'].curvature
  
    def update(self, sm, CP, VM):
      v_ego = sm['carState'].vEgo
      active = sm['controlsState'].active
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
    measured_curvature = sm['controlsState'].curvature
  
      md = sm['modelV2']
      self.LP.parse_model(sm['modelV2'])
      if len(md.position.x) == TRAJECTORY_SIZE and len(md.orientation.x) == TRAJECTORY_SIZE:
        self.path_xyz = np.column_stack([md.position.x, md.position.y, md.position.z])
keep keep keep keep replace replace replace replace replace replace replace replace replace replace 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/lateral_planner.py