From 17f26e263b41d99d35ccd254828c9d4d112b0f71 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Mon, 17 Jan 2022 22:06:44 +0000 Subject: [PATCH] Ford: angle violation shouldn't end controls --- board/safety/safety_ford.h | 2 +- tests/safety/test_ford.py | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/board/safety/safety_ford.h b/board/safety/safety_ford.h index f8c74a4c21c..27291d1cf79 100644 --- a/board/safety/safety_ford.h +++ b/board/safety/safety_ford.h @@ -177,7 +177,7 @@ static int ford_tx_hook(CANPacket_t *to_send) { // tx = 0; // } - // No angle control allowed when controls are not allowed + // No steer control allowed when controls are not allowed if (!controls_allowed && steer_control_enabled) { tx = 0; } diff --git a/tests/safety/test_ford.py b/tests/safety/test_ford.py index 14d706173d1..9f5f936cde1 100755 --- a/tests/safety/test_ford.py +++ b/tests/safety/test_ford.py @@ -139,37 +139,30 @@ def test_angle_cmd_when_enabled(self): # Stay within limits # Don't change self.assertTrue(self._tx(self._lkas_control_msg(a, 1))) - self.assertTrue(self.safety.get_controls_allowed()) # Up self.assertTrue(self._tx(self._lkas_control_msg(a + sign(a) * max_delta_up, 1))) - self.assertTrue(self.safety.get_controls_allowed()) # Down self._set_prev_angle(a) self.assertTrue(self._tx(self._lkas_control_msg(a - sign(a) * max_delta_down, 1))) - self.assertTrue(self.safety.get_controls_allowed()) # Inject too high rates # Up self._set_prev_angle(a) self.assertFalse(self._tx(self._lkas_control_msg(a + sign(a) * (max_delta_up + 1.1), 1))) - self.assertFalse(self.safety.get_controls_allowed()) # Don't change - self.safety.set_controls_allowed(1) self._set_prev_angle(a) - self.assertTrue(self.safety.get_controls_allowed()) self.assertEqual(True, self._tx(self._lkas_control_msg(a, 1))) - self.assertTrue(self.safety.get_controls_allowed()) # Down self.assertEqual(False, self._tx(self._lkas_control_msg(a - sign(a) * (max_delta_down + 1.1), 1))) - self.assertFalse(self.safety.get_controls_allowed()) - # Check desired steer should be the same as steer angle when controls are off - self.safety.set_controls_allowed(0) - self.assertEqual(True, self._tx(self._lkas_control_msg(a, 0))) + # TODO: ford safety doesn't check for this yet + # # Check desired steer should be the same as steer angle when controls are off + # self.safety.set_controls_allowed(0) + # self.assertEqual(True, self._tx(self._lkas_control_msg(a, 0))) def test_steer_when_disabled(self): self.safety.set_controls_allowed(0)