From a979a54cf9ce02610cc0999a52a9fbed2f7d4cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Sat, 22 Apr 2023 00:27:20 +0000 Subject: [PATCH] Calibration remount detector: soft disable (#27993) * Calibration remount detector: soft disable * Update test_calibrationd.py --- selfdrive/controls/lib/events.py | 2 +- selfdrive/locationd/calibrationd.py | 2 +- selfdrive/locationd/test/test_calibrationd.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 67a4735e1..89fc8d835 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -719,7 +719,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { EventName.calibrationIncomplete: { ET.PERMANENT: calibration_incomplete_alert, - ET.SOFT_DISABLE: soft_disable_alert("Calibration in Progress"), + ET.SOFT_DISABLE: soft_disable_alert("Device remount detected: recalibrating"), ET.NO_ENTRY: NoEntryAlert("Calibration in Progress"), }, diff --git a/selfdrive/locationd/calibrationd.py b/selfdrive/locationd/calibrationd.py index 70575b4cf..091f21117 100755 --- a/selfdrive/locationd/calibrationd.py +++ b/selfdrive/locationd/calibrationd.py @@ -143,7 +143,7 @@ class Calibrator: # If spread is too high, assume mounting was changed and reset to last block. # Make the transition smooth. Abrupt transitions are not good for feedback loop through supercombo model. if max(self.calib_spread) > MAX_ALLOWED_SPREAD and self.cal_status == Calibration.CALIBRATED: - self.reset(self.rpys[self.block_idx - 1], valid_blocks=INPUTS_NEEDED, smooth_from=self.rpy) + self.reset(self.rpys[self.block_idx - 1], valid_blocks=1, smooth_from=self.rpy) write_this_cycle = (self.idx == 0) and (self.block_idx % (INPUTS_WANTED//5) == 5) if self.param_put and write_this_cycle: diff --git a/selfdrive/locationd/test/test_calibrationd.py b/selfdrive/locationd/test/test_calibrationd.py index deb0da0de..2c6508fd4 100755 --- a/selfdrive/locationd/test/test_calibrationd.py +++ b/selfdrive/locationd/test/test_calibrationd.py @@ -95,7 +95,7 @@ class TestCalibrationd(unittest.TestCase): [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [1e-3, 1e-3, 1e-3]) - self.assertEqual(c.valid_blocks, INPUTS_NEEDED) + self.assertEqual(c.valid_blocks, 1) np.testing.assert_allclose(c.rpy, [0.0, 0.0, -0.05], atol=1e-2) if __name__ == "__main__":