      if self.desire == log.LateralPlan.Desire.laneChangeRight or self.desire == log.LateralPlan.Desire.laneChangeLeft:
        self.LP.lll_prob *= self.lane_change_ll_prob
        self.LP.rll_prob *= self.lane_change_ll_prob
      d_path_xyz = self.LP.get_d_path(v_ego, self.t_idxs, self.path_xyz)
      y_pts = np.interp(v_ego * self.t_idxs[:MPC_N+1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:,1])
      heading_pts = np.interp(v_ego * self.t_idxs[:MPC_N+1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
      self.y_pts = y_pts
  
      assert len(y_pts) == MPC_N + 1
      assert len(heading_pts) == MPC_N + 1
      self.libmpc.run_mpc(self.cur_state, self.mpc_solution,
 
</s> remove     if self.CP.lateralTuning.which() == 'pid':
 </s> add     if self.CP.steerControlType == car.CarParams.SteerControlType.angle:
      controlsState.lateralControlState.angleState = lac_log
    elif self.CP.lateralTuning.which() == 'pid': </s> remove     if self.CP.lateralTuning.which() == 'pid':
 </s> add     if self.CP.steerControlType == car.CarParams.SteerControlType.angle:
      self.LaC = LatControlAngle(self.CP)
    elif self.CP.lateralTuning.which() == 'pid': </s> remove       tuning = car_params.lateralTuning.which()
      if tuning == 'pid':
        self.assertTrue(len(car_params.lateralTuning.pid.kpV))
      elif tuning == 'lqr':
        self.assertTrue(len(car_params.lateralTuning.lqr.a))
      elif tuning == 'indi':
        self.assertTrue(len(car_params.lateralTuning.indi.outerLoopGainV))
 </s> add       if car_params.steerControlType != car.CarParams.SteerControlType.angle:
        tuning = car_params.lateralTuning.which()
        if tuning == 'pid':
          self.assertTrue(len(car_params.lateralTuning.pid.kpV))
        elif tuning == 'lqr':
          self.assertTrue(len(car_params.lateralTuning.lqr.a))
        elif tuning == 'indi':
          self.assertTrue(len(car_params.lateralTuning.indi.outerLoopGainV)) </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 </s> remove     tuning = self.CP.lateralTuning.which()
    if tuning == 'pid':
      self.assertTrue(len(self.CP.lateralTuning.pid.kpV))
    elif tuning == 'lqr':
      self.assertTrue(len(self.CP.lateralTuning.lqr.a))
    elif tuning == 'indi':
      self.assertTrue(len(self.CP.lateralTuning.indi.outerLoopGainV))
 </s> add     if self.CP.steerControlType != car.CarParams.SteerControlType.angle:
      tuning = self.CP.lateralTuning.which()
      if tuning == 'pid':
        self.assertTrue(len(self.CP.lateralTuning.pid.kpV))
      elif tuning == 'lqr':
        self.assertTrue(len(self.CP.lateralTuning.lqr.a))
      elif tuning == 'indi':
        self.assertTrue(len(self.CP.lateralTuning.indi.outerLoopGainV))
    y_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:,1])
    heading_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
      if self.desire == log.LateralPlan.Desire.laneChangeRight or self.desire == log.LateralPlan.Desire.laneChangeLeft:
        self.LP.lll_prob *= self.lane_change_ll_prob
        self.LP.rll_prob *= self.lane_change_ll_prob
      d_path_xyz = self.LP.get_d_path(v_ego, self.t_idxs, self.path_xyz)
    y_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:,1])
    heading_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
    y_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:,1])
    heading_pts = np.interp(v_ego * self.t_idxs[:MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
      self.y_pts = y_pts
  
      assert len(y_pts) == MPC_N + 1
      assert len(heading_pts) == MPC_N + 1
      self.libmpc.run_mpc(self.cur_state, self.mpc_solution,
keep keep keep keep 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