mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-10 07:22:07 +08:00
fix loopback test safety setting (#28184)
* fix loopback safety setting * pandad: catch and log all exceptions --------- Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -140,10 +140,14 @@ def main() -> NoReturn:
|
||||
|
||||
for p in pandas:
|
||||
p.close()
|
||||
# TODO: wrap all panda exceptions in a base panda exception
|
||||
except (usb1.USBErrorNoDevice, usb1.USBErrorPipe):
|
||||
# a panda was disconnected while setting everything up. let's try again
|
||||
cloudlog.exception("Panda USB exception while setting up")
|
||||
continue
|
||||
except Exception:
|
||||
cloudlog.exception("pandad.uncaught_exception")
|
||||
continue
|
||||
|
||||
first_run = False
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ class TestBoardd(unittest.TestCase):
|
||||
@phone_only
|
||||
@with_processes(['pandad'])
|
||||
def test_loopback(self):
|
||||
# wait for boardd to init
|
||||
time.sleep(2)
|
||||
params = Params()
|
||||
params.put_bool("IsOnroad", False)
|
||||
|
||||
with Timeout(60, "boardd didn't start"):
|
||||
sm = messaging.SubMaster(['pandaStates'])
|
||||
@@ -45,21 +45,21 @@ class TestBoardd(unittest.TestCase):
|
||||
self.assertEqual(num_pandas, expected_pandas, "connected pandas ({num_pandas}) doesn't match expected panda count ({expected_pandas}). \
|
||||
connect another panda for multipanda tests.")
|
||||
|
||||
# boardd blocks on FirmwareQueryDone, ControlsReady, and CarParams
|
||||
# boardd safety setting relies on these params
|
||||
cp = car.CarParams.new_message()
|
||||
|
||||
safety_config = car.CarParams.SafetyConfig.new_message()
|
||||
safety_config.safetyModel = car.CarParams.SafetyModel.allOutput
|
||||
cp.safetyConfigs = [safety_config]*num_pandas
|
||||
|
||||
params = Params()
|
||||
params.put_bool("IsOnroad", True)
|
||||
params.put_bool("FirmwareQueryDone", True)
|
||||
params.put_bool("ControlsReady", True)
|
||||
params.put("CarParams", cp.to_bytes())
|
||||
|
||||
sendcan = messaging.pub_sock('sendcan')
|
||||
can = messaging.sub_sock('can', conflate=False, timeout=100)
|
||||
time.sleep(0.2)
|
||||
time.sleep(0.5)
|
||||
|
||||
n = 200
|
||||
for i in range(n):
|
||||
|
||||
Reference in New Issue
Block a user