mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 03:52:11 +08:00
Remove can_capnp_to_can_list (#34542)
* about equal with multiprocessing * but almost half without ;) * rm * Update tools/replay/can_replay.py
This commit is contained in:
@@ -2,10 +2,3 @@
|
||||
from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp, can_capnp_to_list
|
||||
assert can_list_to_can_capnp
|
||||
assert can_capnp_to_list
|
||||
|
||||
def can_capnp_to_can_list(can, src_filter=None):
|
||||
ret = []
|
||||
for msg in can:
|
||||
if src_filter is None or msg.src in src_filter:
|
||||
ret.append((msg.address, msg.dat, msg.src))
|
||||
return ret
|
||||
|
||||
@@ -8,7 +8,7 @@ import threading
|
||||
os.environ['FILEREADER_CACHE'] = '1'
|
||||
|
||||
from openpilot.common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
|
||||
from openpilot.selfdrive.pandad import can_capnp_to_can_list
|
||||
from openpilot.selfdrive.pandad import can_capnp_to_list
|
||||
from openpilot.tools.lib.logreader import LogReader
|
||||
from panda import PandaJungle
|
||||
|
||||
@@ -80,17 +80,15 @@ def connect():
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
def process(lr):
|
||||
return [can_capnp_to_can_list(m.can) for m in lr if m.which() == 'can']
|
||||
|
||||
def load_route(route_or_segment_name):
|
||||
print("Loading log...")
|
||||
sr = LogReader(route_or_segment_name)
|
||||
CP = sr.first("carParams")
|
||||
print(f"carFingerprint (for hardcoding fingerprint): '{CP.carFingerprint}'")
|
||||
CAN_MSGS = sr.run_across_segments(24, process)
|
||||
print("Finished loading...")
|
||||
return CAN_MSGS
|
||||
lr = LogReader(route_or_segment_name)
|
||||
CP = lr.first("carParams")
|
||||
print(f"carFingerprint: '{CP.carFingerprint}'")
|
||||
mbytes = [m.as_builder().to_bytes() for m in lr if m.which() == 'can']
|
||||
return [m[1] for m in can_capnp_to_list(mbytes)]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Replay CAN messages from a route to all connected pandas and jungles in a loop.",
|
||||
|
||||
Reference in New Issue
Block a user