From 9f96d635207d1cd4abfe1082934c80a68a16db8d Mon Sep 17 00:00:00 2001 From: Vivek Aithal Date: Thu, 7 Oct 2021 18:21:11 -0700 Subject: [PATCH] paramsd: Sort messages in each update iteration before processing (#22403) * sort livelocationKalman and carState messages in each update iteration before processing * update refs * update refs * update refs * update again Co-authored-by: Adeeb Shihadeh old-commit-hash: 83a53618b3a04377ee55561da7460a6f5da7d8d1 --- selfdrive/locationd/paramsd.py | 7 ++----- selfdrive/test/process_replay/ref_commit | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/selfdrive/locationd/paramsd.py b/selfdrive/locationd/paramsd.py index 872ff6c57d..914e0d0223 100755 --- a/selfdrive/locationd/paramsd.py +++ b/selfdrive/locationd/paramsd.py @@ -123,17 +123,14 @@ def main(sm=None, pm=None): # When driving in wet conditions the stiffness can go down, and then be too low on the next drive # Without a way to detect this we have to reset the stiffness every drive params['stiffnessFactor'] = 1.0 - learner = ParamsLearner(CP, params['steerRatio'], params['stiffnessFactor'], math.radians(params['angleOffsetAverageDeg'])) - angle_offset_average = params['angleOffsetAverageDeg'] angle_offset = angle_offset_average while True: sm.update() - - for which, updated in sm.updated.items(): - if updated: + for which in sorted(sm.updated.keys(), key=lambda x: sm.logMonoTime[x]): + if sm.updated[which]: t = sm.logMonoTime[which] * 1e-9 learner.handle_log(t, which, sm[which]) diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index fd5b288882..941467aebd 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -dc264ed5d283bbfe4dd44c5f65db3eb5cef210eb \ No newline at end of file +5ee94677282bcea512e0d929e55e71308f14d530 \ No newline at end of file