@ -9,6 +9,7 @@ from selfdrive.modeld.constants import T_IDXS
from selfdrive . config import Conversions as CV
from selfdrive . controls . lib . longcontrol import LongCtrlState
from selfdrive . controls . lib . longitudinal_mpc_lib . long_mpc import LongitudinalMpc
from selfdrive . controls . lib . longitudinal_mpc_lib . long_mpc import T_IDXS as T_IDXS_MPC
from selfdrive . controls . lib . drive_helpers import V_CRUISE_MAX , CONTROL_N
from selfdrive . swaglog import cloudlog
@ -88,9 +89,9 @@ class Planner():
self . mpc . set_accel_limits ( accel_limits_turns [ 0 ] , accel_limits_turns [ 1 ] )
self . mpc . set_cur_state ( self . v_desired , self . a_desired )
self . mpc . update ( sm [ ' carState ' ] , sm [ ' radarState ' ] , v_cruise )
self . v_desired_trajectory = self . mpc . v_solution [ : CONTROL_N ]
self . a_desired_trajectory = self . mpc . a_solution [ : CONTROL_N ]
self . j_desired_trajectory = self . mpc . j_solution [ : CONTROL_N ]
self . v_desired_trajectory = np . interp ( T_IDXS [ : CONTROL_N ] , T_IDXS_MPC , self . mpc . v_solution )
self . a_desired_trajectory = np . interp ( T_IDXS [ : CONTROL_N ] , T_IDXS_MPC , self . mpc . a_solution )
self . j_desired_trajectory = np . interp ( T_IDXS [ : CONTROL_N ] , T_IDXS_MPC [ : - 1 ] , self . mpc . j_solution )
#TODO counter is only needed because radar is glitchy, remove once radar is gone
self . fcw = self . mpc . crash_cnt > 5