diff --git a/opendbc_repo/opendbc/car/hyundai/carcontroller.py b/opendbc_repo/opendbc/car/hyundai/carcontroller.py index 1d71abd060..7cc881003f 100644 --- a/opendbc_repo/opendbc/car/hyundai/carcontroller.py +++ b/opendbc_repo/opendbc/car/hyundai/carcontroller.py @@ -422,7 +422,7 @@ def _scale01(x, lo, hi): if self.CP.carFingerprint in CAN_GEARS["send_mdps12"] and CS.mdps12 is not None: # send mdps12 to LKAS to prevent LKAS error can_sends.append(hyundaican.create_mdps12(self.packer, self.frame, CS.mdps12)) - casper_opt = self.CP.carFingerprint in (CAR.HYUNDAI_CASPER_EV) + casper_ev = self.CP.carFingerprint == CAR.HYUNDAI_CASPER_EV if self.frame % 2 == 0 and self.CP.openpilotLongitudinalControl: self.hyundai_jerk.make_jerk(self.CP, CS, accel, actuators, hud_control) self.hyundai_jerk.check_carrot_cruise(CC, CS, hud_control, stopping, accel, actuators.aTarget) @@ -432,7 +432,7 @@ def _scale01(x, lo, hi): can_sends.extend(hyundaican.create_acc_commands_scc(self.packer, CC.enabled, accel, self.hyundai_jerk, int(self.frame / 2), hud_control, set_speed_in_units, stopping, - CC.cruiseControl.override, casper_opt, CS, self.soft_hold_mode)) + CC.cruiseControl.override, casper_ev, CS, self.soft_hold_mode)) else: can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, self.hyundai_jerk, int(self.frame / 2), hud_control, set_speed_in_units, stopping, @@ -447,7 +447,7 @@ def _scale01(x, lo, hi): if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: if camera_scc: if CS.scc13 is not None: - if casper_opt: + if casper_ev: #can_sends.append(hyundaican.create_acc_opt_copy(CS, self.packer)) pass pass diff --git a/opendbc_repo/opendbc/car/hyundai/carstate.py b/opendbc_repo/opendbc/car/hyundai/carstate.py index 4f8c82ee4f..8a5fffe04f 100644 --- a/opendbc_repo/opendbc/car/hyundai/carstate.py +++ b/opendbc_repo/opendbc/car/hyundai/carstate.py @@ -397,6 +397,11 @@ def update(self, can_parsers) -> structs.CarState: aeb_warning = cp_cruise.vl[aeb_src]["CF_VSM_Warn"] != 0 scc_warning = cp_cruise.vl["SCC12"]["TakeOverReq"] == 1 # sometimes only SCC system shows an FCW aeb_braking = cp_cruise.vl[aeb_src]["CF_VSM_DecCmdAct"] != 0 or cp_cruise.vl[aeb_src][aeb_sig] != 0 + if self.CP.carFingerprint == CAR.HYUNDAI_CASPER_EV and aeb_src == "FCA11": + fca_fault = cp_cruise.vl["FCA11"]["FCA_Failinfo"] != 0 or cp_cruise.vl["FCA11"]["FCA_Status"] == 3 + if fca_fault: + aeb_warning = False + aeb_braking = False ret.stockFcw = (aeb_warning or scc_warning) and not aeb_braking ret.stockAeb = aeb_warning and aeb_braking diff --git a/opendbc_repo/opendbc/car/hyundai/hyundaican.py b/opendbc_repo/opendbc/car/hyundai/hyundaican.py index d0c3f7f8f4..9d29da17d8 100644 --- a/opendbc_repo/opendbc/car/hyundai/hyundaican.py +++ b/opendbc_repo/opendbc/car/hyundai/hyundaican.py @@ -4,6 +4,25 @@ hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) +def suppress_casper_ev_fca11_fault(values): + # CASPER EV can report transient FCA faults during camera-SCC handoff. + # Keep the copied FCA11 frame non-faulting without changing other cars. + fca_fault = values["FCA_Failinfo"] != 0 or values["FCA_Status"] == 3 + values["FCA_Failinfo"] = 0 + + if fca_fault: + values["FCA_Status"] = 2 + values["CF_VSM_Prefill"] = 0 + values["CF_VSM_HBACmd"] = 0 + values["CF_VSM_Warn"] = 0 + values["CF_VSM_BeltCmd"] = 0 + values["CR_VSM_DecCmd"] = 0 + values["FCA_CmdAct"] = 0 + values["FCA_StopReq"] = 0 + values["CF_VSM_DecCmdAct"] = 0 + + return values + def create_lkas11(packer, frame, CP, apply_torque, steer_req, torque_fault, lkas11, sys_warning, sys_state, enabled, left_lane, right_lane, @@ -134,7 +153,7 @@ def create_lfahda_mfc(packer, CC, blinking_signal): } return packer.make_can_msg("LFAHDA_MFC", 0, values) -def create_acc_commands_scc(packer, enabled, accel, jerk, idx, hud_control, set_speed, stopping, long_override, use_fca, CS, soft_hold_mode): +def create_acc_commands_scc(packer, enabled, accel, jerk, idx, hud_control, set_speed, stopping, long_override, suppress_casper_ev_fca, CS, soft_hold_mode): from opendbc.car.hyundai.carcontroller import HyundaiJerk cruise_available = CS.out.cruiseState.available if CS.paddle_button_prev > 0: @@ -214,11 +233,8 @@ def create_acc_commands_scc(packer, enabled, accel, jerk, idx, hud_control, set_ values["ObjDistStat"] = objGap2 commands.append(packer.make_can_msg("SCC14", 0, values)) - if CS.fca11 is not None and use_fca: # CASPER_EV의 경우 FCA11에서 fail이 간헐적 발생함.. 그냥막자.. 원인불명.. - values = copy.copy(CS.fca11) - if values["FCA_Failinfo"] != 0: - values["FCA_Status"] = 2 - values["FCA_Failinfo"] = 0 + if CS.fca11 is not None and suppress_casper_ev_fca: # CASPER_EV의 경우 FCA11에서 fail이 간헐적 발생함.. 그냥막자.. 원인불명.. + values = suppress_casper_ev_fca11_fault(copy.copy(CS.fca11)) fca11_dat = packer.make_can_msg("FCA11", 0, values)[1] values["CR_FCA_ChkSum"] = hyundai_checksum(fca11_dat[:7]) commands.append(packer.make_can_msg("FCA11", 0, values)) diff --git a/selfdrive/carrot/web/index.html b/selfdrive/carrot/web/index.html index 30b5b9b69f..de44ece00d 100644 --- a/selfdrive/carrot/web/index.html +++ b/selfdrive/carrot/web/index.html @@ -1,7 +1,8 @@ - +
+