juggle: add demo flag and improve README

pull/23058/head
Adeeb Shihadeh 2021-11-28 14:19:49 -08:00
parent 08f9316b56
commit 920b751888
2 changed files with 22 additions and 11 deletions

View File

@ -1,10 +1,12 @@
# PlotJuggler
We've extended [PlotJuggler](https://github.com/facontidavide/PlotJuggler) to plot all of your openpilot logs. Check out our plugins: https://github.com/commaai/PlotJuggler.
[PlotJuggler](https://github.com/facontidavide/PlotJuggler) is a tool to quickly visualize time series data, and we've written plugins to parse openpilot logs. Check out our plugins: https://github.com/commaai/PlotJuggler.
## Installation
Once you've cloned and are in openpilot, download PlotJuggler and install our plugins with this command:
**NOTE: this is Ubuntu only for now. Pull requests for macOS support are welcome.**
Once you've cloned and are in openpilot, this command will download PlotJuggler and install our plugins:
`cd tools/plotjuggler && ./install.sh`
@ -12,9 +14,9 @@ Once you've cloned and are in openpilot, download PlotJuggler and install our pl
```
$ ./juggle.py -h
usage: juggle.py [-h] [--qlog] [--can] [--stream] [--layout [LAYOUT]] [route_name] [segment_number] [segment_count]
usage: juggle.py [-h] [--demo] [--qlog] [--can] [--stream] [--layout [LAYOUT]] [route_name] [segment_number] [segment_count]
PlotJuggler plugin for reading openpilot logs
A helper to run PlotJuggler on openpilot routes
positional arguments:
route_name The route name to plot (cabana share URL accepted) (default: None)
@ -23,9 +25,10 @@ positional arguments:
optional arguments:
-h, --help show this help message and exit
--demo Use the demo route instead of providing one (default: False)
--qlog Use qlogs (default: False)
--can Parse CAN data (default: False)
--stream Start PlotJuggler without a route to stream data using Cereal (default: False)
--stream Start PlotJuggler in streaming mode (default: False)
--layout [LAYOUT] Run PlotJuggler with a pre-defined layout (default: None)
```
@ -47,11 +50,15 @@ If streaming to PlotJuggler from a replay on your PC, simply run: `./juggle.py -
For a quick demo, go through the installation step and run this command:
`./juggle.py "https://commadataci.blob.core.windows.net/openpilotci/d83f36766f8012a5/2020-02-05--18-42-21/0/rlog.bz2" --layout=layouts/demo.xml`
`./juggle.py --demo --qlog --layout=layouts/demo.xml`
## Tuning
## Layouts
Use this layout to generate plots for tuning PRs. Also see tuning wiki and tuning PR template.
If you create a layout that's useful for others, consider upstreaming it.
### Tuning
Use this layout to improve your car's tuning and generate plots for tuning PRs. Also see the tuning wiki and tuning PR template.
`--layout layouts/tuning.xml`

View File

@ -16,6 +16,8 @@ from urllib.parse import urlparse, parse_qs
juggle_dir = os.path.dirname(os.path.realpath(__file__))
DEMO_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36"
def load_segment(segment_name):
print(f"Loading {segment_name}")
if segment_name is None:
@ -94,12 +96,13 @@ def juggle_route(route_name, segment_number, segment_count, qlog, can, layout):
start_juggler(tempfile.name, dbc, layout)
def get_arg_parser():
parser = argparse.ArgumentParser(description="PlotJuggler plugin for reading openpilot logs",
parser = argparse.ArgumentParser(description="A helper to run PlotJuggler on openpilot routes",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--demo", action="store_true", help="Use the demo route instead of providing one")
parser.add_argument("--qlog", action="store_true", help="Use qlogs")
parser.add_argument("--can", action="store_true", help="Parse CAN data")
parser.add_argument("--stream", action="store_true", help="Start PlotJuggler without a route to stream data using Cereal")
parser.add_argument("--stream", action="store_true", help="Start PlotJuggler in streaming mode")
parser.add_argument("--layout", nargs='?', help="Run PlotJuggler with a pre-defined layout")
parser.add_argument("route_name", nargs='?', help="The route name to plot (cabana share URL accepted)")
parser.add_argument("segment_number", type=int, nargs='?', help="The index of the segment to plot")
@ -116,4 +119,5 @@ if __name__ == "__main__":
if args.stream:
start_juggler(layout=args.layout)
else:
juggle_route(args.route_name.strip(), args.segment_number, args.segment_count, args.qlog, args.can, args.layout)
route = DEMO_ROUTE if args.demo else args.route_name.strip()
juggle_route(route, args.segment_number, args.segment_count, args.qlog, args.can, args.layout)