From b24e901b887f3b52c1ae9f59876974f73dc652a3 Mon Sep 17 00:00:00 2001 From: Gregor Kikelj <96022003+GregorKikelj@users.noreply.github.com> Date: Mon, 14 Mar 2022 21:32:16 +0100 Subject: [PATCH] Improve style in drive_helpers --- selfdrive/controls/lib/drive_helpers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 14be3d5ed8fa99..fda27c6779ac5b 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -61,7 +61,7 @@ def update_v_cruise(v_cruise_kph, buttonEvents, button_timers, enabled, metric): long_press = False button_type = None - v_cruise_delta = 1 if metric else 1.6 + v_cruise_delta = 1. if metric else CV.MPH_TO_KPH for b in buttonEvents: if b.type.raw in button_timers and not b.pressed: @@ -98,9 +98,9 @@ def initialize_v_cruise(v_ego, buttonEvents, v_cruise_last): def get_lag_adjusted_curvature(CP, v_ego, psis, curvatures, curvature_rates): if len(psis) != CONTROL_N: - psis = [0.0 for i in range(CONTROL_N)] - curvatures = [0.0 for i in range(CONTROL_N)] - curvature_rates = [0.0 for i in range(CONTROL_N)] + psis = [0.0]*CONTROL_N + curvatures = [0.0]*CONTROL_N + curvature_rates = [0.0]*CONTROL_N # TODO this needs more thought, use .2s extra for now to estimate other delays delay = CP.steerActuatorDelay + .2