Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9515c06

Browse files
committedDec 21, 2023
fix test for new gas factor
1 parent c27be73 commit 9515c06

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎tests/safety/test_honda.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,9 @@ class TestHondaBoschLongSafety(HondaButtonEnableBase, TestHondaBoschSafetyBase):
529529
"""
530530
Covers the Honda Bosch safety mode with longitudinal control
531531
"""
532-
# TODO: correct gas factor to match dbc
533-
NO_GAS = -30000
532+
NO_GAS = -3000
534533
MIN_GAS = -4.0
535-
MAX_GAS = 2000
534+
MAX_GAS = 200
536535
MAX_ACCEL = 2.0 # accel is used for brakes, but openpilot can set positive values
537536
MIN_ACCEL = -3.5
538537

@@ -568,10 +567,10 @@ def test_diagnostics(self):
568567

569568
def test_gas_safety_check(self):
570569
for controls_allowed in [True, False]:
571-
for gas in np.arange(self.NO_GAS, self.MAX_GAS + 2000, 100):
572-
accel = 0 if gas < 0 else gas / 1000
570+
for gas in np.arange(self.NO_GAS, self.MAX_GAS + 200, 1):
571+
accel = 0 if gas < self.MIN_GAS else gas / 100
573572
self.safety.set_controls_allowed(controls_allowed)
574-
send = (controls_allowed and 0 <= gas <= self.MAX_GAS) or gas == self.NO_GAS
573+
send = (controls_allowed and self.MIN_GAS <= gas <= self.MAX_GAS) or gas == self.NO_GAS
575574
self.assertEqual(send, self._tx(self._send_gas_brake_msg(gas, accel)), (controls_allowed, gas, accel))
576575

577576
def test_brake_safety_check(self):

0 commit comments

Comments
 (0)
Please sign in to comment.