Skip to content

Commit

Permalink
plotjuggler: opt-out log migration (#34587)
Browse files Browse the repository at this point in the history
* Option to migrate logs if needed

* Opt-out migration

* Remove late import
  • Loading branch information
fredyshox authored Feb 15, 2025
1 parent ec6c7cd commit 032f368
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/plotjuggler/juggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from opendbc.car.fingerprints import MIGRATION
from openpilot.common.basedir import BASEDIR
from openpilot.tools.lib.logreader import LogReader, ReadMode, save_log
from openpilot.selfdrive.test.process_replay.migration import migrate_all

juggle_dir = os.path.dirname(os.path.realpath(__file__))

Expand Down Expand Up @@ -76,10 +77,12 @@ def process(can, lr):
return [d for d in lr if can or d.which() not in ['can', 'sendcan']]


def juggle_route(route_or_segment_name, can, layout, dbc=None):
def juggle_route(route_or_segment_name, can, layout, dbc, should_migrate):
sr = LogReader(route_or_segment_name, default_mode=ReadMode.AUTO_INTERACTIVE)

all_data = sr.run_across_segments(24, partial(process, can))
if should_migrate:
all_data = migrate_all(all_data)

# Infer DBC name from logs
if dbc is None:
Expand All @@ -105,6 +108,7 @@ def juggle_route(route_or_segment_name, can, layout, dbc=None):
parser.add_argument("--demo", action="store_true", help="Use the demo route instead of providing one")
parser.add_argument("--can", action="store_true", help="Parse CAN data")
parser.add_argument("--stream", action="store_true", help="Start PlotJuggler in streaming mode")
parser.add_argument("--no-migration", action="store_true", help="Do not perform log migration")
parser.add_argument("--layout", nargs='?', help="Run PlotJuggler with a pre-defined layout")
parser.add_argument("--install", action="store_true", help="Install or update PlotJuggler + plugins")
parser.add_argument("--dbc", help="Set the DBC name to load for parsing CAN data. If not set, the DBC will be automatically inferred from the logs.")
Expand All @@ -131,4 +135,4 @@ def juggle_route(route_or_segment_name, can, layout, dbc=None):
start_juggler(layout=args.layout)
else:
route_or_segment_name = DEMO_ROUTE if args.demo else args.route_or_segment_name.strip()
juggle_route(route_or_segment_name, args.can, args.layout, args.dbc)
juggle_route(route_or_segment_name, args.can, args.layout, args.dbc, not args.no_migration)

0 comments on commit 032f368

Please sign in to comment.