From b7671308cf1eff433bf0340e6278130a9ee90e10 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Thu, 14 Apr 2022 01:31:27 +0100 Subject: [PATCH] don't send current angle when not active --- board/safety/safety_ford.h | 7 ------- tests/safety/test_ford.py | 9 ++------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/board/safety/safety_ford.h b/board/safety/safety_ford.h index f6d1e58444c..d1d5de38df2 100644 --- a/board/safety/safety_ford.h +++ b/board/safety/safety_ford.h @@ -189,13 +189,6 @@ static int ford_tx_hook(CANPacket_t *to_send, bool longitudinal_allowed) { } desired_angle_last = desired_angle; - // TODO: this is broken because we can't send the current angle most of the time - - // the signal only supports angles in range [-0.5, 0.5] radians - // // Angle should be the same as current angle while not steering - // if (!controls_allowed && ((desired_angle < (angle_meas.min - 1)) || (desired_angle > (angle_meas.max + 1)))) { - // tx = 0; - // } - // 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 96e2ad077e2..8844b0bf403 100755 --- a/tests/safety/test_ford.py +++ b/tests/safety/test_ford.py @@ -48,7 +48,7 @@ def setUp(self): raise unittest.SkipTest # Driver brake pedal - def _brake_msg(self, brake): + def _user_brake_msg(self, brake): # brake pedal and cruise state share same message, so we have to send # the other signal too (use prev value) enable = self.safety.get_controls_allowed() @@ -64,7 +64,7 @@ def _speed_msg(self, speed): return self.packer.make_can_msg_panda("EngVehicleSpThrottle2", 0, values) # Drive throttle input - def _gas_msg(self, gas): + def _user_gas_msg(self, gas): values = {"ApedPos_Pc_ActlArb": gas} return self.packer.make_can_msg_panda("EngVehicleSpThrottle", 0, values) @@ -159,11 +159,6 @@ def test_angle_cmd_when_enabled(self): # Down self.assertEqual(False, self._tx(self._lkas_control_msg(a - sign(a) * (max_delta_down + 1.1), 1))) - # 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)