From 6a64d9fd5519cf894dab82a6558a24bffe3e0048 Mon Sep 17 00:00:00 2001 From: Igor Biletskyy Date: Wed, 28 Jun 2023 15:18:11 -0700 Subject: [PATCH 1/3] CAN health packet v5 (#28534) initial --- cereal | 2 +- panda | 2 +- selfdrive/boardd/boardd.cc | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cereal b/cereal index f1463a08ee..f86de2b1a3 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit f1463a08eebd98725724cb21c5966ea7b23da8b8 +Subproject commit f86de2b1a36276e2c5a3ada4a1e8f0fe3e7e5ff2 diff --git a/panda b/panda index b2cf197679..a35e9a1edb 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit b2cf1976796dbd9f700a76543466c8c9c9665827 +Subproject commit a35e9a1edb1e685f00f4dd9d874043f56ea771fc diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 4205d84781..866ff1aa20 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -419,6 +419,10 @@ std::optional send_panda_states(PubMaster *pm, const std::vector cs[j].setCanfdEnabled(can_health.canfd_enabled); cs[j].setBrsEnabled(can_health.brs_enabled); cs[j].setCanfdNonIso(can_health.canfd_non_iso); + cs[j].setIrq0CallRate(can_health.irq0_call_rate); + cs[j].setIrq1CallRate(can_health.irq1_call_rate); + cs[j].setIrq2CallRate(can_health.irq2_call_rate); + cs[j].setCanCoreResetCnt(can_health.can_core_reset_cnt); } // Convert faults bitset to capnp list From dc83752bc09bb32ee873965f1bafe5b227ec6f68 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 28 Jun 2023 15:54:20 -0700 Subject: [PATCH 2/3] Toyota carcontroller: use class variable (#28733) * use params * better names --- selfdrive/car/toyota/carcontroller.py | 10 +++++----- selfdrive/car/toyota/toyotacan.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 66a7b57f01..0a49e72884 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -22,7 +22,7 @@ MAX_USER_TORQUE = 500 class CarController: def __init__(self, dbc_name, CP, VM): self.CP = CP - self.torque_rate_limits = CarControllerParams(self.CP) + self.params = CarControllerParams(self.CP) self.frame = 0 self.last_steer = 0 self.alert_active = False @@ -56,11 +56,11 @@ class CarController: interceptor_gas_cmd = clip(pedal_command, 0., MAX_INTERCEPTOR_GAS) else: interceptor_gas_cmd = 0. - pcm_accel_cmd = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) + pcm_accel_cmd = clip(actuators.accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX) # steer torque - new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX)) - apply_steer = apply_meas_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.torque_rate_limits) + new_steer = int(round(actuators.steer * self.params.STEER_MAX)) + apply_steer = apply_meas_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.params) # Count up to MAX_STEER_RATE_FRAMES, at which point we need to cut torque to avoid a steering fault if lat_active and abs(CS.out.steeringRateDeg) >= MAX_STEER_RATE: @@ -162,7 +162,7 @@ class CarController: can_sends.append(make_can_msg(addr, vl, bus)) new_actuators = actuators.copy() - new_actuators.steer = apply_steer / CarControllerParams.STEER_MAX + new_actuators.steer = apply_steer / self.params.STEER_MAX new_actuators.steerOutputCan = apply_steer new_actuators.accel = self.accel new_actuators.gas = self.gas diff --git a/selfdrive/car/toyota/toyotacan.py b/selfdrive/car/toyota/toyotacan.py index 1031361350..47f7612c8e 100644 --- a/selfdrive/car/toyota/toyotacan.py +++ b/selfdrive/car/toyota/toyotacan.py @@ -9,17 +9,17 @@ def create_steer_command(packer, steer, steer_req): return packer.make_can_msg("STEERING_LKA", 0, values) -def create_lta_steer_command(packer, steer, steer_req, raw_cnt): +def create_lta_steer_command(packer, steer_angle, steer_req, frame): """Creates a CAN message for the Toyota LTA Steer Command.""" values = { - "COUNTER": raw_cnt + 128, + "COUNTER": frame + 128, "SETME_X1": 1, "SETME_X3": 3, "PERCENTAGE": 100, "SETME_X64": 0, "ANGLE": 0, - "STEER_ANGLE_CMD": steer, + "STEER_ANGLE_CMD": steer_angle, "STEER_REQUEST": steer_req, "STEER_REQUEST_2": steer_req, "BIT": 0, From 47f948c5c6a81d229d9ab74183f4bfe9fe8dc9fb Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Thu, 29 Jun 2023 00:22:53 +0100 Subject: [PATCH 3/3] Ford: show FCW alert on IPC (#27924) * Ford: show FCW alert on IPC * forward fcw from ipma --------- Co-authored-by: Shane Smiskol --- selfdrive/car/ford/carcontroller.py | 3 ++- selfdrive/car/ford/fordcan.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index 2a930e735e..2ef80420bd 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -43,6 +43,7 @@ class CarController: main_on = CS.out.cruiseState.available steer_alert = hud_control.visualAlert in (VisualAlert.steerRequired, VisualAlert.ldw) + fcw_alert = hud_control.visualAlert == VisualAlert.fcw ### acc buttons ### if CC.cruiseControl.cancel: @@ -100,7 +101,7 @@ class CarController: # send acc ui msg at 5Hz or if ui state changes if (self.frame % CarControllerParams.ACC_UI_STEP) == 0 or send_ui: can_sends.append(create_acc_ui_msg(self.packer, self.CAN, self.CP, main_on, CC.latActive, - CS.out.cruiseState.standstill, hud_control, + fcw_alert, CS.out.cruiseState.standstill, hud_control, CS.acc_tja_status_stock_values)) self.main_on_last = main_on diff --git a/selfdrive/car/ford/fordcan.py b/selfdrive/car/ford/fordcan.py index ca95ac0a0d..a49d7ad85d 100644 --- a/selfdrive/car/ford/fordcan.py +++ b/selfdrive/car/ford/fordcan.py @@ -142,8 +142,8 @@ def create_acc_msg(packer, CAN: CanBus, long_active: bool, gas: float, accel: fl return packer.make_can_msg("ACCDATA", CAN.main, values) -def create_acc_ui_msg(packer, CAN: CanBus, CP, main_on: bool, enabled: bool, standstill: bool, hud_control, - stock_values: dict): +def create_acc_ui_msg(packer, CAN: CanBus, CP, main_on: bool, enabled: bool, fcw_alert: bool, standstill: bool, + hud_control, stock_values: dict): """ Creates a CAN message for the Ford IPC adaptive cruise, forward collision warning and traffic jam assist status. @@ -214,6 +214,10 @@ def create_acc_ui_msg(packer, CAN: CanBus, CP, main_on: bool, enabled: bool, sta "AccTGap_D_Dsply": 4, # Fixed time gap in UI }) + # Forwards FCW alert from IPMA + if fcw_alert: + values["FcwVisblWarn_B_Rq"] = 1 # FCW visible alert + return packer.make_can_msg("ACCDATA_3", CAN.main, values)