Fix rounding of minSteerSpeed in events (#1620)

I thought I was missing a rounding in Mazda code, but it turned
out to be a missing rounding after the recent event refactoring

Python3 interpreter:
>>> print(" %d  %d" % (1.6,1.4))
 1  1
>>> print(" %d  %d" % (round(1.6),round(1.4)))
 2  1
>>> print(" %d  %d" % (int(round(1.6)),round(1.4)))
 2  1
>>> print(" %d  %d" % (int(round(1.6)),int(round(1.4))))
 2  1

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
albatross
Jafar Al-Gharaibeh 2020-06-03 16:01:32 -05:00 committed by GitHub
parent c76cf53175
commit 73db079199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class CarInterface(CarInterfaceBase):
ret.lateralTuning.pid.kf = 0.00006
# No steer below disable speed
ret.minSteerSpeed = round(LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS)
ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS
ret.centerToFront = ret.wheelbase * 0.41

View File

@ -161,7 +161,7 @@ class EngagementAlert(Alert):
audible_alert, .2, 0., 0.),
def below_steer_speed_alert(CP, sm, metric):
speed = CP.minSteerSpeed * (CV.MS_TO_KPH if metric else CV.MS_TO_MPH)
speed = int(round(CP.minSteerSpeed * (CV.MS_TO_KPH if metric else CV.MS_TO_MPH)))
unit = "kph" if metric else "mph"
return Alert(
"TAKE CONTROL",