mirror of https://github.com/commaai/panda.git
parent
187fdee385
commit
494c5a403a
|
@ -87,22 +87,22 @@ class TestGmSafetyBase(common.PandaSafetyTest, common.DriverTorqueSteeringSafety
|
|||
values = {"ACCButtons": buttons}
|
||||
return self.packer.make_can_msg_panda("ASCMSteeringButton", self.BUTTONS_BUS, values)
|
||||
|
||||
def test_brake_safety_check(self, stock_longitudinal=False):
|
||||
def test_brake_safety_check(self):
|
||||
for enabled in [0, 1]:
|
||||
for b in range(0, 500):
|
||||
self.safety.set_controls_allowed(enabled)
|
||||
if abs(b) > MAX_BRAKE or (not enabled and b != 0) or stock_longitudinal:
|
||||
if abs(b) > MAX_BRAKE or (not enabled and b != 0):
|
||||
self.assertFalse(self._tx(self._send_brake_msg(b)))
|
||||
else:
|
||||
self.assertTrue(self._tx(self._send_brake_msg(b)))
|
||||
|
||||
def test_gas_safety_check(self, stock_longitudinal=False):
|
||||
def test_gas_safety_check(self):
|
||||
# Block if enabled and out of actuation range, disabled and not inactive regen, or if stock longitudinal
|
||||
for enabled in [0, 1]:
|
||||
for gas_regen in range(0, 2 ** 12 - 1):
|
||||
self.safety.set_controls_allowed(enabled)
|
||||
should_tx = (((enabled and MAX_REGEN <= gas_regen <= MAX_GAS) or
|
||||
(not enabled and gas_regen == INACTIVE_REGEN)) and not stock_longitudinal)
|
||||
should_tx = ((enabled and MAX_REGEN <= gas_regen <= MAX_GAS) or
|
||||
(not enabled and gas_regen == INACTIVE_REGEN))
|
||||
self.assertEqual(should_tx, self._tx(self._send_gas_msg(gas_regen)), (enabled, gas_regen))
|
||||
|
||||
|
||||
|
@ -192,12 +192,12 @@ class TestGmCameraSafety(TestGmSafetyBase):
|
|||
self._rx(self._pcm_status_msg(enabled))
|
||||
self.assertEqual(enabled, self._tx(self._button_msg(Buttons.CANCEL)))
|
||||
|
||||
# Uses stock longitudinal, allow no longitudinal actuation
|
||||
def test_brake_safety_check(self, stock_longitudinal=True):
|
||||
super().test_brake_safety_check(stock_longitudinal=stock_longitudinal)
|
||||
# GM Cam safety mode does not allow longitudinal messages
|
||||
def test_brake_safety_check(self):
|
||||
pass
|
||||
|
||||
def test_gas_safety_check(self, stock_longitudinal=True):
|
||||
super().test_gas_safety_check(stock_longitudinal=stock_longitudinal)
|
||||
def test_gas_safety_check(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue