This commit is contained in:
Justin Newberry 2024-01-12 11:13:17 -08:00
parent 08ca10e91c
commit 4d90edada0
1 changed files with 2 additions and 7 deletions

View File

@ -72,8 +72,7 @@ def replay_drive(lr, safety_mode, param, alternative_experience, segment=False):
return tx_controls_blocked == 0 and rx_invalid == 0 and not safety_tick_rx_invalid
if __name__ == "__main__":
from openpilot.tools.lib.route import Route, SegmentName
from openpilot.tools.lib.logreader import MultiLogIterator # pylint: disable=import-error
from openpilot.tools.lib.srreader import SegmentRangeReader
parser = argparse.ArgumentParser(description="Replay CAN messages from a route or segment through a safety mode",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@ -83,11 +82,7 @@ if __name__ == "__main__":
parser.add_argument("--alternative-experience", type=int, help="Override the alternative experience from the log")
args = parser.parse_args()
s = SegmentName(args.route_or_segment_name[0], allow_route_name=True)
r = Route(s.route_name.canonical_name)
logs = r.log_paths()[s.segment_num:s.segment_num+1] if s.segment_num >= 0 else r.log_paths()
lr = MultiLogIterator(logs, sort_by_time=True)
lr = SegmentRangeReader(args.route_or_segment_name[0])
if None in (args.mode, args.param, args.alternative_experience):
for msg in lr: