Skip to content

Commit

Permalink
controlsd: no mutable carParams (commaai#32381)
Browse files Browse the repository at this point in the history
* no as builder

* fix car int test

* more
  • Loading branch information
sshane authored Jul 2, 2024
1 parent 3e41b1b commit c95b584
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions selfdrive/car/tests/test_car_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_car_interfaces(self, car_name, data):

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
Expand Down
3 changes: 1 addition & 2 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def __init__(self, CI=None):
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
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/latcontrol_torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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()
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/tests/test_latcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_saturation(self, car_name, controller):
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
Expand Down

0 comments on commit c95b584

Please sign in to comment.