controlsd: no mutable carParams (#32381)

* no as builder

* fix car int test

* more
old-commit-hash: c95b58401afe475b07634041e71ede63b9f3875f
This commit is contained in:
Shane Smiskol
2024-07-02 13:27:45 -07:00
committed by GitHub
parent 5333e8ba20
commit 3953eba4ac
4 changed files with 4 additions and 4 deletions

View File

@@ -62,6 +62,7 @@ class TestCarInterfaces:
car_params = CarInterface.get_params(car_name, args['fingerprints'], args['car_fw'],
experimental_long=args['experimental_long'], docs=False)
car_params = car_params.as_reader()
car_interface = CarInterface(car_params, CarController, CarState)
assert car_params
assert car_interface

View File

@@ -65,8 +65,7 @@ class Controls:
if CI is None:
cloudlog.info("controlsd is waiting for CarParams")
with car.CarParams.from_bytes(self.params.get("CarParams", block=True)) as msg:
# TODO: this shouldn't need to be a builder
self.CP = msg.as_builder()
self.CP = msg
cloudlog.info("controlsd got CarParams")
# Uses car interface helper functions, altering state won't be considered by card for actuation

View File

@@ -25,7 +25,7 @@ LOW_SPEED_Y = [15, 13, 10, 5]
class LatControlTorque(LatControl):
def __init__(self, CP, CI):
super().__init__(CP, CI)
self.torque_params = CP.lateralTuning.torque
self.torque_params = CP.lateralTuning.torque.as_builder()
self.pid = PIDController(self.torque_params.kp, self.torque_params.ki,
k_f=self.torque_params.kf, pos_limit=self.steer_max, neg_limit=-self.steer_max)
self.torque_from_lateral_accel = CI.torque_from_lateral_accel()

View File

@@ -21,7 +21,7 @@ class TestLatControl:
CI = CarInterface(CP, CarController, CarState)
VM = VehicleModel(CP)
controller = controller(CP, CI)
controller = controller(CP.as_reader(), CI)
CS = car.CarState.new_message()
CS.vEgo = 30