PlotJuggler: Tuning layout (#22902)

* PlotJuggler layout for lateral and longitudinal tuning

* update README and tuning PR template
body
qadmus 2021-11-13 23:16:42 -08:00 committed by GitHub
parent 8659c47df9
commit 65d1b51476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 304 additions and 10 deletions

View File

@ -8,15 +8,16 @@ assignees: ''
**Description**
<!-- A description of what is wrong with the current tuning and how the PR adresses this. -->
<!-- A description of what is wrong with the current tuning and how the PR addresses this. -->
**Verification**
<!-- To verify a longitudinal tuning PRs we need the plotjuggler plots of several scenarios of the desired speed/accel (first value from longitudinalPlan message)
vs measured speed/accel (from carState message), we need these plots for before and after the changes in the PR. For lateral tuning PRs we need plots of the
desired steeringAngle vs actual steeringAngle. These scenarios don't need to be exactly followed, but do need to be broadly captured.
<!-- To verify tuning, capture the following scenarios (broadly, not exactly), with current tune and this tune.
Use the PlotJuggler tuning layout to compare planned versus actual behavior.
For longitudinal we need plots of before and after for all of the following scenarios:
Run ./juggle.py <route> --layout layouts/tuning.xml , screenshot the full tab of interest, and paste into this PR.
Longitudinal:
* Maintaining speed at 25, 40, 65mph
* Driving up and down hills
* Accelerating from a stop
@ -24,10 +25,8 @@ For longitudinal we need plots of before and after for all of the following scen
* Following large changes in set speed
* Coming to a stop behind a lead car
For lateral we need plots of before and after for all of the following scenarios:
Lateral:
* Straight driving at ~25, ~45 and ~65mph
* Turns driving at ~25, ~45 and ~65mph
-->

View File

@ -47,7 +47,13 @@ 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=demo_layout.xml`
`./juggle.py "https://commadataci.blob.core.windows.net/openpilotci/d83f36766f8012a5/2020-02-05--18-42-21/0/rlog.bz2" --layout=layouts/demo.xml`
## Tuning
Use this layout to generate plots for tuning PRs. Also see tuning wiki and tuning PR template.
`--layout layouts/tuning.xml`
![screenshot](https://i.imgur.com/cizHCH3.png)

View File

@ -114,6 +114,6 @@ if __name__ == "__main__":
args = arg_parser.parse_args(sys.argv[1:])
if args.stream:
start_juggler()
start_juggler(layout=args.layout)
else:
juggle_route(args.route_name, args.segment_number, args.segment_count, args.qlog, args.can, args.layout)

View File

@ -0,0 +1,289 @@
<?xml version='1.0' encoding='UTF-8'?>
<root version="2.3.8">
<tabbed_widget name="Main Window" parent="main_window">
<Tab tab_name="Lateral" containers="1">
<Container>
<DockSplitter sizes="0.2;0.2;0.2;0.2;0.2" orientation="-" count="5">
<DockArea name="Velocity [m/s]">
<plot style="Lines" mode="TimeSeries">
<range bottom="23.655731" right="299.969780" top="31.072848" left="0.024389"/>
<limitY/>
<curve name="/carState/vEgo" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Curvature [1/m] True [blue] Vehicle Model [purple] Plan [green]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.001618" right="299.969780" top="0.001706" left="0.024389"/>
<limitY/>
<curve name="engaged curvature plan" color="#009e73"/>
<curve name="engaged curvature vehicle model" color="#785ef0"/>
<curve name="engaged curvature yaw" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Roll [rad]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.086784" right="299.969780" top="0.007461" left="0.024389"/>
<limitY/>
<curve name="/liveLocationKalman/calibratedOrientationNED/value/0" color="#ffb000"/>
</plot>
</DockArea>
<DockArea name="Engaged [green] Steering Pressed [blue]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.025000" right="299.969780" top="1.025000" left="0.024389"/>
<limitY/>
<curve name="/controlsState/enabled" color="#009e73"/>
<curve name="/carState/steeringPressed" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Steering Limited: Rate [orange] Saturated [magenta]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.025000" right="299.969780" top="1.025000" left="0.024389"/>
<limitY/>
<curve name="/carState/steeringRateLimited" color="#ffb000"/>
<curve name="/controlsState/lateralControlState/pidState/saturated" color="#dc267f"/>
</plot>
</DockArea>
</DockSplitter>
</Container>
</Tab>
<Tab tab_name="Longitudinal" containers="1">
<Container>
<DockSplitter sizes="0.2;0.2;0.2;0.2;0.2" orientation="-" count="5">
<DockArea name="Velocity [m/s] True [blue] Plan [green]">
<plot style="Lines" mode="TimeSeries">
<range bottom="23.655731" right="299.969780" top="31.072848" left="0.024389"/>
<limitY/>
<curve name="/longitudinalPlan/speeds/0" color="#009e73"/>
<curve name="/carState/vEgo" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Acceleration [m/s^2] True [blue] Actuator [purple] Plan [green]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.832626" right="299.969780" top="1.070051" left="0.024389"/>
<limitY/>
<curve name="engaged_accel_plan" color="#009e73"/>
<curve name="engaged_accel_actuator" color="#785ef0"/>
<curve name="engaged_accel_actual" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Pitch [rad]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.073326" right="299.969780" top="0.008998" left="0.024389"/>
<limitY/>
<curve name="/liveLocationKalman/calibratedOrientationNED/value/1" color="#ffb000"/>
</plot>
</DockArea>
<DockArea name="Engaged [green] Gas [orange] Brake [magenta]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.025000" right="299.969780" top="1.025000" left="0.024389"/>
<limitY/>
<curve name="/carControl/active" color="#009e73"/>
<curve name="/carState/gasPressed" color="#ffb000"/>
<curve name="/carState/brakePressed" color="#dc267f"/>
</plot>
</DockArea>
<DockArea name="State [blue: off,pid,stop,start] Source [green: cruise,lead0,lead1,lead2,e2e]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.050000" right="299.969780" top="2.050000" left="0.024389"/>
<limitY/>
<curve name="/carControl/actuators/longControlState" color="#0072b2"/>
<curve name="/longitudinalPlan/longitudinalPlanSource" color="#009e73"/>
</plot>
</DockArea>
</DockSplitter>
</Container>
</Tab>
<Tab tab_name="Lateral Debug" containers="1">
<Container>
<DockSplitter sizes="0.250564;0.249436;0.250564;0.249436" orientation="-" count="4">
<DockArea name="Controller F [magenta] P [purple] I [blue]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.564869" right="299.969780" top="0.506951" left="0.024389"/>
<limitY/>
<curve name="/controlsState/lateralControlState/pidState/f" color="#f14cc1"/>
<curve name="/controlsState/lateralControlState/pidState/p" color="#9467bd"/>
<curve name="/controlsState/lateralControlState/pidState/i" color="#17becf"/>
</plot>
</DockArea>
<DockArea name="Driver Torque [blue] EPS Torque [green]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-216.025000" right="299.969780" top="205.025000" left="0.024389"/>
<limitY/>
<curve name="/carState/steeringTorqueEps" color="#009e73"/>
<curve name="/carState/steeringTorque" color="#0072b2"/>
</plot>
</DockArea>
<DockArea name="Engaged [green] Steering Pressed [blue]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.025000" right="299.969780" top="1.025000" left="0.024389"/>
<limitY/>
<curve name="/carState/steeringPressed" color="#0072b2"/>
<curve name="/carControl/active" color="#009e73"/>
</plot>
</DockArea>
<DockArea name="Steering Limited: Rate [orange] Saturated [magenta]">
<plot style="Lines" mode="TimeSeries">
<range bottom="-0.025000" right="299.969780" top="1.025000" left="0.024389"/>
<limitY/>
<curve name="/carState/steeringRateLimited" color="#ffb000"/>
<curve name="/controlsState/lateralControlState/pidState/saturated" color="#dc267f"/>
</plot>
</DockArea>
</DockSplitter>
</Container>
</Tab>t
<currentTabIndex index="0"/>
</tabbed_widget>
<use_relative_time_offset enabled="1"/>
<!-- - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - -->
<Plugins>
<plugin ID="DataLoad Rlog"/>
<plugin ID="Cereal Subscriber"/>
</Plugins>
<!-- - - - - - - - - - - - - - - -->
<customMathEquations>
<snippet name="engaged_accel_actuator">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>accel = value
brake = v1
gas = v2
active = v3
if (brake ~= 0 or gas ~= 0 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return value
else
return 0
end</function>
<linkedSource>/carControl/actuators/accel</linkedSource>
<additionalSources>
<v1>/carState/brakePressed</v1>
<v2>/carState/gasPressed</v2>
<v3>/carControl/active</v3>
</additionalSources>
</snippet>
<snippet name="engaged_accel_plan">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>accel = value
brake = v1
gas = v2
active = v3
if (brake ~= 0 or gas ~= 0 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return value
else
return 0
end</function>
<linkedSource>/longitudinalPlan/accels/0</linkedSource>
<additionalSources>
<v1>/carState/brakePressed</v1>
<v2>/carState/gasPressed</v2>
<v3>/carControl/active</v3>
</additionalSources>
</snippet>
<snippet name="engaged_accel_actual">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>accel = value
brake = v1
gas = v2
active = v3
if (brake ~= 0 or gas ~= 0 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return value
else
return 0
end</function>
<linkedSource>/carState/aEgo</linkedSource>
<additionalSources>
<v1>/carState/brakePressed</v1>
<v2>/carState/gasPressed</v2>
<v3>/carControl/active</v3>
</additionalSources>
</snippet>
<snippet name="engaged curvature plan">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>curvature = value
pressed = v1
active = v2
if (pressed == 1 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return value
else
return 0
end</function>
<linkedSource>/lateralPlan/curvatures/0</linkedSource>
<additionalSources>
<v1>/carState/steeringPressed</v1>
<v2>/carControl/active</v2>
</additionalSources>
</snippet>
<snippet name="engaged curvature vehicle model">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>curvature = value
pressed = v1
active = v2
if (pressed == 1 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return value
else
return 0
end</function>
<linkedSource>/controlsState/curvature</linkedSource>
<additionalSources>
<v1>/carState/steeringPressed</v1>
<v2>/controlsState/active</v2>
</additionalSources>
</snippet>
<snippet name="engaged curvature yaw">
<global>engage_delay = 5
last_bad_time = -engage_delay</global>
<function>curvature = value / v3
pressed = v1
active = v2
if (pressed == 1 or active == 0) then
last_bad_time = time
end
if (time > last_bad_time + engage_delay) then
return curvature
else
return 0
end</function>
<linkedSource>/liveLocationKalman/angularVelocityCalibrated/value/2</linkedSource>
<additionalSources>
<v1>/carState/steeringPressed</v1>
<v2>/carControl/active</v2>
<v3>/carState/vEgo</v3>
</additionalSources>
</snippet>
</customMathEquations>
<snippets/>
<!-- - - - - - - - - - - - - - - -->
</root>