PlotJuggler demo (#20172)
* initial demo with popup bug * demo fixes * demo fixes * Update tools/plotjuggler/juggle.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>pull/20175/head
parent
9144dd7c2f
commit
371272d94b
|
@ -13,18 +13,27 @@ Once you've cloned openpilot, run this command inside this directory:
|
|||
|
||||
```
|
||||
batman@z840-openpilot:~/openpilot/tools/plotjuggler$ ./juggle.py -h
|
||||
usage: juggle.py [-h] [route_name] [segment_number]
|
||||
usage: juggle.py [-h] [--qlog] [--layout [LAYOUT]] [route_name] [segment_number]
|
||||
|
||||
PlotJuggler plugin for reading rlogs
|
||||
|
||||
positional arguments:
|
||||
route_name The name of the route that will be plotted. (default: None)
|
||||
segment_number The index of the segment that will be plotted (default: None)
|
||||
route_name The name of the route that will be plotted. (default: None)
|
||||
segment_number The index of the segment that will be plotted (default: None)
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-h, --help show this help message and exit
|
||||
--qlog Use qlogs (default: False)
|
||||
--layout [LAYOUT] Run PlotJuggler with a pre-defined layout (default: None)
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
`./juggle.py "0982d79ebb0de295|2021-01-17--17-13-08"`
|
||||
|
||||
## Demo:
|
||||
|
||||
For a quick demo of what PlotJuggler can do, go through the installation step and use this command:
|
||||
|
||||
`./juggle.py "https://commadataci.blob.core.windows.net/openpilotci/d83f36766f8012a5/2020-02-05--18-42-21/0/rlog.bz2" --layout=demo_layout.xml`
|
||||
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<root version="2.3.8">
|
||||
<tabbed_widget parent="main_window" name="Main Window">
|
||||
<Tab tab_name="tab1" containers="1">
|
||||
<Container>
|
||||
<DockSplitter orientation="-" sizes="1" count="1">
|
||||
<DockSplitter orientation="|" sizes="0.5;0.5" count="2">
|
||||
<DockSplitter orientation="-" sizes="0.500497;0.499503" count="2">
|
||||
<DockArea name="...">
|
||||
<plot mode="TimeSeries" style="Lines">
|
||||
<range top="2.762667" bottom="-3.239397" right="56.512723" left="0.000000"/>
|
||||
<limitY/>
|
||||
<curve color="#1f77b4" name="/carState/aEgo"/>
|
||||
<curve color="#17becf" name="/carState/brake"/>
|
||||
</plot>
|
||||
</DockArea>
|
||||
<DockArea name="...">
|
||||
<plot mode="TimeSeries" style="Lines">
|
||||
<range top="5.191867" bottom="-5.724069" right="56.512723" left="0.000000"/>
|
||||
<limitY/>
|
||||
<curve color="#1ac938" name="dv/dt"/>
|
||||
</plot>
|
||||
</DockArea>
|
||||
</DockSplitter>
|
||||
<DockSplitter orientation="-" sizes="0.500497;0.499503" count="2">
|
||||
<DockArea name="...">
|
||||
<plot mode="TimeSeries" style="Lines">
|
||||
<range top="16.065524" bottom="-0.470076" right="56.512723" left="0.000000"/>
|
||||
<limitY/>
|
||||
<curve color="#d62728" name="/carState/vEgo"/>
|
||||
<curve color="#bcbd22" name="/carState/gas"/>
|
||||
</plot>
|
||||
</DockArea>
|
||||
<DockArea name="...">
|
||||
<plot mode="TimeSeries" style="Lines">
|
||||
<range top="1.014703" bottom="-0.012971" right="56.512723" left="0.000000"/>
|
||||
<limitY/>
|
||||
<curve color="#ff7f0e" name="/model/meta/brakeDisengageProb"/>
|
||||
<curve color="#f14cc1" name="/model/meta/engagedProb"/>
|
||||
<curve color="#9467bd" name="/model/meta/steerOverrideProb"/>
|
||||
</plot>
|
||||
</DockArea>
|
||||
</DockSplitter>
|
||||
</DockSplitter>
|
||||
</DockSplitter>
|
||||
</Container>
|
||||
</Tab>
|
||||
<currentTabIndex index="0"/>
|
||||
</tabbed_widget>
|
||||
<use_relative_time_offset enabled="1"/>
|
||||
<!-- - - - - - - - - - - - - - - -->
|
||||
<!-- - - - - - - - - - - - - - - -->
|
||||
<Plugins>
|
||||
<plugin ID="DataLoad CSV">
|
||||
<default time_axis=""/>
|
||||
</plugin>
|
||||
<plugin ID="DataLoad ROS bags">
|
||||
<use_header_stamp value="false"/>
|
||||
<use_renaming_rules value="true"/>
|
||||
<discard_large_arrays value="true"/>
|
||||
<max_array_size value="100"/>
|
||||
</plugin>
|
||||
<plugin ID="DataLoad Rlog"/>
|
||||
<plugin ID="DataLoad ULog"/>
|
||||
<plugin ID="LSL Subscriber"/>
|
||||
<plugin ID="MQTT Subscriber"/>
|
||||
<plugin ID="ROS Topic Subscriber">
|
||||
<use_header_stamp value="false"/>
|
||||
<use_renaming_rules value="true"/>
|
||||
<discard_large_arrays value="true"/>
|
||||
<max_array_size value="100"/>
|
||||
</plugin>
|
||||
<plugin ID="UDP Server"/>
|
||||
<plugin ID="WebSocket Server"/>
|
||||
<plugin ID="ZMQ Subscriber"/>
|
||||
<plugin status="idle" ID="ROS /rosout Visualization"/>
|
||||
<plugin status="idle" ID="ROS Topic Re-Publisher"/>
|
||||
</Plugins>
|
||||
<!-- - - - - - - - - - - - - - - -->
|
||||
<previouslyLoaded_Datafiles>
|
||||
<fileInfo filename="/home/batman/openpilot/tools/plotjuggler/tmps2q85e2d.rlog" prefix="">
|
||||
<selected_datasources value=""/>
|
||||
<plugin ID="DataLoad Rlog"/>
|
||||
</fileInfo>
|
||||
</previouslyLoaded_Datafiles>
|
||||
<!-- - - - - - - - - - - - - - - -->
|
||||
<customMathEquations>
|
||||
<snippet name="dv/dt">
|
||||
<global>prevX = 0
|
||||
prevY = 0
|
||||
is_first = true</global>
|
||||
<function>if (is_first) then
|
||||
is_first = false
|
||||
prevX = time
|
||||
prevY = value
|
||||
end
|
||||
|
||||
dx = time - prevX
|
||||
dy = value - prevY
|
||||
prevX = time
|
||||
prevY = value
|
||||
|
||||
return dy/dx</function>
|
||||
<linkedSource>/carState/vEgo</linkedSource>
|
||||
</snippet>
|
||||
</customMathEquations>
|
||||
<snippets/>
|
||||
<!-- - - - - - - - - - - - - - - -->
|
||||
</root>
|
||||
|
|
@ -24,7 +24,7 @@ def load_segment(segment_name):
|
|||
print(f"Error parsing {segment_name}: {e}")
|
||||
return []
|
||||
|
||||
def juggle_file(fn, dbc=None):
|
||||
def juggle_file(fn, dbc=None, layout=None):
|
||||
env = os.environ.copy()
|
||||
env["BASEDIR"] = BASEDIR
|
||||
|
||||
|
@ -32,9 +32,12 @@ def juggle_file(fn, dbc=None):
|
|||
env["DBC_NAME"] = dbc
|
||||
|
||||
pj = os.getenv("PLOTJUGGLER_PATH", "plotjuggler")
|
||||
subprocess.call(f'{pj} --plugin_folders {os.path.join(juggle_dir, "bin")} -d {fn}', shell=True, env=env, cwd=juggle_dir)
|
||||
extra_args = ""
|
||||
if layout is not None:
|
||||
extra_args += f'-l {layout}'
|
||||
subprocess.call(f'{pj} --plugin_folders {os.path.join(juggle_dir, "bin")} -d {fn} {extra_args}', shell=True, env=env, cwd=juggle_dir)
|
||||
|
||||
def juggle_route(route_name, segment_number, qlog):
|
||||
def juggle_route(route_name, segment_number, qlog, layout):
|
||||
|
||||
if route_name.startswith("http://") or route_name.startswith("https://"):
|
||||
logs = [route_name]
|
||||
|
@ -74,13 +77,14 @@ def juggle_route(route_name, segment_number, qlog):
|
|||
save_log(tempfile.name, all_data, compress=False)
|
||||
del all_data
|
||||
|
||||
juggle_file(tempfile.name, dbc)
|
||||
juggle_file(tempfile.name, dbc, layout)
|
||||
|
||||
def get_arg_parser():
|
||||
parser = argparse.ArgumentParser(description="PlotJuggler plugin for reading rlogs",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
|
||||
parser.add_argument("--qlog", action="store_true", help="Use qlogs")
|
||||
parser.add_argument("--layout", nargs='?', help="Run PlotJuggler with a pre-defined layout")
|
||||
parser.add_argument("route_name", nargs='?', help="The name of the route that will be plotted.")
|
||||
parser.add_argument("segment_number", type=int, nargs='?', help="The index of the segment that will be plotted")
|
||||
return parser
|
||||
|
@ -91,4 +95,4 @@ if __name__ == "__main__":
|
|||
arg_parser.print_help()
|
||||
sys.exit()
|
||||
args = arg_parser.parse_args(sys.argv[1:])
|
||||
juggle_route(args.route_name, args.segment_number, args.qlog)
|
||||
juggle_route(args.route_name, args.segment_number, args.qlog, args.layout)
|
||||
|
|
Loading…
Reference in New Issue