From bc90eacfd6a965bca1421d269a9cfc29be8da743 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 9708b1f9f5c35b..427b0c0c7f5612 100644 --- a/selfdrive/kegman_conf.py +++ b/selfdrive/kegman_conf.py @@ -118,6 +118,14 @@ def read_config(self): self.config.update({"ALCtimer":"2.0"}) 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) @@ -132,7 +140,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", "ALCtimer":"2.0"} + "ALCnudgeLess":"0", "ALCminSpeed":"20.1168", "ALCtimer":"2.0", "CrusieDelta":"8", "CruiseEnableMin":"40"} self.write_config(self.config)