  
    def publish(self, sm, pm):
      plan_solution_valid = self.solution_invalid_cnt < 2
      plan_send = messaging.new_message('lateralPlan')
      plan_send.valid = sm.all_alive_and_valid(service_list=['carState', 'controlsState', 'liveParameters', 'modelV2'])
      plan_send.lateralPlan.laneWidth = float(self.LP.lane_width)
      plan_send.lateralPlan.dPathPoints = [float(x) for x in self.y_pts]
      plan_send.lateralPlan.lProb = float(self.LP.lll_prob)
      plan_send.lateralPlan.rProb = float(self.LP.rll_prob)
      plan_send.lateralPlan.dProb = float(self.LP.d_prob)
 
</s> remove     plan_send.lateralPlan.steeringAngleDeg = float(self.desired_steering_wheel_angle_deg)
    plan_send.lateralPlan.steeringRateDeg = float(self.desired_steering_wheel_angle_rate_deg)
    plan_send.lateralPlan.angleOffsetDeg = float(sm['liveParameters'].angleOffsetAverageDeg)
 </s> add     plan_send.lateralPlan.curvature = float(self.desired_curvature)
    plan_send.lateralPlan.curvatureRate = float(self.desired_curvature_rate)
 </s> remove   PL = Planner(CP)
  PP = LateralPlanner(CP)

  VM = VehicleModel(CP)
 </s> add   longitudinal_planner = Planner(CP)
  lateral_planner = LateralPlanner(CP) </s> remove     sm = messaging.SubMaster(['carState', 'controlsState', 'radarState', 'modelV2', 'liveParameters'],
 </s> add     sm = messaging.SubMaster(['carState', 'controlsState', 'radarState', 'modelV2'], </s> remove   def update(self, sm, CP, VM):
 </s> add   def update(self, sm, CP): </s> remove     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

 </s> add     measured_curvature = sm['controlsState'].curvature
    plan_send.valid = sm.all_alive_and_valid(service_list=['carState', 'controlsState', 'modelV2'])
  
    def publish(self, sm, pm):
      plan_solution_valid = self.solution_invalid_cnt < 2
      plan_send = messaging.new_message('lateralPlan')
    plan_send.valid = sm.all_alive_and_valid(service_list=['carState', 'controlsState', 'modelV2'])
      plan_send.lateralPlan.laneWidth = float(self.LP.lane_width)
      plan_send.lateralPlan.dPathPoints = [float(x) for x in self.y_pts]
      plan_send.lateralPlan.lProb = float(self.LP.lll_prob)
      plan_send.lateralPlan.rProb = float(self.LP.rll_prob)
      plan_send.lateralPlan.dProb = float(self.LP.d_prob)
keep keep keep keep 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