CC will be a reader

pull/32380/head
Shane Smiskol 1 year ago
parent 8c7d9bbeea
commit eebb12bb39
  1. 2
      selfdrive/car/body/carcontroller.py
  2. 2
      selfdrive/car/chrysler/carcontroller.py
  3. 2
      selfdrive/car/ford/carcontroller.py
  4. 2
      selfdrive/car/gm/carcontroller.py
  5. 2
      selfdrive/car/hyundai/carcontroller.py
  6. 2
      selfdrive/car/mazda/carcontroller.py
  7. 2
      selfdrive/car/mock/carcontroller.py
  8. 2
      selfdrive/car/nissan/carcontroller.py
  9. 2
      selfdrive/car/subaru/carcontroller.py
  10. 2
      selfdrive/car/tesla/carcontroller.py
  11. 8
      selfdrive/car/tests/test_car_interfaces.py
  12. 2
      selfdrive/car/toyota/carcontroller.py
  13. 2
      selfdrive/car/volkswagen/carcontroller.py

@ -75,7 +75,7 @@ class CarController(CarControllerBase):
can_sends = []
can_sends.append(bodycan.create_control(self.packer, torque_l, torque_r))
new_actuators = CC.actuators.copy()
new_actuators = CC.actuators.as_builder()
new_actuators.accel = torque_l
new_actuators.steer = torque_r
new_actuators.steerOutputCan = torque_r

@ -78,7 +78,7 @@ class CarController(CarControllerBase):
self.frame += 1
new_actuators = CC.actuators.copy()
new_actuators = CC.actuators.as_builder()
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last

@ -113,7 +113,7 @@ class CarController(CarControllerBase):
self.steer_alert_last = steer_alert
self.lead_distance_bars_last = hud_control.leadDistanceBars
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.curvature = self.apply_curvature_last
self.frame += 1

@ -155,7 +155,7 @@ class CarController(CarControllerBase):
if self.frame % 10 == 0:
can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status))
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last
new_actuators.gas = self.apply_gas

@ -163,7 +163,7 @@ class CarController(CarControllerBase):
if self.frame % 50 == 0 and self.CP.openpilotLongitudinalControl:
can_sends.append(hyundaican.create_frt_radar_opt(self.packer))
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steer = apply_steer / self.params.STEER_MAX
new_actuators.steerOutputCan = apply_steer
new_actuators.accel = accel

@ -58,7 +58,7 @@ class CarController(CarControllerBase):
can_sends.append(mazdacan.create_steering_control(self.packer, self.CP,
self.frame, apply_steer, CS.cam_lkas))
new_actuators = CC.actuators.copy()
new_actuators = CC.actuators.as_builder()
new_actuators.steer = apply_steer / CarControllerParams.STEER_MAX
new_actuators.steerOutputCan = apply_steer

@ -2,4 +2,4 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase
class CarController(CarControllerBase):
def update(self, CC, CS, now_nanos):
return CC.actuators.copy(), []
return CC.actuators.as_builder(), []

@ -75,7 +75,7 @@ class CarController(CarControllerBase):
self.packer, CS.lkas_hud_info_msg, steer_hud_alert
))
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steeringAngleDeg = apply_angle
self.frame += 1

@ -136,7 +136,7 @@ class CarController(CarControllerBase):
if self.frame % 2 == 0:
can_sends.append(subarucan.create_es_static_2(self.packer))
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last

@ -60,7 +60,7 @@ class CarController(CarControllerBase):
# TODO: HUD control
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steeringAngleDeg = self.apply_angle_last
self.frame += 1

@ -92,16 +92,16 @@ class TestCarInterfaces(unittest.TestCase):
CC = car.CarControl.new_message(**cc_msg)
for _ in range(10):
car_interface.update(CC, [])
car_interface.apply(CC, now_nanos)
car_interface.apply(CC, now_nanos)
car_interface.apply(CC.as_reader(), now_nanos)
car_interface.apply(CC.as_reader(), now_nanos)
now_nanos += DT_CTRL * 1e9 # 10 ms
CC = car.CarControl.new_message(**cc_msg)
CC.enabled = True
for _ in range(10):
car_interface.update(CC, [])
car_interface.apply(CC, now_nanos)
car_interface.apply(CC, now_nanos)
car_interface.apply(CC.as_reader(), now_nanos)
car_interface.apply(CC.as_reader(), now_nanos)
now_nanos += DT_CTRL * 1e9 # 10ms
# Test controller initialization

@ -173,7 +173,7 @@ class CarController(CarControllerBase):
if self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
can_sends.append([0x750, 0, b"\x0F\x02\x3E\x00\x00\x00\x00\x00", 0])
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steer = apply_steer / self.params.STEER_MAX
new_actuators.steerOutputCan = apply_steer
new_actuators.steeringAngleDeg = self.last_angle

@ -112,7 +112,7 @@ class CarController(CarControllerBase):
can_sends.append(self.CCS.create_acc_buttons_control(self.packer_pt, self.ext_bus, CS.gra_stock_values,
cancel=CC.cruiseControl.cancel, resume=CC.cruiseControl.resume))
new_actuators = actuators.copy()
new_actuators = actuators.as_builder()
new_actuators.steer = self.apply_steer_last / self.CCP.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last

Loading…
Cancel
Save