Skip to content

Commit 18d487e

Browse files
kegmanedukinara
kegman
authored andcommittedJul 18, 2019
Toggle LiveParameters auto tuning (commaai#168)
* LiveParams to toggle comma's LiveParameters tuning and populate random username for dashboard (commaai#167) * auto-insert or prompt username into kegman.json * Random username integer in kegman_conf for tune.py * liveParams toggle for auto-tune * liveParams toggle from kegman.json setting * liveParams in Tune.py plus edit checks * Fix syntax * forgot : after if statement * LiveParam edit checkLiveParam edit check * Revert tune.py * Revert "Revert tune.py" This reverts commit ea823671b8dfe3d1bdbae8c7b88eea3eee9d7058. * Make liveParam toggle live in locationd_local.pyMake liveParam toggle live in locationd_local.py * Remove import random - not necessary
1 parent b6d4ead commit 18d487e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
 

‎selfdrive/kegman_conf.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def read_config(self):
3939
self.config.update({"tuneGernby":"1"})
4040
self.config.update({"Kp":"-1"})
4141
self.config.update({"Ki":"-1"})
42+
self.element_updated = True
43+
44+
if "liveParams" not in self.config:
45+
self.config.update({"liveParams":"1"})
46+
self.element_updated = True
4247

4348

4449
# Force update battery charge limits to higher values for Big Model
@@ -55,7 +60,7 @@ def read_config(self):
5560
self.config = {"cameraOffset":"0.06", "lastTrMode":"1", "battChargeMin":"60", "battChargeMax":"70", \
5661
"wheelTouchSeconds":"180", "battPercOff":"25", "carVoltageMinEonShutdown":"11800", \
5762
"brakeStoppingTarget":"0.25", "tuneGernby":"1", \
58-
"Kp":"-1", "Ki":"-1"}
63+
"Kp":"-1", "Ki":"-1", "liveParams":"1"}
5964

6065
self.write_config(self.config)
6166
return self.config

‎selfdrive/locationd/locationd_local.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from selfdrive.services import service_list
1818
from selfdrive.locationd.kalman.loc_local_kf import LocLocalKalman
1919
from selfdrive.locationd.kalman.kalman_helpers import ObservationKind
20+
from selfdrive.kegman_conf import kegman_conf
2021

2122
DEBUG = False
2223
kf = LocLocalKalman() # Make sure that model is generated on import time
@@ -245,7 +246,9 @@ def locationd_thread(gctx, addr, disabled_logs):
245246
if i % 6000 == 0: # once a minute
246247
params = learner.get_values()
247248
params['carFingerprint'] = CP.carFingerprint
248-
params_reader.put("LiveParameters", json.dumps(params))
249+
kegman = kegman_conf()
250+
if kegman.conf['liveParams'] == "1":
251+
params_reader.put("LiveParameters", json.dumps(params))
249252
params_reader.put("ControlsParams", json.dumps({'angle_model_bias': log.live100.angleModelBias}))
250253

251254
i += 1

‎tune.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def getch():
4141
kegman = kegman_conf()
4242
#kegman.conf['tuneGernby'] = "1"
4343
#kegman.write_config(kegman.conf)
44-
param = ["tuneGernby", "Kp", "Ki"]
44+
param = ["tuneGernby", "liveParams", "Kp", "Ki"]
4545

4646
j = 0
4747
while True:
@@ -156,6 +156,9 @@ def getch():
156156

157157
if float(kegman.conf['Kp']) > 3:
158158
kegman.conf['Kp'] = "3"
159+
160+
if kegman.conf['liveParams'] != "1" and kegman.conf['liveParams'] != "0":
161+
kegman.conf['liveParams'] = "1"
159162

160163

161164
if write_json:

0 commit comments

Comments
 (0)