Skip to content

Commit

Permalink
fix test for new gas factor
Browse files Browse the repository at this point in the history
  • Loading branch information
csouers committed Dec 28, 2023
1 parent 214d535 commit 7f8feaa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/safety/test_honda.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,9 @@ class TestHondaBoschLongSafety(HondaButtonEnableBase, TestHondaBoschSafetyBase):
"""
Covers the Honda Bosch safety mode with longitudinal control
"""
# TODO: correct gas factor to match dbc
NO_GAS = -30000
NO_GAS = -3000
MIN_GAS = -4.0
MAX_GAS = 2000
MAX_GAS = 200
MAX_ACCEL = 2.0 # accel is used for brakes, but openpilot can set positive values
MIN_ACCEL = -3.5

Expand Down Expand Up @@ -568,10 +567,10 @@ def test_diagnostics(self):

def test_gas_safety_check(self):
for controls_allowed in [True, False]:
for gas in np.arange(self.NO_GAS, self.MAX_GAS + 2000, 100):
accel = 0 if gas < 0 else gas / 1000
for gas in np.arange(self.NO_GAS, self.MAX_GAS + 200, 1):
accel = 0 if gas < self.MIN_GAS else gas / 100
self.safety.set_controls_allowed(controls_allowed)
send = (controls_allowed and 0 <= gas <= self.MAX_GAS) or gas == self.NO_GAS
send = (controls_allowed and self.MIN_GAS <= gas <= self.MAX_GAS) or gas == self.NO_GAS
self.assertEqual(send, self._tx(self._send_gas_brake_msg(gas, accel)), (controls_allowed, gas, accel))

def test_brake_safety_check(self):
Expand Down

0 comments on commit 7f8feaa

Please sign in to comment.