Files
sunnypilot/selfdrive/debug/run_process_on_route.py
T
github-actions[bot] f5e5d688c3 sunnypilot v2025.03.18-1285
version: sunnypilot v0.9.9 release
  date: 2025-03-18T06:26:39
  master commit: 8e5b656e654a7694c22f2b0b7bee0802db02b4af
2025-03-18 06:26:39 +00:00

31 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS, replay_process
from openpilot.tools.lib.logreader import LogReader, save_log
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run process on route and create new logs",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--fingerprint", help="The fingerprint to use")
parser.add_argument("route", help="The route name to use")
parser.add_argument("process", nargs='+', help="The process(s) to run")
args = parser.parse_args()
cfgs = [c for c in CONFIGS if c.proc_name in args.process]
lr = LogReader(args.route)
inputs = list(lr)
outputs = replay_process(cfgs, inputs, fingerprint=args.fingerprint)
# Remove message generated by the process under test and merge in the new messages
produces = {o.which() for o in outputs}
inputs = [i for i in inputs if i.which() not in produces]
outputs = sorted(inputs + outputs, key=lambda x: x.logMonoTime)
fn = f"{args.route.replace('/', '_')}_{'_'.join(args.process)}.zst"
print(f"Saving log to {fn}")
save_log(fn, outputs)