test processes doesn't fail anymore (on toyota)!

pull/33208/head
Shane Smiskol 1 year ago
parent e5bed3cee2
commit 58739897f5
  1. 3
      selfdrive/car/body/carcontroller.py
  2. 20
      selfdrive/car/card.py
  3. 3
      selfdrive/car/chrysler/carcontroller.py
  4. 3
      selfdrive/car/ford/carcontroller.py
  5. 3
      selfdrive/car/gm/carcontroller.py
  6. 3
      selfdrive/car/honda/carcontroller.py
  7. 3
      selfdrive/car/hyundai/carcontroller.py
  8. 3
      selfdrive/car/mazda/carcontroller.py
  9. 3
      selfdrive/car/mock/carcontroller.py
  10. 3
      selfdrive/car/nissan/carcontroller.py
  11. 3
      selfdrive/car/subaru/carcontroller.py
  12. 3
      selfdrive/car/tesla/carcontroller.py
  13. 3
      selfdrive/car/toyota/carcontroller.py
  14. 3
      selfdrive/car/volkswagen/carcontroller.py

@ -1,3 +1,4 @@
import copy
import numpy as np import numpy as np
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
@ -75,7 +76,7 @@ class CarController(CarControllerBase):
can_sends = [] can_sends = []
can_sends.append(bodycan.create_control(self.packer, torque_l, torque_r)) can_sends.append(bodycan.create_control(self.packer, torque_l, torque_r))
new_actuators = CC.actuators.as_builder() new_actuators = copy.deepcopy(CC.actuators)
new_actuators.accel = torque_l new_actuators.accel = torque_l
new_actuators.steer = torque_r new_actuators.steer = torque_r
new_actuators.steerOutputCan = torque_r new_actuators.steerOutputCan = torque_r

