From 0b721ed6365c1d10e0c01ed39f9031fc5b758348 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 00:45:20 -0400 Subject: [PATCH 01/12] test first --- tests/safety/test_volkswagen_mqb.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index 276ee6c27d..12746c54e3 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -8,6 +8,7 @@ MAX_ACCEL = 2.0 MIN_ACCEL = -3.5 +AEB_MIN_ACCEL = -8.0 MSG_ESP_19 = 0xB2 # RX from ABS, for wheel speeds MSG_LH_EPS_03 = 0x9F # RX from EPS, for driver steering torque @@ -102,6 +103,16 @@ def _acc_07_msg(self, accel, secondary_accel=3.02): values = {"ACC_Sollbeschleunigung_02": accel, "ACC_Folgebeschl": secondary_accel} return self.packer.make_can_msg_panda("ACC_07", 0, values) + # FCW/AEB control message + def _acc_10_msg(self, accel=0.0, partial_braking=False, target_braking=False, city_braking=False): + values = { + "ANB_Teilbremsung_Freigabe": partial_braking, + "ANB_Zielbremsung_Freigabe": target_braking, + "ANB_CM_Anforderung": city_braking, + "ANB_Zielbrems_Teilbrems_Verz_Anf": accel, + } + return self.packer.make_can_msg_panda("ACC_10", 0, values) + # Verify brake_pressed is true if either the switch or pressure threshold signals are true def test_redundant_brake_signals(self): test_combinations = [(True, True, True), (True, True, False), (True, False, True), (False, False, False)] @@ -220,6 +231,18 @@ def test_accel_safety_check(self): # ensure the optional secondary accel field remains inactive for now self.assertEqual(is_inactive_accel, self._tx(self._acc_07_msg(accel, secondary_accel=accel)), (controls_allowed, accel)) + def test_aeb_actuation(self): + for partial_braking, target_braking, city_braking in [[False, False, False], [True, False, False], [False, True, False], [False, False, True]]: + for accel in np.concatenate((np.arange(AEB_MIN_ACCEL - 2, 0.0, 0.1), [0.0])): + accel = round(accel, 2) # floats might not hit exact boundary conditions without rounding + aeb_valid_inactive = accel == 0.0 and not any([partial_braking, target_braking, city_braking]) + # TODO: When real AEB is implemented + # aeb_valid_active = AEB_MIN_ACCEL <= accel <= 0.0 and any([partial_braking, target_braking, city_braking]) + # send = aeb_valid_inactive or aeb_valid_active + send = aeb_valid_inactive + self.assertEqual(send, self._tx(self._acc_10_msg(accel, partial_braking, target_braking, city_braking)), + f"allowed invalid AEB actuation {accel=} {partial_braking=} {target_braking=} {city_braking=}") + if __name__ == "__main__": unittest.main() From e7a3c0a2e1f02ab865172d7956132910eaa58062 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 00:55:14 -0400 Subject: [PATCH 02/12] take out city braking until it's understood better --- tests/safety/test_volkswagen_mqb.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index 12746c54e3..0817251762 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -232,16 +232,16 @@ def test_accel_safety_check(self): self.assertEqual(is_inactive_accel, self._tx(self._acc_07_msg(accel, secondary_accel=accel)), (controls_allowed, accel)) def test_aeb_actuation(self): - for partial_braking, target_braking, city_braking in [[False, False, False], [True, False, False], [False, True, False], [False, False, True]]: + for partial_braking, target_braking in [[False, False], [True, False], [False, True]]: for accel in np.concatenate((np.arange(AEB_MIN_ACCEL - 2, 0.0, 0.1), [0.0])): accel = round(accel, 2) # floats might not hit exact boundary conditions without rounding - aeb_valid_inactive = accel == 0.0 and not any([partial_braking, target_braking, city_braking]) + aeb_valid_inactive = accel == 0.0 and not any([partial_braking, target_braking]) # TODO: When real AEB is implemented - # aeb_valid_active = AEB_MIN_ACCEL <= accel <= 0.0 and any([partial_braking, target_braking, city_braking]) + # aeb_valid_active = AEB_MIN_ACCEL <= accel <= 0.0 and any([partial_braking, target_braking]) # send = aeb_valid_inactive or aeb_valid_active send = aeb_valid_inactive - self.assertEqual(send, self._tx(self._acc_10_msg(accel, partial_braking, target_braking, city_braking)), - f"allowed invalid AEB actuation {accel=} {partial_braking=} {target_braking=} {city_braking=}") + self.assertEqual(send, self._tx(self._acc_10_msg(accel, partial_braking, target_braking)), + f"allowed invalid AEB actuation {accel=} {partial_braking=} {target_braking=}") if __name__ == "__main__": From a158cd8893cd65e04c763bd32c08b659dafc5138 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 00:58:12 -0400 Subject: [PATCH 03/12] add ACC_10 and ACC_15 forward testing --- tests/safety/test_volkswagen_mqb.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index 0817251762..9310d9c4fb 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -13,12 +13,14 @@ MSG_ESP_19 = 0xB2 # RX from ABS, for wheel speeds MSG_LH_EPS_03 = 0x9F # RX from EPS, for driver steering torque MSG_ESP_05 = 0x106 # RX from ABS, for brake light state +MSG_ACC_10 = 0x117 # TX by OP, FCW/AEB control to the stopping coordinator MSG_TSK_06 = 0x120 # RX from ECU, for ACC status from drivetrain coordinator MSG_MOTOR_20 = 0x121 # RX from ECU, for driver throttle input MSG_ACC_06 = 0x122 # TX by OP, ACC control instructions to the drivetrain coordinator MSG_HCA_01 = 0x126 # TX by OP, Heading Control Assist steering torque MSG_GRA_ACC_01 = 0x12B # TX by OP, ACC control buttons for cancel/resume MSG_ACC_07 = 0x12E # TX by OP, ACC control instructions to the drivetrain coordinator +MSG_ACC_15 = 0x2A9 # TX by OP, FCW/AEB HUD to the instrument cluster MSG_ACC_02 = 0x30C # TX by OP, ACC HUD data to the instrument cluster MSG_LDW_02 = 0x397 # TX by OP, Lane line recognition and text alerts @@ -168,8 +170,8 @@ def test_spam_cancel_safety_check(self): class TestVolkswagenMqbLongSafety(TestVolkswagenMqbSafety): - TX_MSGS = [[MSG_HCA_01, 0], [MSG_LDW_02, 0], [MSG_LH_EPS_03, 2], [MSG_ACC_02, 0], [MSG_ACC_06, 0], [MSG_ACC_07, 0]] - FWD_BLACKLISTED_ADDRS = {0: [MSG_LH_EPS_03], 2: [MSG_HCA_01, MSG_LDW_02, MSG_ACC_02, MSG_ACC_06, MSG_ACC_07]} + TX_MSGS = [[MSG_HCA_01, 0], [MSG_LDW_02, 0], [MSG_LH_EPS_03, 2], [MSG_ACC_02, 0], [MSG_ACC_06, 0], [MSG_ACC_07, 0], [MSG_ACC_10, 0], [MSG_ACC_15, 0]] + FWD_BLACKLISTED_ADDRS = {0: [MSG_LH_EPS_03], 2: [MSG_HCA_01, MSG_LDW_02, MSG_ACC_02, MSG_ACC_06, MSG_ACC_07, MSG_ACC_10, MSG_ACC_15]} FWD_BUS_LOOKUP = {0: 2, 2: 0} INACTIVE_ACCEL = 3.01 From 5a04137cbe6a4c113d36b9b677ea1a4a0a23e5ee Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:19:49 -0400 Subject: [PATCH 04/12] updated safety code, passing tests locally --- board/safety/safety_volkswagen_mqb.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_volkswagen_mqb.h b/board/safety/safety_volkswagen_mqb.h index d880a69a6e..475957c57d 100644 --- a/board/safety/safety_volkswagen_mqb.h +++ b/board/safety/safety_volkswagen_mqb.h @@ -23,12 +23,14 @@ const LongitudinalLimits VOLKSWAGEN_MQB_LONG_LIMITS = { #define MSG_ESP_19 0x0B2 // RX from ABS, for wheel speeds #define MSG_LH_EPS_03 0x09F // RX from EPS, for driver steering torque #define MSG_ESP_05 0x106 // RX from ABS, for brake switch state +#define MSG_ACC_10 0x117 // TX by OP, FCW/AEB control to the stopping coordinator #define MSG_TSK_06 0x120 // RX from ECU, for ACC status from drivetrain coordinator #define MSG_MOTOR_20 0x121 // RX from ECU, for driver throttle input #define MSG_ACC_06 0x122 // TX by OP, ACC control instructions to the drivetrain coordinator #define MSG_HCA_01 0x126 // TX by OP, Heading Control Assist steering torque #define MSG_GRA_ACC_01 0x12B // TX by OP, ACC control buttons for cancel/resume #define MSG_ACC_07 0x12E // TX by OP, ACC control instructions to the drivetrain coordinator +#define MSG_ACC_15 0x2A9 // TX by OP, FCW/AEB HUD to the instrument cluster #define MSG_ACC_02 0x30C // TX by OP, ACC HUD data to the instrument cluster #define MSG_MOTOR_14 0x3BE // RX from ECU, for brake switch status #define MSG_LDW_02 0x397 // TX by OP, Lane line recognition and text alerts @@ -37,7 +39,8 @@ const LongitudinalLimits VOLKSWAGEN_MQB_LONG_LIMITS = { const CanMsg VOLKSWAGEN_MQB_STOCK_TX_MSGS[] = {{MSG_HCA_01, 0, 8}, {MSG_GRA_ACC_01, 0, 8}, {MSG_GRA_ACC_01, 2, 8}, {MSG_LDW_02, 0, 8}, {MSG_LH_EPS_03, 2, 8}}; const CanMsg VOLKSWAGEN_MQB_LONG_TX_MSGS[] = {{MSG_HCA_01, 0, 8}, {MSG_LDW_02, 0, 8}, {MSG_LH_EPS_03, 2, 8}, - {MSG_ACC_02, 0, 8}, {MSG_ACC_06, 0, 8}, {MSG_ACC_07, 0, 8}}; + {MSG_ACC_02, 0, 8}, {MSG_ACC_06, 0, 8}, {MSG_ACC_07, 0, 8}, + {MSG_ACC_10, 0, 8}, {MSG_ACC_15, 0, 8}}; RxCheck volkswagen_mqb_rx_checks[] = { {.msg = {{MSG_ESP_19, 0, 8, .check_checksum = false, .max_counter = 0U, .frequency = 100U}, { 0 }, { 0 }}}, @@ -241,6 +244,25 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { } } + // Safety check for FCW/AEB control + if (addr == MSG_ACC_10) { + bool violation = false; + + bool partial_braking = GET_BIT(to_send, 28); // Signal: ACC_10.ANB_Teilbremsung_Freigabe + bool target_braking = GET_BIT(to_send, 39); // Signal: ACC_10.ANB_Zielbremsung_Freigabe + // Signal: ACC_10.ANB_Zielbrems_Teilbrems_Verz_Anf (acceleration in m/s2, scale 0.024, offset -20.016) + int aeb_accel = ((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3); + + // TODO: Until openpilot AEB is supported, enforcing no actuation + violation |= partial_braking; + violation |= target_braking; + violation |= aeb_accel != 834; // Inactive accel value + + if (violation) { + tx = false; + } + } + // FORCE CANCEL: ensuring that only the cancel button press is sent when controls are off. // This avoids unintended engagements while still allowing resume spam if ((addr == MSG_GRA_ACC_01) && !controls_allowed) { @@ -270,7 +292,8 @@ static int volkswagen_mqb_fwd_hook(int bus_num, int addr) { if ((addr == MSG_HCA_01) || (addr == MSG_LDW_02)) { // openpilot takes over LKAS steering control and related HUD messages from the camera bus_fwd = -1; - } else if (volkswagen_longitudinal && ((addr == MSG_ACC_02) || (addr == MSG_ACC_06) || (addr == MSG_ACC_07))) { + } else if (volkswagen_longitudinal && ((addr == MSG_ACC_02) || (addr == MSG_ACC_06) || (addr == MSG_ACC_07) || \ + (addr == MSG_ACC_10) || (addr == MSG_ACC_15))) { // openpilot takes over acceleration/braking control and related HUD messages from the stock ACC radar bus_fwd = -1; } else { From c597d01a925043e794c5212763a0a2df46d8cb7d Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:21:48 -0400 Subject: [PATCH 05/12] remove hanging ref to city braking --- tests/safety/test_volkswagen_mqb.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index 9310d9c4fb..ed1fc80747 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -106,11 +106,10 @@ def _acc_07_msg(self, accel, secondary_accel=3.02): return self.packer.make_can_msg_panda("ACC_07", 0, values) # FCW/AEB control message - def _acc_10_msg(self, accel=0.0, partial_braking=False, target_braking=False, city_braking=False): + def _acc_10_msg(self, accel=0.0, partial_braking=False, target_braking=False): values = { "ANB_Teilbremsung_Freigabe": partial_braking, "ANB_Zielbremsung_Freigabe": target_braking, - "ANB_CM_Anforderung": city_braking, "ANB_Zielbrems_Teilbrems_Verz_Anf": accel, } return self.packer.make_can_msg_panda("ACC_10", 0, values) From ab8591d7f2b4978d80a4fffcdfb000a66ebf98b2 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:24:51 -0400 Subject: [PATCH 06/12] line wrapping, named constant for inactive AEB accel --- tests/safety/test_volkswagen_mqb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index ed1fc80747..f29fbe816d 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -9,6 +9,7 @@ MAX_ACCEL = 2.0 MIN_ACCEL = -3.5 AEB_MIN_ACCEL = -8.0 +INACTIVE_AEB_ACCEL = 0.0 MSG_ESP_19 = 0xB2 # RX from ABS, for wheel speeds MSG_LH_EPS_03 = 0x9F # RX from EPS, for driver steering torque @@ -169,8 +170,10 @@ def test_spam_cancel_safety_check(self): class TestVolkswagenMqbLongSafety(TestVolkswagenMqbSafety): - TX_MSGS = [[MSG_HCA_01, 0], [MSG_LDW_02, 0], [MSG_LH_EPS_03, 2], [MSG_ACC_02, 0], [MSG_ACC_06, 0], [MSG_ACC_07, 0], [MSG_ACC_10, 0], [MSG_ACC_15, 0]] - FWD_BLACKLISTED_ADDRS = {0: [MSG_LH_EPS_03], 2: [MSG_HCA_01, MSG_LDW_02, MSG_ACC_02, MSG_ACC_06, MSG_ACC_07, MSG_ACC_10, MSG_ACC_15]} + TX_MSGS = [[MSG_HCA_01, 0], [MSG_LDW_02, 0], [MSG_LH_EPS_03, 2], [MSG_ACC_02, 0], + [MSG_ACC_06, 0], [MSG_ACC_07, 0], [MSG_ACC_10, 0], [MSG_ACC_15, 0]] + FWD_BLACKLISTED_ADDRS = {0: [MSG_LH_EPS_03], 2: [MSG_HCA_01, MSG_LDW_02, MSG_ACC_02, MSG_ACC_06, + MSG_ACC_07, MSG_ACC_10, MSG_ACC_15]} FWD_BUS_LOOKUP = {0: 2, 2: 0} INACTIVE_ACCEL = 3.01 @@ -234,7 +237,7 @@ def test_accel_safety_check(self): def test_aeb_actuation(self): for partial_braking, target_braking in [[False, False], [True, False], [False, True]]: - for accel in np.concatenate((np.arange(AEB_MIN_ACCEL - 2, 0.0, 0.1), [0.0])): + for accel in np.concatenate((np.arange(AEB_MIN_ACCEL - 2, 0.0, 0.1), [INACTIVE_AEB_ACCEL])): accel = round(accel, 2) # floats might not hit exact boundary conditions without rounding aeb_valid_inactive = accel == 0.0 and not any([partial_braking, target_braking]) # TODO: When real AEB is implemented From a34a6496ea14ea470c69225a60a8f790faa1dc29 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:26:18 -0400 Subject: [PATCH 07/12] finish naming that constant --- tests/safety/test_volkswagen_mqb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index f29fbe816d..b40eebfc64 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -239,7 +239,7 @@ def test_aeb_actuation(self): for partial_braking, target_braking in [[False, False], [True, False], [False, True]]: for accel in np.concatenate((np.arange(AEB_MIN_ACCEL - 2, 0.0, 0.1), [INACTIVE_AEB_ACCEL])): accel = round(accel, 2) # floats might not hit exact boundary conditions without rounding - aeb_valid_inactive = accel == 0.0 and not any([partial_braking, target_braking]) + aeb_valid_inactive = accel == INACTIVE_AEB_ACCEL and not any([partial_braking, target_braking]) # TODO: When real AEB is implemented # aeb_valid_active = AEB_MIN_ACCEL <= accel <= 0.0 and any([partial_braking, target_braking]) # send = aeb_valid_inactive or aeb_valid_active From 8a58a82815d42c7b8553df53dd28ce5614de2775 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:34:24 -0400 Subject: [PATCH 08/12] better but not great --- board/safety/safety_volkswagen_mqb.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_volkswagen_mqb.h b/board/safety/safety_volkswagen_mqb.h index 475957c57d..534bd4cfc9 100644 --- a/board/safety/safety_volkswagen_mqb.h +++ b/board/safety/safety_volkswagen_mqb.h @@ -251,12 +251,13 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { bool partial_braking = GET_BIT(to_send, 28); // Signal: ACC_10.ANB_Teilbremsung_Freigabe bool target_braking = GET_BIT(to_send, 39); // Signal: ACC_10.ANB_Zielbremsung_Freigabe // Signal: ACC_10.ANB_Zielbrems_Teilbrems_Verz_Anf (acceleration in m/s2, scale 0.024, offset -20.016) - int aeb_accel = ((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3); + // aeb_accel = true aeb_accel * 1000 to avoid floating point math + int aeb_accel = ((((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3)) * 24U) - 20016U; // TODO: Until openpilot AEB is supported, enforcing no actuation violation |= partial_braking; violation |= target_braking; - violation |= aeb_accel != 834; // Inactive accel value + violation |= aeb_accel != 0; // Inactive accel value if (violation) { tx = false; From 488b262c2a0b199aa65fbdc89962be5ac044c005 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:42:29 -0400 Subject: [PATCH 09/12] wordsmithing --- board/safety/safety_volkswagen_mqb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/safety/safety_volkswagen_mqb.h b/board/safety/safety_volkswagen_mqb.h index 534bd4cfc9..6a69715e63 100644 --- a/board/safety/safety_volkswagen_mqb.h +++ b/board/safety/safety_volkswagen_mqb.h @@ -254,7 +254,7 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { // aeb_accel = true aeb_accel * 1000 to avoid floating point math int aeb_accel = ((((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3)) * 24U) - 20016U; - // TODO: Until openpilot AEB is supported, enforcing no actuation + // TODO: Until openpilot AEB is supported, enforce no actuation violation |= partial_braking; violation |= target_braking; violation |= aeb_accel != 0; // Inactive accel value From 6f8553307ae4ef7702d3e231d2b14b8f38191a6b Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:42:40 -0400 Subject: [PATCH 10/12] MISRA --- board/safety/safety_volkswagen_mqb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_volkswagen_mqb.h b/board/safety/safety_volkswagen_mqb.h index 6a69715e63..9d2b39c033 100644 --- a/board/safety/safety_volkswagen_mqb.h +++ b/board/safety/safety_volkswagen_mqb.h @@ -248,8 +248,8 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { if (addr == MSG_ACC_10) { bool violation = false; - bool partial_braking = GET_BIT(to_send, 28); // Signal: ACC_10.ANB_Teilbremsung_Freigabe - bool target_braking = GET_BIT(to_send, 39); // Signal: ACC_10.ANB_Zielbremsung_Freigabe + bool partial_braking = GET_BIT(to_send, 28U); // Signal: ACC_10.ANB_Teilbremsung_Freigabe + bool target_braking = GET_BIT(to_send, 39U); // Signal: ACC_10.ANB_Zielbremsung_Freigabe // Signal: ACC_10.ANB_Zielbrems_Teilbrems_Verz_Anf (acceleration in m/s2, scale 0.024, offset -20.016) // aeb_accel = true aeb_accel * 1000 to avoid floating point math int aeb_accel = ((((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3)) * 24U) - 20016U; From 3358d674fa68d4452205f5571bd30d7a7c32c02f Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 01:55:08 -0400 Subject: [PATCH 11/12] cleanup/fix test debug output --- tests/safety/test_volkswagen_mqb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safety/test_volkswagen_mqb.py b/tests/safety/test_volkswagen_mqb.py index b40eebfc64..4823893b67 100755 --- a/tests/safety/test_volkswagen_mqb.py +++ b/tests/safety/test_volkswagen_mqb.py @@ -245,7 +245,7 @@ def test_aeb_actuation(self): # send = aeb_valid_inactive or aeb_valid_active send = aeb_valid_inactive self.assertEqual(send, self._tx(self._acc_10_msg(accel, partial_braking, target_braking)), - f"allowed invalid AEB actuation {accel=} {partial_braking=} {target_braking=}") + f"{send=} {accel=} {partial_braking=} {target_braking=}") if __name__ == "__main__": From e928af1ca9ebee96c2350a687f6fd31050c83192 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sun, 8 Sep 2024 03:21:43 -0400 Subject: [PATCH 12/12] not really a TODO kind of comment --- board/safety/safety_volkswagen_mqb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/safety/safety_volkswagen_mqb.h b/board/safety/safety_volkswagen_mqb.h index 9d2b39c033..6852317934 100644 --- a/board/safety/safety_volkswagen_mqb.h +++ b/board/safety/safety_volkswagen_mqb.h @@ -254,7 +254,7 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { // aeb_accel = true aeb_accel * 1000 to avoid floating point math int aeb_accel = ((((GET_BYTE(to_send, 3) & 0xE0U) >> 5) | ((GET_BYTE(to_send, 4) & 0x7FU) << 3)) * 24U) - 20016U; - // TODO: Until openpilot AEB is supported, enforce no actuation + // Until openpilot AEB is supported, enforce no actuation violation |= partial_braking; violation |= target_braking; violation |= aeb_accel != 0; // Inactive accel value