Improve style in drive_helpers (#23962)

old-commit-hash: 08c2d066cf076134d2ec8528dd2cb245c627a7cf
This commit is contained in:
Gregor Kikelj
2022-03-14 22:03:28 +01:00
committed by GitHub
parent 479ac5753c
commit f0ece255b4

View File

@@ -54,7 +54,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:
@@ -91,9 +91,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