Hyundai CAN-FD Longitudinal: enable for ICE camera-SCC cars (non-HDA2) (#1671)

* allow ice camera scc longitudinal

* Merge commaai#30021

* test

* clean up

* clean up 2

* some test work

* re-use existing test for radar-scc for now

* clean up

* clean up

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
This commit is contained in:
Jason Wen 2023-12-09 20:37:28 -05:00 committed by GitHub
parent ff49666893
commit a6b76dfda0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -320,11 +320,6 @@ static safety_config hyundai_canfd_init(uint16_t param) {
hyundai_canfd_alt_buttons = GET_FLAG(param, HYUNDAI_PARAM_CANFD_ALT_BUTTONS); hyundai_canfd_alt_buttons = GET_FLAG(param, HYUNDAI_PARAM_CANFD_ALT_BUTTONS);
hyundai_canfd_hda2_alt_steering = GET_FLAG(param, HYUNDAI_PARAM_CANFD_HDA2_ALT_STEERING); hyundai_canfd_hda2_alt_steering = GET_FLAG(param, HYUNDAI_PARAM_CANFD_HDA2_ALT_STEERING);
// no long for ICE yet
if (!hyundai_ev_gas_signal && !hyundai_hybrid_gas_signal) {
hyundai_longitudinal = false;
}
// no long for radar-SCC HDA1 yet // no long for radar-SCC HDA1 yet
if (!hyundai_canfd_hda2 && !hyundai_camera_scc) { if (!hyundai_canfd_hda2 && !hyundai_camera_scc) {
hyundai_longitudinal = false; hyundai_longitudinal = false;

View File

@ -224,7 +224,14 @@ class TestHyundaiCanfdHDA2LongEV(HyundaiLongitudinalBase, TestHyundaiCanfdHDA2EV
return self.packer.make_can_msg_panda("SCC_CONTROL", 1, values) return self.packer.make_can_msg_panda("SCC_CONTROL", 1, values)
class TestHyundaiCanfdHDALongHybrid(HyundaiLongitudinalBase, TestHyundaiCanfdHDA1Base): # Tests HDA1 longitudinal for ICE, hybrid, EV
@parameterized_class([
# Camera SCC is the only supported configuration for HDA1 longitudinal, TODO: allow radar SCC
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_EV_GAS},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_HYBRID_GAS},
])
class TestHyundaiCanfdHDA1Long(HyundaiLongitudinalBase, TestHyundaiCanfdHDA1Base):
FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0x1e0, 0x1a0]} FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0x1e0, 0x1a0]}
@ -234,14 +241,19 @@ class TestHyundaiCanfdHDALongHybrid(HyundaiLongitudinalBase, TestHyundaiCanfdHDA
DISABLED_ECU_ACTUATION_MSG = (0x1a0, 0) DISABLED_ECU_ACTUATION_MSG = (0x1a0, 0)
STEER_MSG = "LFA" STEER_MSG = "LFA"
GAS_MSG = ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL")
STEER_BUS = 0 STEER_BUS = 0
SCC_BUS = 2 SCC_BUS = 2
@classmethod
def setUpClass(cls):
if cls.__name__ == "TestHyundaiCanfdHDA1Long":
cls.safety = None
raise unittest.SkipTest
def setUp(self): def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd") self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CAMERA_SCC | Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_HYBRID_GAS) self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CAMERA_SCC | self.SAFETY_PARAM)
self.safety.init_tests() self.safety.init_tests()
def _accel_msg(self, accel, aeb_req=False, aeb_decel=0): def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):