mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
delay controls start (#20761)
* delay controls start * shouldn't need this stuff anymore * only delay board * bail after 2s * fix loopback test * fix process replay * update refs * bump cereal Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: f9a961f6fb69f36f8a113246920b2d71e6af8ae1
This commit is contained in:
@@ -4,6 +4,7 @@ import os
|
||||
import sys
|
||||
import numbers
|
||||
import dictdiffer
|
||||
from collections import Counter
|
||||
|
||||
if "CI" in os.environ:
|
||||
def tqdm(x):
|
||||
@@ -60,7 +61,9 @@ def compare_logs(log1, log2, ignore_fields=None, ignore_msgs=None, tolerance=Non
|
||||
log1, log2 = [list(filter(lambda m: m.which() not in ignore_msgs, log)) for log in (log1, log2)]
|
||||
|
||||
if len(log1) != len(log2):
|
||||
raise Exception(f"logs are not same length: {len(log1)} VS {len(log2)}")
|
||||
cnt1 = Counter([m.which() for m in log1])
|
||||
cnt2 = Counter([m.which() for m in log2])
|
||||
raise Exception(f"logs are not same length: {len(log1)} VS {len(log2)}\n\t\t{cnt1}\n\t\t{cnt2}")
|
||||
|
||||
diff = []
|
||||
for msg1, msg2 in tqdm(zip(log1, log2)):
|
||||
|
||||
@@ -90,7 +90,6 @@ class FakeSubMaster(messaging.SubMaster):
|
||||
self.sock = {s: DumbSocket(s) for s in services}
|
||||
self.update_called = threading.Event()
|
||||
self.update_ready = threading.Event()
|
||||
|
||||
self.wait_on_getitem = False
|
||||
|
||||
def __getitem__(self, s):
|
||||
@@ -183,6 +182,13 @@ def get_car_params(msgs, fsm, can_sock):
|
||||
_, CP = get_car(can, sendcan)
|
||||
Params().put("CarParams", CP.to_bytes())
|
||||
|
||||
def controlsd_rcv_callback(msg, CP, cfg, fsm):
|
||||
# no sendcan until controlsd is initialized
|
||||
socks = [s for s in cfg.pub_sub[msg.which()] if
|
||||
(fsm.frame + 1) % int(service_list[msg.which()].frequency / service_list[s].frequency) == 0]
|
||||
if "sendcan" in socks and fsm.frame < 2000:
|
||||
socks.remove("sendcan")
|
||||
return socks, len(socks) > 0
|
||||
|
||||
def radar_rcv_callback(msg, CP, cfg, fsm):
|
||||
if msg.which() != "can":
|
||||
@@ -232,7 +238,7 @@ CONFIGS = [
|
||||
},
|
||||
ignore=["logMonoTime", "valid", "controlsState.startMonoTime", "controlsState.cumLagMs"],
|
||||
init_callback=fingerprint,
|
||||
should_recv_callback=None,
|
||||
should_recv_callback=controlsd_rcv_callback,
|
||||
tolerance=NUMPY_TOLERANCE,
|
||||
fake_pubsubmaster=True,
|
||||
),
|
||||
@@ -388,7 +394,7 @@ def python_replay_process(cfg, lr):
|
||||
recv_socks, should_recv = cfg.should_recv_callback(msg, CP, cfg, fsm)
|
||||
else:
|
||||
recv_socks = [s for s in cfg.pub_sub[msg.which()] if
|
||||
(fsm.frame + 1) % int(service_list[msg.which()].frequency / service_list[s].frequency) == 0]
|
||||
(fsm.frame + 1) % int(service_list[msg.which()].frequency / service_list[s].frequency) == 0]
|
||||
should_recv = bool(len(recv_socks))
|
||||
|
||||
if msg.which() == 'can':
|
||||
@@ -404,7 +410,6 @@ def python_replay_process(cfg, lr):
|
||||
while recv_cnt > 0:
|
||||
m = fpm.wait_for_msg()
|
||||
log_msgs.append(m)
|
||||
|
||||
recv_cnt -= m.which() in recv_socks
|
||||
return log_msgs
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
d48ac24ef8432244c8074337666c17bc9bfef442
|
||||
8bc705247a6f316da0a74d28d393101e8dcfcf57
|
||||
Reference in New Issue
Block a user