@ -59,7 +59,7 @@ def can_comm_callbacks(logcan: messaging.SubSocket, sendcan: messaging.PubSocket
return can_recv, can_send return can_recv, can_send
def convert_to_capnp(struct: structs.CarParams | structs.CarState) -> capnp.lib.capnp._DynamicStructBuilder: def convert_to_capnp(struct: structs.CarParams | structs.CarState | structs.CarControl.Actuators) -> capnp.lib.capnp._DynamicStructBuilder:
struct_dict = dataclasses.asdict(struct) struct_dict = dataclasses.asdict(struct)
if isinstance(struct, structs.CarParams): if isinstance(struct, structs.CarParams):
@ -71,8 +71,10 @@ def convert_to_capnp(struct: structs.CarParams | structs.CarState) -> capnp.lib.
struct_capnp.lateralTuning.init(which) struct_capnp.lateralTuning.init(which)
lateralTuning_dict = dataclasses.asdict(getattr(struct.lateralTuning, which)) lateralTuning_dict = dataclasses.asdict(getattr(struct.lateralTuning, which))
setattr(struct_capnp.lateralTuning, which, lateralTuning_dict) setattr(struct_capnp.lateralTuning, which, lateralTuning_dict)
else: elif isinstance(struct, structs.CarState):
struct_capnp = car.CarState.new_message(**struct_dict) struct_capnp = car.CarState.new_message(**struct_dict)
else:
struct_capnp = car.CarControl.Actuators.new_message(**struct_dict)
return struct_capnp return struct_capnp
@ -82,12 +84,14 @@ def convert_carControl(struct: capnp.lib.capnp._DynamicStructReader) -> structs.
def remove_deprecated(s: dict) -> dict: def remove_deprecated(s: dict) -> dict:
return {k: v for k, v in s.items() if not k.endswith('DEPRECATED')} return {k: v for k, v in s.items() if not k.endswith('DEPRECATED')}
for field, value in struct.to_dict().items(): struct_dict = struct.to_dict()
if isinstance(value, dict): struct_dataclass = structs.CarControl(**remove_deprecated({k: v for k, v in struct_dict.items() if not isinstance(k, dict)}))
name = field[0].upper() + field[1:]
struct[field] = getattr(structs.CarControl, name)(**remove_deprecated(value)) struct_dataclass.actuators = structs.CarControl.Actuators(**remove_deprecated(struct_dict.get('actuators', {})))
struct_dataclass.cruiseControl = structs.CarControl.CruiseControl(**remove_deprecated(struct_dict.get('cruiseControl', {})))
struct_dataclass.hudControl = structs.CarControl.HUDControl(**remove_deprecated(struct_dict.get('hudControl', {})))
return structs.CarControl(**remove_deprecated(struct)) return struct_dataclass
class Car: class Car:
@ -223,7 +227,7 @@ class Car:
# publish new carOutput # publish new carOutput
co_send = messaging.new_message('carOutput') co_send = messaging.new_message('carOutput')
co_send.valid = self.sm.all_checks(['carControl']) co_send.valid = self.sm.all_checks(['carControl'])
co_send.carOutput.actuatorsOutput = self.last_actuators_output co_send.carOutput.actuatorsOutput = convert_to_capnp(self.last_actuators_output)
self.pm.send('carOutput', co_send) self.pm.send('carOutput', co_send)
# kick off controlsd step while we actuate the latest carControl packet # kick off controlsd step while we actuate the latest carControl packet

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL, apply_meas_steer_torque_limits from openpilot.selfdrive.car import DT_CTRL, apply_meas_steer_torque_limits
from openpilot.selfdrive.car.chrysler import chryslercan from openpilot.selfdrive.car.chrysler import chryslercan
@ -76,7 +77,7 @@ class CarController(CarControllerBase):
self.frame += 1 self.frame += 1
new_actuators = CC.actuators.as_builder() new_actuators = copy.deepcopy(CC.actuators)
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last new_actuators.steerOutputCan = self.apply_steer_last

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_std_steer_angle_limits, structs from openpilot.selfdrive.car import apply_std_steer_angle_limits, structs
from openpilot.selfdrive.car.ford import fordcan from openpilot.selfdrive.car.ford import fordcan
@ -110,7 +111,7 @@ class CarController(CarControllerBase):
self.steer_alert_last = steer_alert self.steer_alert_last = steer_alert
self.lead_distance_bars_last = hud_control.leadDistanceBars self.lead_distance_bars_last = hud_control.leadDistanceBars
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.curvature = self.apply_curvature_last new_actuators.curvature = self.apply_curvature_last
self.frame += 1 self.frame += 1

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, structs from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, structs
from openpilot.selfdrive.car.gm import gmcan from openpilot.selfdrive.car.gm import gmcan
@ -152,7 +153,7 @@ class CarController(CarControllerBase):
if self.frame % 10 == 0: if self.frame % 10 == 0:
can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status)) can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last new_actuators.steerOutputCan = self.apply_steer_last
new_actuators.gas = self.apply_gas new_actuators.gas = self.apply_gas

