From bebc21ca09ac70dee263209d56c0ccd6af687525 Mon Sep 17 00:00:00 2001 From: Igor Date: Tue, 16 Feb 2021 05:43:11 -0500 Subject: [PATCH] Fix division by zero in lateral_planner.py (#20071) * Fix division by zero * Change fix logic old-commit-hash: 8f9ee10b8a1aeeac26c5b269c1137984b172b378 --- selfdrive/controls/lib/lateral_planner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/lib/lateral_planner.py b/selfdrive/controls/lib/lateral_planner.py index b77be714ba..9ca67fe3a5 100644 --- a/selfdrive/controls/lib/lateral_planner.py +++ b/selfdrive/controls/lib/lateral_planner.py @@ -188,7 +188,7 @@ class LateralPlanner(): next_curvature = interp(delay, self.t_idxs[:MPC_N+1], self.mpc_solution.curvature) psi = interp(delay, self.t_idxs[:MPC_N+1], self.mpc_solution.psi) next_curvature_rate = self.mpc_solution.curvature_rate[0] - next_curvature_from_psi = psi/(v_ego*delay) + next_curvature_from_psi = psi/(max(v_ego, 1e-1) * delay) if psi > self.mpc_solution.curvature[0] * delay * v_ego: next_curvature = max(next_curvature_from_psi, next_curvature) else: