Skip to content

Commit 08c2d06

Browse files
authored
Improve style in drive_helpers (commaai#23962)
1 parent f1aab78 commit 08c2d06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

selfdrive/controls/lib/drive_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def update_v_cruise(v_cruise_kph, buttonEvents, button_timers, enabled, metric):
5454
long_press = False
5555
button_type = None
5656

57-
v_cruise_delta = 1 if metric else 1.6
57+
v_cruise_delta = 1. if metric else CV.MPH_TO_KPH
5858

5959
for b in buttonEvents:
6060
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):
9191

9292
def get_lag_adjusted_curvature(CP, v_ego, psis, curvatures, curvature_rates):
9393
if len(psis) != CONTROL_N:
94-
psis = [0.0 for i in range(CONTROL_N)]
95-
curvatures = [0.0 for i in range(CONTROL_N)]
96-
curvature_rates = [0.0 for i in range(CONTROL_N)]
94+
psis = [0.0]*CONTROL_N
95+
curvatures = [0.0]*CONTROL_N
96+
curvature_rates = [0.0]*CONTROL_N
9797

9898
# TODO this needs more thought, use .2s extra for now to estimate other delays
9999
delay = CP.steerActuatorDelay + .2

0 commit comments

Comments
 (0)