@ -1,3 +1,4 @@
import copy
from collections import namedtuple from collections import namedtuple
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
@ -241,7 +242,7 @@ class CarController(CarControllerBase):
self.speed = pcm_speed self.speed = pcm_speed
self.gas = pcm_accel / self.params.NIDEC_GAS_MAX self.gas = pcm_accel / self.params.NIDEC_GAS_MAX
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.speed = self.speed new_actuators.speed = self.speed
new_actuators.accel = self.accel new_actuators.accel = self.accel
new_actuators.gas = self.gas new_actuators.gas = self.gas

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg, structs from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg, structs
from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.conversions import Conversions as CV
@ -161,7 +162,7 @@ class CarController(CarControllerBase):
if self.frame % 50 == 0 and self.CP.openpilotLongitudinalControl: if self.frame % 50 == 0 and self.CP.openpilotLongitudinalControl:
can_sends.append(hyundaican.create_frt_radar_opt(self.packer)) can_sends.append(hyundaican.create_frt_radar_opt(self.packer))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steer = apply_steer / self.params.STEER_MAX new_actuators.steer = apply_steer / self.params.STEER_MAX
new_actuators.steerOutputCan = apply_steer new_actuators.steerOutputCan = apply_steer
new_actuators.accel = accel new_actuators.accel = accel

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_driver_steer_torque_limits, structs from openpilot.selfdrive.car import apply_driver_steer_torque_limits, structs
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
@ -56,7 +57,7 @@ class CarController(CarControllerBase):
can_sends.append(mazdacan.create_steering_control(self.packer, self.CP, can_sends.append(mazdacan.create_steering_control(self.packer, self.CP,
self.frame, apply_steer, CS.cam_lkas)) self.frame, apply_steer, CS.cam_lkas))
new_actuators = CC.actuators.as_builder() new_actuators = copy.deepcopy(CC.actuators)
new_actuators.steer = apply_steer / CarControllerParams.STEER_MAX new_actuators.steer = apply_steer / CarControllerParams.STEER_MAX
new_actuators.steerOutputCan = apply_steer new_actuators.steerOutputCan = apply_steer

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

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_std_steer_angle_limits, structs from openpilot.selfdrive.car import apply_std_steer_angle_limits, structs
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
@ -73,7 +74,7 @@ class CarController(CarControllerBase):
self.packer, CS.lkas_hud_info_msg, steer_hud_alert self.packer, CS.lkas_hud_info_msg, steer_hud_alert
)) ))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steeringAngleDeg = apply_angle new_actuators.steeringAngleDeg = apply_angle
self.frame += 1 self.frame += 1

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg from openpilot.selfdrive.car import apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg
from openpilot.selfdrive.car.helpers import clip, interp from openpilot.selfdrive.car.helpers import clip, interp
@ -135,7 +136,7 @@ class CarController(CarControllerBase):
if self.frame % 2 == 0: if self.frame % 2 == 0:
can_sends.append(subarucan.create_es_static_2(self.packer)) can_sends.append(subarucan.create_es_static_2(self.packer))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last new_actuators.steerOutputCan = self.apply_steer_last

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_std_steer_angle_limits from openpilot.selfdrive.car import apply_std_steer_angle_limits
from openpilot.selfdrive.car.helpers import clip from openpilot.selfdrive.car.helpers import clip
@ -59,7 +60,7 @@ class CarController(CarControllerBase):
# TODO: HUD control # TODO: HUD control
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steeringAngleDeg = self.apply_angle_last new_actuators.steeringAngleDeg = self.apply_angle_last
self.frame += 1 self.frame += 1

@ -1,3 +1,4 @@
import copy
from openpilot.selfdrive.car import apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance, make_tester_present_msg, structs from openpilot.selfdrive.car import apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance, make_tester_present_msg, structs
from openpilot.selfdrive.car.can_definitions import CanData from openpilot.selfdrive.car.can_definitions import CanData
from openpilot.selfdrive.car.helpers import clip from openpilot.selfdrive.car.helpers import clip
@ -167,7 +168,7 @@ class CarController(CarControllerBase):
if self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value: if self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
can_sends.append(make_tester_present_msg(0x750, 0, 0xF)) can_sends.append(make_tester_present_msg(0x750, 0, 0xF))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steer = apply_steer / self.params.STEER_MAX new_actuators.steer = apply_steer / self.params.STEER_MAX
new_actuators.steerOutputCan = apply_steer new_actuators.steerOutputCan = apply_steer
new_actuators.steeringAngleDeg = self.last_angle new_actuators.steeringAngleDeg = self.last_angle

@ -1,3 +1,4 @@
import copy
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, structs from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, structs
from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.conversions import Conversions as CV
@ -109,7 +110,7 @@ class CarController(CarControllerBase):
can_sends.append(self.CCS.create_acc_buttons_control(self.packer_pt, self.ext_bus, CS.gra_stock_values, 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)) cancel=CC.cruiseControl.cancel, resume=CC.cruiseControl.resume))
new_actuators = actuators.as_builder() new_actuators = copy.deepcopy(actuators)
new_actuators.steer = self.apply_steer_last / self.CCP.STEER_MAX new_actuators.steer = self.apply_steer_last / self.CCP.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last new_actuators.steerOutputCan = self.apply_steer_last

Loading…
Cancel
Save