Skip to content

Commit

Permalink
don't send current angle when not active
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed Apr 28, 2022
1 parent 84e3bce commit b767130
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
7 changes: 0 additions & 7 deletions board/safety/safety_ford.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions tests/safety/test_ford.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b767130

Please sign in to comment.