<!DOCTYPE html> | |
<html class="writer-html5" lang="en" > | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>EndToEnd Test Framework — OpenPASS Documentation</title> | |
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> | |
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> | |
<link rel="stylesheet" href="../_static/tabs.css" type="text/css" /> | |
<link rel="stylesheet" href="../_static/css/custom.css" type="text/css" /> | |
<link rel="shortcut icon" href="../_static/openPASS.ico"/> | |
<!--[if lt IE 9]> | |
<script src="../_static/js/html5shiv.min.js"></script> | |
<![endif]--> | |
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> | |
<script src="../_static/jquery.js"></script> | |
<script src="../_static/underscore.js"></script> | |
<script src="../_static/doctools.js"></script> | |
<script type="text/javascript" src="../_static/js/theme.js"></script> | |
<link rel="index" title="Index" href="../genindex.html" /> | |
<link rel="search" title="Search" href="../search.html" /> | |
<link rel="next" title="IDE Support" href="../developer_information/10_ide_support.html" /> | |
<link rel="prev" title="World_OSI" href="simulator/world_osi.html" /> | |
</head> | |
<body class="wy-body-for-nav"> | |
<div class="wy-grid-for-nav"> | |
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | |
<div class="wy-side-scroll"> | |
<div class="wy-side-nav-search" > | |
<a href="../index.html" class="icon icon-home"> openPASS | |
<img src="../_static/openPASS.png" class="logo" alt="Logo"/> | |
</a> | |
<div class="version"> | |
0.8.0 | |
</div> | |
<div role="search"> | |
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> | |
<input type="text" name="q" placeholder="Search docs" /> | |
<input type="hidden" name="check_keywords" value="yes" /> | |
<input type="hidden" name="area" value="default" /> | |
</form> | |
</div> | |
</div> | |
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> | |
<p class="caption"><span class="caption-text">Installation Guide</span></p> | |
<ul> | |
<li class="toctree-l1"><a class="reference internal" href="../installation_guide/10_getting_started.html">Getting Started</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../installation_guide/20_install_prerequisites.html">Installing Prerequisites</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../installation_guide/30_install_openpass.html">Installing OpenPASS</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../installation_guide/50_further_guidance.html">Further Guidance</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../installation_guide/60_conan.html">Building with Conan</a></li> | |
</ul> | |
<p class="caption"><span class="caption-text">User Guides</span></p> | |
<ul> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/10_overview.html">Overview</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/20_tutorials.html">Tutorials</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/30_gui_plugins.html">GUI Plugins</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/40_configs_in_depth.html">Configs in Depth</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/50_outputs_in_depth.html">Outputs in Depth</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../user_guide/60_scenario_simulation.html">Simulator</a></li> | |
</ul> | |
<p class="caption"><span class="caption-text">Advanced topics</span></p> | |
<ul class="current"> | |
<li class="toctree-l1"><a class="reference internal" href="20_simulator_advanced.html">Simulator</a></li> | |
<li class="toctree-l1 current"><a class="current reference internal" href="#">EndToEnd Test Framework</a><ul> | |
<li class="toctree-l2"><a class="reference internal" href="#prerequisites">Prerequisites</a></li> | |
<li class="toctree-l2"><a class="reference internal" href="#execution">Execution</a></li> | |
<li class="toctree-l2"><a class="reference internal" href="#configuration">Configuration</a><ul> | |
<li class="toctree-l3"><a class="reference internal" href="#basic-tests">Basic Tests</a></li> | |
<li class="toctree-l3"><a class="reference internal" href="#parameterized-tests">Parameterized Tests</a></li> | |
<li class="toctree-l3"><a class="reference internal" href="#specialized-tests">Specialized Tests</a></li> | |
</ul> | |
</li> | |
<li class="toctree-l2"><a class="reference internal" href="#querying-results">Querying Results</a><ul> | |
<li class="toctree-l3"><a class="reference internal" href="#basic-syntax">Basic Syntax</a></li> | |
<li class="toctree-l3"><a class="reference internal" href="#using-events-in-filter">Using Events in Filter</a><ul> | |
<li class="toctree-l4"><a class="reference internal" href="#event-payload">Event Payload</a></li> | |
<li class="toctree-l4"><a class="reference internal" href="#query-example">Query Example</a></li> | |
</ul> | |
</li> | |
<li class="toctree-l3"><a class="reference internal" href="#using-openscenario-events">Using openSCENARIO Events</a></li> | |
<li class="toctree-l3"><a class="reference internal" href="#querying-transitions">Querying Transitions</a></li> | |
<li class="toctree-l3"><a class="reference internal" href="#explicit-datatypes">Explicit Datatypes</a></li> | |
</ul> | |
</li> | |
<li class="toctree-l2"><a class="reference internal" href="#test-report-generator">Test Report Generator</a></li> | |
</ul> | |
</li> | |
</ul> | |
<p class="caption"><span class="caption-text">Developer Information</span></p> | |
<ul> | |
<li class="toctree-l1"><a class="reference internal" href="../developer_information/10_ide_support.html">IDE Support</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../developer_information/20_documentation.html">Documentation Concept</a></li> | |
</ul> | |
<p class="caption"><span class="caption-text">Other Information</span></p> | |
<ul> | |
<li class="toctree-l1"><a class="reference internal" href="../other_information/10_external_dependencies.html">External Dependencies</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../other_information/20_glossary.html">Glossary</a></li> | |
<li class="toctree-l1"><a class="reference internal" href="../other_information/30_license.html">License</a></li> | |
</ul> | |
</div> | |
</div> | |
</nav> | |
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | |
<nav class="wy-nav-top" aria-label="top navigation"> | |
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | |
<a href="../index.html">openPASS</a> | |
</nav> | |
<div class="wy-nav-content"> | |
<div class="rst-content"> | |
<div role="navigation" aria-label="breadcrumbs navigation"> | |
<ul class="wy-breadcrumbs"> | |
<li><a href="../index.html" class="icon icon-home"></a> »</li> | |
<li>EndToEnd Test Framework</li> | |
<li class="wy-breadcrumbs-aside"> | |
<a href="../_sources/advanced_topics/30_testing.rst.txt" rel="nofollow"> View page source</a> | |
</li> | |
</ul> | |
<hr/> | |
</div> | |
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | |
<div itemprop="articleBody"> | |
<div class="section" id="endtoend-test-framework"> | |
<span id="testing-endtoend"></span><h1>EndToEnd Test Framework<a class="headerlink" href="#endtoend-test-framework" title="Permalink to this headline">¶</a></h1> | |
<p><strong>pyOpenPASS</strong></p> | |
<p>This tool acts as configurable executor for complete sets of configs for the openPASS simulation. | |
The test framework is located at <code class="docutils literal notranslate"><span class="pre">sim/tests/endToEndTests/pyOpenPASS</span></code>.</p> | |
<div class="section" id="prerequisites"> | |
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2> | |
<p>Please refer to <a class="reference internal" href="../installation_guide/20_install_prerequisites.html#binary-packages"><span class="std std-ref">Installing the Binary Packages</span></a> for instructions on installing the prerequisites.</p> | |
</div> | |
<div class="section" id="execution"> | |
<h2>Execution<a class="headerlink" href="#execution" title="Permalink to this headline">¶</a></h2> | |
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>main.py | |
-s SIMULATION <span class="c1"># path to simulation executable, e.g. /openPASS/bin</span> | |
-m MUTUAL_RESOURCES_PATH <span class="c1"># path to mutual config files for all runs, e.g. /examples/common</span> | |
-r RESOURCES_PATH <span class="c1"># path from where configs are retrieved (override common files if necessary)</span> | |
-c PYOPENPASS_CONFIG.JSON <span class="c1"># JSON config for pyOpenPASS</span> | |
--scope SCOPE_IN_PYOPENPASS_CONFIG <span class="c1"># A user defined scope in the config (such as fast, nightly, ...)</span> | |
-d <span class="c1"># Debug some pandas dataframes as csv to /tmp or C:\temp</span> | |
</pre></div> | |
</div> | |
</div> | |
<div class="section" id="configuration"> | |
<h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2> | |
<ul class="simple"> | |
<li><p>Basic tests: Check executability of configs + Determinism test (<em>1 x n</em> vs <em>n x 1</em> tests).</p></li> | |
<li><p>Specialized tests: Execute config and check for specific results in the output of the simulator.</p></li> | |
</ul> | |
<div class="section" id="basic-tests"> | |
<h3>Basic Tests<a class="headerlink" href="#basic-tests" title="Permalink to this headline">¶</a></h3> | |
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> | |
<span class="nt">"scopes"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"THE_SCOPE"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"baseConfig"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"duration"</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span> | |
<span class="nt">"randomSeed"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> | |
<span class="nt">"invocations"</span><span class="p">:</span> <span class="mi">100</span> | |
<span class="p">},</span> | |
<span class="nt">"configurations"</span><span class="p">:</span> | |
<span class="p">[</span> | |
<span class="s2">"CONFIG_UNDER_TEST1"</span><span class="p">,</span> | |
<span class="s2">"CONFIG_UNDER_TEST2"</span> | |
<span class="p">]</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
</pre></div> | |
</div> | |
<div class="admonition note"> | |
<p class="admonition-title">Note</p> | |
<p>RandomSeed is an optional value. | |
If set, it will override the value given with the configuration.</p> | |
</div> | |
</div> | |
<div class="section" id="parameterized-tests"> | |
<h3>Parameterized Tests<a class="headerlink" href="#parameterized-tests" title="Permalink to this headline">¶</a></h3> | |
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> | |
<span class="nt">"scopes"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"THE_SCOPE"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"baseConfig"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"duration"</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span> | |
<span class="nt">"randomSeed"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> | |
<span class="nt">"invocations"</span><span class="p">:</span> <span class="mi">100</span> | |
<span class="p">},</span> | |
<span class="nt">"parameterization"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"file"</span><span class="p">:</span> <span class="s2">"someConfigFile.xml"</span><span class="p">,</span> | |
<span class="nt">"xpath"</span><span class="p">:</span> <span class="s2">"//some/value"</span><span class="p">,</span> | |
<span class="nt">"values"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"value1"</span><span class="p">,</span> <span class="s2">"value2"</span><span class="p">,</span> <span class="s2">"value3"</span><span class="p">]</span> | |
<span class="p">},</span> | |
<span class="nt">"configurations"</span><span class="p">:</span> | |
<span class="p">[</span> | |
<span class="s2">"CONFIG_UNDER_TEST1"</span><span class="p">,</span> | |
<span class="s2">"CONFIG_UNDER_TEST2"</span> | |
<span class="p">]</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
</pre></div> | |
</div> | |
<p>If parameterization specified, the generic tests are executed for each config and each parameter value. | |
The value is injected into a single configuration file, specified via its filename and an valid xpath. | |
As values might be contain paths to resources, the variable <code class="docutils literal notranslate"><span class="pre">${configFolder}</span></code> can be used as dynamic placeholder.</p> | |
<p><strong>Example</strong></p> | |
<p>With the core being at <code class="docutils literal notranslate"><span class="pre">/OpenPASS/bin</span></code> the scope <code class="docutils literal notranslate"><span class="pre">FMU_Test</span></code> shall be executed using two different FMUs:</p> | |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s2">"values"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"$</span><span class="si">{configFolder}</span><span class="s2">/resources/FMUv1.fmu"</span><span class="p">,</span><span class="s2">"$</span><span class="si">{configFolder}</span><span class="s2">/resources/FMUv2.fmu"</span> <span class="p">]</span> | |
</pre></div> | |
</div> | |
<p>For each parameter, a different config folder <code class="docutils literal notranslate"><span class="pre">configs/FMU_Test_#</span></code> is created, where <code class="docutils literal notranslate"><span class="pre">#</span></code> is the parameters index. | |
Before execution, the value of the first parameter <code class="docutils literal notranslate"><span class="pre">${configFolder}/resources/FMUv1.fmu</span></code> is replaced with the absolute path <code class="docutils literal notranslate"><span class="pre">/OpenPASS/bin/configs/FMU_Test_0/resources/FMUv1</span></code>.</p> | |
</div> | |
<div class="section" id="specialized-tests"> | |
<h3>Specialized Tests<a class="headerlink" href="#specialized-tests" title="Permalink to this headline">¶</a></h3> | |
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> | |
<span class="nt">"scopes"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"THE_SCOPE"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"baseConfig"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"duration"</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> | |
<span class="nt">"randomSeed"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> | |
<span class="nt">"invocations"</span><span class="p">:</span> <span class="mi">100</span> | |
<span class="p">},</span> | |
<span class="nt">"specialized"</span><span class="p">:</span> | |
<span class="p">{</span> | |
<span class="nt">"description"</span><span class="p">:</span> <span class="s2">"A CONCISE DESCRIPTION OF THE SCOPE"</span><span class="p">,</span> | |
<span class="nt">"query"</span><span class="p">:</span> <span class="s2">"A VALID QUERY STRING (SEE BELOW)"</span><span class="p">,</span> | |
<span class="nt">"success_rate"</span><span class="p">:</span> <span class="mf">0.9</span> | |
<span class="p">},</span> | |
<span class="nt">"configurations"</span><span class="p">:</span> | |
<span class="p">[</span> | |
<span class="s2">"CONFIG_UNDER_TEST1"</span><span class="p">,</span> | |
<span class="s2">"CONFIG_UNDER_TEST2"</span> | |
<span class="p">]</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
<span class="p">}</span> | |
</pre></div> | |
</div> | |
<p>Note that <code class="docutils literal notranslate"><span class="pre">description</span></code> is an optional value, which is currently not used by the framework, but helps to remember, what the test is about. | |
It is strongly advised to set it, as it might be used in future releases.</p> | |
</div> | |
</div> | |
<div class="section" id="querying-results"> | |
<h2>Querying Results<a class="headerlink" href="#querying-results" title="Permalink to this headline">¶</a></h2> | |
<p>Specialized Tests allow to define a query for checking the results of a simulation.</p> | |
<div class="section" id="basic-syntax"> | |
<h3>Basic Syntax<a class="headerlink" href="#basic-syntax" title="Permalink to this headline">¶</a></h3> | |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">aggregate</span><span class="p">]([</span><span class="n">column</span><span class="p">]</span> <span class="o">|</span> <span class="p">[</span><span class="nb">filter</span><span class="p">])</span> <span class="p">[</span><span class="n">operator</span><span class="p">]</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> | |
</pre></div> | |
</div> | |
<ul class="simple"> | |
<li><p>Aggregate: | |
Everything pandas supports on dataframes, such as <a class="reference external" href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.count.html?highlight=count#pandas.DataFrame.count">pandas.DataFrame.count</a>, min, max, mean</p></li> | |
<li><p>Column: | |
A column on which the aggregate should operate. | |
Columns are given by the simulation outputs cyclic columns, such as <code class="docutils literal notranslate"><span class="pre">PositionRoute</span></code>. | |
Additionally <code class="docutils literal notranslate"><span class="pre">AgentId</span></code> is made available.</p></li> | |
<li><p>Filter: | |
A filter based on <a class="reference external" href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html?highlight=filter#pandas.DataFrame.filter">pandas.DataFrame.filter</a> syntax using the available columns.</p></li> | |
<li><p>Operator: | |
A comparison operator from the following list: ==, <=, >=, <, >, !=, ~= (approximate). | |
The approximate operator allows <code class="docutils literal notranslate"><span class="pre">1*e-6</span> <span class="pre">x</span> <span class="pre">value</span></code> as maximum deviation from value.</p></li> | |
<li><p>Value: | |
A number</p></li> | |
</ul> | |
<p><strong>Example</strong></p> | |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">count</span><span class="p">(</span><span class="n">AgentId</span> <span class="o">|</span> <span class="n">PositionRoute</span> <span class="o">>=</span> <span class="mi">800</span> <span class="ow">and</span> <span class="n">Lane</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">3</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> | |
</pre></div> | |
</div> | |
</div> | |
<div class="section" id="using-events-in-filter"> | |
<h3>Using Events in Filter<a class="headerlink" href="#using-events-in-filter" title="Permalink to this headline">¶</a></h3> | |
<p>In order to query for a specific event, use <code class="docutils literal notranslate"><span class="pre">#(EVENT)</span></code> within the filter syntax.</p> | |
<p><strong>Example</strong></p> | |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">count</span><span class="p">(</span><span class="n">AgentId</span> <span class="o">|</span> <span class="n">PositionRoute</span> <span class="o">>=</span> <span class="mi">800</span> <span class="ow">and</span> <span class="c1">#(Collision) == True) == 0</span> | |
</pre></div> | |
</div> | |
<div class="section" id="event-payload"> | |
<h4>Event Payload<a class="headerlink" href="#event-payload" title="Permalink to this headline">¶</a></h4> | |
<p>Each event is associated with a set of triggering entity ids, affected entity ids, and arbitrary key/value pairs (please refer to the openPASS documentation for details). | |
This information is transformed into a “per agent” scope.</p> | |
<p>In the following the <code class="docutils literal notranslate"><span class="pre">Collision</span></code> event is taken as example.</p> | |
<p><strong>TriggeringEntity</strong></p> | |
<p>All agents, flagged as triggering become <code class="docutils literal notranslate"><span class="pre">IsTriggering</span></code></p> | |
<p>Query: <code class="docutils literal notranslate"><span class="pre">#(Collision):IsTriggering</span> <span class="pre">==</span> <span class="pre">True</span></code></p> | |
<p><strong>AffectedEntity</strong></p> | |
<p>All agents, flagged as affected become <code class="docutils literal notranslate"><span class="pre">IsAffected</span></code></p> | |
<p>Query: <code class="docutils literal notranslate"><span class="pre">#(Collision):IsAffected</span> <span class="pre">==</span> <span class="pre">True</span></code></p> | |
<p><strong>Key/Value Pairs</strong></p> | |
<p>If an event publishes additional payload with the key <code class="docutils literal notranslate"><span class="pre">XYZ</span></code>, it will can be queried by <code class="docutils literal notranslate"><span class="pre">#(EVENT):XYZ</span></code>.</p> | |
<p>Query: <code class="docutils literal notranslate"><span class="pre">#(Collision):WithAgent</span></code></p> | |
<div class="admonition warning"> | |
<p class="admonition-title">Warning</p> | |
<p>Keys carrying the event name as prefix, such as in <code class="docutils literal notranslate"><span class="pre">#(Collision):CollisionWithAgent</span></code>, will be stripped to <code class="docutils literal notranslate"><span class="pre">Collision:WithAgent</span></code></p> | |
</div> | |
</div> | |
<div class="section" id="query-example"> | |
<h4>Query Example<a class="headerlink" href="#query-example" title="Permalink to this headline">¶</a></h4> | |
<div class="line-block"> | |
<div class="line"><em>No agent should collide with agent 0:</em></div> | |
<div class="line"><code class="docutils literal notranslate"><span class="pre">count(AgentId</span> <span class="pre">|</span> <span class="pre">AgentId</span> <span class="pre">==</span> <span class="pre">0</span> <span class="pre">and</span> <span class="pre">#(Collision):WithAgent</span> <span class="pre">==</span> <span class="pre">1)</span> <span class="pre">==</span> <span class="pre">0</span></code></div> | |
</div> | |
</div> | |
</div> | |
<div class="section" id="using-openscenario-events"> | |
<h3>Using openSCENARIO Events<a class="headerlink" href="#using-openscenario-events" title="Permalink to this headline">¶</a></h3> | |
<p>OpenScenario events are processed in the same manner as regular events (see above).</p> | |
<p>This allows to query for occurrences of openSCENARIO events with a name specified within the following xpath: | |
<code class="docutils literal notranslate"><span class="pre">OpenSCENARIO/Story/Act/Sequence/Maneuver/Event/@name</span></code></p> | |
<p><strong>openSCENARIO Event Definition</strong></p> | |
<div class="highlight-xml notranslate"><div class="highlight"><pre><span></span><span class="nt"><Story</span> <span class="na">name=</span><span class="s">"TheStory"</span><span class="nt">></span> | |
<span class="nt"><Act</span> <span class="na">name=</span><span class="s">"TheAct"</span><span class="nt">></span> | |
<span class="nt"><Sequence</span> <span class="na">name=</span><span class="s">"TheSequence"</span> <span class="na">numberOfExecutions=</span><span class="s">"1"</span><span class="nt">></span> | |
... | |
<span class="nt"><Maneuver</span> <span class="na">name=</span><span class="s">"TheManeuver"</span><span class="nt">></span> | |
... | |
<span class="c"><!-- example name "ttc_event"--></span> | |
<span class="nt"><Event</span> <span class="na">name=</span><span class="s">"ttc_event"</span> <span class="na">priority=</span><span class="s">"overwrite"</span><span class="nt">></span> | |
... | |
<span class="nt"><StartConditions></span> | |
<span class="nt"><ConditionGroup></span> | |
<span class="nt"><Condition</span> <span class="na">name=</span><span class="s">"Conditional"</span><span class="nt">></span> | |
<span class="nt"><ByEntity></span> | |
... | |
<span class="nt"><EntityCondition></span> | |
<span class="nt"><TimeToCollision></span> | |
... | |
<span class="nt"></TimeToCollision></span> | |
<span class="nt"></EntityCondition></span> | |
<span class="nt"></ByEntity></span> | |
<span class="nt"></Condition></span> | |
<span class="nt"></ConditionGroup></span> | |
<span class="nt"></StartConditions></span> | |
<span class="nt"></Event></span> | |
... | |
<span class="nt"></Maneuver></span> | |
<span class="nt"></Sequence></span> | |
<span class="nt"></Act></span> | |
<span class="nt"></Story></span> | |
</pre></div> | |
</div> | |
<p><strong>Example openPASS Output</strong></p> | |
<div class="highlight-xml notranslate"><div class="highlight"><pre><span></span><span class="nt"><Event</span> <span class="na">Time=</span><span class="s">"0"</span> <span class="na">Source=</span><span class="s">"OpenSCENARIO"</span> <span class="na">Name=</span><span class="s">"TheStory/TheAct/TheSequence/TheManeuver/ttc_event"</span><span class="nt">></span> | |
<span class="nt"><TriggeringEntities/></span> | |
<span class="nt"><AffectedEntities></span> | |
<span class="nt"><Entity</span> <span class="na">Id=</span><span class="s">"1"</span><span class="nt">/></span> | |
<span class="nt"></AffectedEntities></span> | |
<span class="nt"><Parameters/></span> | |
<span class="nt"></Event></span> | |
</pre></div> | |
</div> | |
<p><strong>Query</strong></p> | |
<p><code class="docutils literal notranslate"><span class="pre">count(AgentId</span> <span class="pre">|</span> <span class="pre">#(TheStory/TheAct/TheSequence/TheManeuver/ttc_event)</span> <span class="pre">==</span> <span class="pre">True</span> <span class="pre">)</span> <span class="pre">></span> <span class="pre">0</span></code></p> | |
</div> | |
<div class="section" id="querying-transitions"> | |
<h3>Querying Transitions<a class="headerlink" href="#querying-transitions" title="Permalink to this headline">¶</a></h3> | |
<p>Sometimes it is necessary to check, whether a transition happened, such as counting agents, passing a certain position.</p> | |
<p>This can be achieved by shifting individual columns by <code class="docutils literal notranslate"><span class="pre">N</span></code> time steps.</p> | |
<p><strong>Time Shift Syntax</strong></p> | |
<p><code class="docutils literal notranslate"><span class="pre">Column-Shift</span></code> => <code class="docutils literal notranslate"><span class="pre">PositionRoute-1</span></code> means PositionRoute at one time step earlier</p> | |
<p><strong>Example Use Case</strong></p> | |
<p>Counting agents passing <code class="docutils literal notranslate"><span class="pre">PositionRoute</span> <span class="pre">==</span> <span class="pre">350</span></code> on <code class="docutils literal notranslate"><span class="pre">LaneId</span> <span class="pre">==</span> <span class="pre">-1</span></code></p> | |
<p><strong>Query</strong></p> | |
<p><code class="docutils literal notranslate"><span class="pre">count(AgentId</span> <span class="pre">|</span> <span class="pre">LaneId</span> <span class="pre">==</span> <span class="pre">-1</span> <span class="pre">and</span> <span class="pre">PositionRoute-1</span> <span class="pre"><</span> <span class="pre">350</span> <span class="pre">and</span> <span class="pre">PositionRoute</span> <span class="pre">>=</span> <span class="pre">350</span> <span class="pre">)</span> <span class="pre">></span> <span class="pre">0</span></code></p> | |
<div class="admonition warning"> | |
<p class="admonition-title">Warning</p> | |
<p>In seldom cases, a result column happens to have a name like <code class="docutils literal notranslate"><span class="pre">Name-N</span></code> where <code class="docutils literal notranslate"><span class="pre">N</span></code> is an integer. | |
Querying this column would automatically apply time shifting (default behavior) leading to a parsing error. | |
In such cases, escape the column name with single quotes (e.g. <code class="docutils literal notranslate"><span class="pre">'Name-1'</span></code>).</p> | |
</div> | |
</div> | |
<div class="section" id="explicit-datatypes"> | |
<h3>Explicit Datatypes<a class="headerlink" href="#explicit-datatypes" title="Permalink to this headline">¶</a></h3> | |
<p>pyOpenPASS uses Pandas DataFrames internally. | |
Pandas will try to detect the datatype of the individual cyclic columns automatically. | |
This won’t fit the user’s intention in some cases, such as when the column holds a semicolon separated list of integers but every list contains just one element. | |
In such cases it is impossible to distinguish between integers and strings based on the data.</p> | |
<p>For this reason, datatypes can be specified explicitly in the JSON config file:</p> | |
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> | |
<span class="s2">"datatypes"</span><span class="o">:</span> <span class="p">{</span> | |
<span class="s2">"Sensor0_DetectedAgents"</span><span class="o">:</span> <span class="s2">"str"</span> <span class="c1">// string with "missing value" support</span> | |
<span class="p">},</span> | |
<span class="s2">"scopes"</span><span class="o">:</span> | |
<span class="p">{</span> | |
<span class="p">...</span> | |
</pre></div> | |
</div> | |
</div> | |
</div> | |
<div class="section" id="test-report-generator"> | |
<h2>Test Report Generator<a class="headerlink" href="#test-report-generator" title="Permalink to this headline">¶</a></h2> | |
<p>Generates an HTML report for results from the pyOpenPASS EndToEndTest Framework tool.</p> | |
<p><strong>Command</strong></p> | |
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>report.py | |
-r RESOURCE1, RESOURCE2, ... <span class="c1"># One or more resource folders</span> | |
-c PYOPENPASS_CONFIG.JSON <span class="c1"># JSON config for pyOpenPASS</span> | |
--scope SCOPE1, SCOPE2, ... <span class="c1"># One or more scopes to be considered</span> | |
--results SIMULATOR_RESULT_PATH <span class="c1"># Path with results from simulator (should be the same for all scopes)</span> | |
--output PATH_FOR_REPORT <span class="c1"># Path where the report should be written to</span> | |
</pre></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<footer> | |
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> | |
<a href="../developer_information/10_ide_support.html" class="btn btn-neutral float-right" title="IDE Support" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> | |
<a href="simulator/world_osi.html" class="btn btn-neutral float-left" title="World_OSI" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> | |
</div> | |
<hr/> | |
<div role="contentinfo"> | |
<p> | |
© Copyright 2021 OpenPASS Working Group. | |
</p> | |
</div> | |
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | |
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | |
provided by <a href="https://readthedocs.org">Read the Docs</a>. | |
</footer> | |
</div> | |
</div> | |
</section> | |
</div> | |
<script type="text/javascript"> | |
jQuery(function () { | |
SphinxRtdTheme.Navigation.enable(true); | |
}); | |
</script> | |
</body> | |
</html> |