move-fast: v-tsc fix

This commit is contained in:
Jason Wen
2023-02-20 22:48:51 -05:00
parent 643fe3b7fa
commit 0ce258612b
2 changed files with 10 additions and 5 deletions
@@ -40,6 +40,7 @@ class LateralPlanner:
self.plan_yaw_rate = np.zeros((TRAJECTORY_SIZE,))
self.t_idxs = np.arange(TRAJECTORY_SIZE)
self.y_pts = np.zeros(TRAJECTORY_SIZE)
self.d_path_w_lines_xyz = np.zeros((TRAJECTORY_SIZE, 3))
self.lat_mpc = LateralMpc()
self.reset_mpc(np.zeros(4))
@@ -134,4 +135,7 @@ class LateralPlanner:
lateralPlan.laneChangeDirection = self.DH.lane_change_direction
lateralPlan.laneChangePrev = self.DH.prev_lane_change
lateralPlan.dPathWLinesX = [float(x) for x in self.d_path_w_lines_xyz[:, 0]]
lateralPlan.dPathWLinesY = [float(y) for y in self.d_path_w_lines_xyz[:, 1]]
pm.send('lateralPlan', plan_send)
@@ -6,7 +6,7 @@ from common.params import Params
from common.realtime import sec_since_boot
from common.conversions import Conversions as CV
from selfdrive.controls.lib.lateral_planner import TRAJECTORY_SIZE
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, CONTROL_N
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX
_MIN_V = 5.6 # Do not operate under 20km/h
@@ -186,10 +186,11 @@ class VisionTurnController():
c_y = width_pts / 2 + lll_y
path_poly = np.polyfit(ll_x, c_y, 3)
# 2. If not polynomial derived from lanes, then derive it from driving path as provided by `lateralPlanner`.
if path_poly is None and lat_planner_data is not None and len(lat_planner_data.psis) == CONTROL_N \
and lat_planner_data.dPathPoints[0] > 0:
path_poly = np.polyfit(lat_planner_data.psis, lat_planner_data.dPathPoints, 3)
# 2. If not polynomial derived from lanes, then derive it from compensated driving path with lanes as
# provided by `lateralPlanner`.
if path_poly is None and lat_planner_data is not None and len(lat_planner_data.dPathWLinesX) > 0 \
and lat_planner_data.dPathWLinesX[0] > 0:
path_poly = np.polyfit(lat_planner_data.dPathWLinesX, lat_planner_data.dPathWLinesY, 3)
# 3. If no polynomial derived from lanes or driving path, then provide a straight line poly.
if path_poly is None: