From 02eb56be2810cd295c10bf3580b40a5867d7882c Mon Sep 17 00:00:00 2001 From: rdm128 <46527143+rdm128@users.noreply.github.com> Date: Mon, 23 Dec 2019 19:29:03 -0500 Subject: [PATCH] Rdm128 cruise delta to kegman.json (#253) * Update kegman_conf.py * Update drive_helpers.py --- selfdrive/controls/lib/drive_helpers.py | 9 ++++++--- selfdrive/kegman_conf.py | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index a3580a8a91b24a..a9e809a873b84e 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -1,13 +1,16 @@ from cereal import car from common.numpy_fast import clip, interp from selfdrive.config import Conversions as CV +from selfdrive.kegman_conf import kegman_conf # kph +kegman = kegman_conf() V_CRUISE_MAX = 144 V_CRUISE_MIN = 8 -V_CRUISE_DELTA = 8 -V_CRUISE_ENABLE_MIN = 40 - +V_CRUISE_DELTA = int(kegman.conf['CruiseDelta']) +V_CRUISE_ENABLE_MIN = int(kegman.conf['CruiseEnableMin']) +clip(V_CRUISE_DELTA, 2, 16) +clip(V_CRUISE_ENABLE_MIN, 1, 80) class MPC_COST_LAT: PATH = 1.0 diff --git a/selfdrive/kegman_conf.py b/selfdrive/kegman_conf.py index 0bb5a8141849be..c9b33209e3520c 100644 --- a/selfdrive/kegman_conf.py +++ b/selfdrive/kegman_conf.py @@ -114,6 +114,14 @@ def read_config(self): self.config.update({"ALCminSpeed":"20.1168"}) self.element_updated = True + if "CruiseDelta" not in self.config: + self.config.update({"CruiseDelta":"8"}) + self.element_updated = True + + if "CruiseEnableMin" not in self.config: + self.config.update({"CruiseEnableMin":"40"}) + self.element_updated = True + if self.element_updated: print("updated") self.write_config(self.config) @@ -128,7 +136,7 @@ def read_config(self): "1barHwy":"0.4", "2barHwy":"0.3", "3barHwy":"0.1", \ "steerRatio":"-1", "steerRateCost":"-1", "slowOnCurves":"0", "Kf":"-1", \ "sR_boost":"0", "sR_BP0":"0", "sR_BP1":"0", "sR_time":"1", \ - "ALCnudgeLess":"0", "ALCminSpeed":"20.1168"} + "ALCnudgeLess":"0", "ALCminSpeed":"20.1168", "CrusieDelta":"8", "CruiseEnableMin":"40"} self.write_config(self.config)