From 25fa73ab85f44e2d96bb0492d439ae00d96616bc Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 9 Aug 2024 17:43:20 -0700 Subject: [PATCH] same which() API --- selfdrive/car/data_structures.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/data_structures.py b/selfdrive/car/data_structures.py index 61895fab46..4a1c9ea4ba 100644 --- a/selfdrive/car/data_structures.py +++ b/selfdrive/car/data_structures.py @@ -103,11 +103,14 @@ class CarParams: @auto_dataclass class LateralTuning: - def init(self, which: str): - assert which in ('pid', 'torque'), 'Invalid union type' - self.which = which + def init(self, _which: str): + assert _which in ('pid', 'torque'), 'Invalid union type' + self._which = _which - which: str = 'pid' + def which(self): + return self._which + + _which: str = 'pid' pid: 'CarParams.LateralPIDTuning' = field(default_factory=lambda: CarParams.LateralPIDTuning()) torque: 'CarParams.LateralTorqueTuning' = field(default_factory=lambda: CarParams.LateralTorqueTuning())