Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeguzzi committed Sep 27, 2024
1 parent abcca02 commit e550024
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _sources/guides/parallelize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ For example, if the experiment described in ``experiment.yaml`` needs 1000 runs,

.. code-block:: console
$ for i in {0..9}; do run experiment.yaml --runs 100 --run_index $((i * 100)) &; done
$ for i in {0..9}; do navground run experiment.yaml --runs 100 --run_index $((i * 100)) &; done
This will results in 10 directories, one for each sub-experiment: you can load their data and aggregate it.

Expand Down
10 changes: 7 additions & 3 deletions _sources/tutorials/designing_an_experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Scenarios may have specific configuration variables, which we list using :ref:`i

.. code-block:: console
$ info --scenario Corridor --properties
$ navground info --scenario Corridor --properties
Scenarios
---------
Expand All @@ -33,6 +33,10 @@ Scenarios may have specific configuration variables, which we list using :ref:`i
length: 10 [float]
width: 1 [float]
.. note::

If you have installed navground from pip and don't have the ``navground`` command, use ``navground_py`` instead.

Let's make the corridor wider and shorter:

.. code-block:: YAML
Expand Down Expand Up @@ -143,7 +147,7 @@ We can try to sample a world from such a scenario. Save all but the root element

.. code-block:: console
$ sample --seed 0 my_scenario.yaml
$ navground sample --seed 0 my_scenario.yaml
obstacles:
[]
Expand Down Expand Up @@ -346,7 +350,7 @@ Now we are ready to put the configuration in a file like ``my_config.yaml`` and

.. code-block:: console
$ run my_config.yaml
$ navground run my_config.yaml
Experiment done
Duration: 1.64725 s
Expand Down
4 changes: 2 additions & 2 deletions _sources/tutorials/running_an_experiment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@
"source": [
"is equivalent to executing\n",
"```\n",
"run_py <yaml_file>\n",
"navground_py run <yaml_file>\n",
"```\n",
"from the command line after storing the configuration in a YAML file. \n",
"\n",
"\n",
"As all the components of this experiment (scenario, behavior, kinematics, state estimation, and task) are implemented in C++, we could run it using the C++ executable too:\n",
"```\n",
"run <yaml_file>\n",
"navground run <yaml_file>\n",
"```\n",
"\n",
"The experiment takes some time to execute"
Expand Down
2 changes: 1 addition & 1 deletion guides/parallelize.html
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ <h3>Automatic parallelization<a class="headerlink" href="#automatic-parallelizat
<h3>Manual parallelization<a class="headerlink" href="#manual-parallelization" title="Link to this heading">#</a></h3>
<p>We can also parallelizing experiments by dividing them manually and launching several instances of <code class="docutils literal notranslate"><span class="pre">run</span></code> or <code class="docutils literal notranslate"><span class="pre">run_py</span></code> at the same time.</p>
<p>For example, if the experiment described in <code class="docutils literal notranslate"><span class="pre">experiment.yaml</span></code> needs 1000 runs, you can split them over 10 experiments with <code class="docutils literal notranslate"><span class="pre">run_index=0,</span> <span class="pre">100,</span> <span class="pre">200,</span> <span class="pre">...</span></code> and <code class="docutils literal notranslate"><span class="pre">runs=100</span></code>, each running in a separate process:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="k">for</span><span class="w"> </span>i<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">{</span><span class="m">0</span>..9<span class="o">}</span><span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span>run<span class="w"> </span>experiment.yaml<span class="w"> </span>--runs<span class="w"> </span><span class="m">100</span><span class="w"> </span>--run_index<span class="w"> </span><span class="k">$((</span><span class="nv">i</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="m">100</span><span class="k">))</span><span class="w"> </span><span class="p">&amp;;</span><span class="w"> </span><span class="k">done</span>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="k">for</span><span class="w"> </span>i<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">{</span><span class="m">0</span>..9<span class="o">}</span><span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span>navground<span class="w"> </span>run<span class="w"> </span>experiment.yaml<span class="w"> </span>--runs<span class="w"> </span><span class="m">100</span><span class="w"> </span>--run_index<span class="w"> </span><span class="k">$((</span><span class="nv">i</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="m">100</span><span class="k">))</span><span class="w"> </span><span class="p">&amp;;</span><span class="w"> </span><span class="k">done</span>
</pre></div>
</div>
<p>This will results in 10 directories, one for each sub-experiment: you can load their data and aggregate it.</p>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions tutorials/designing_an_experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h2>Scenario<a class="headerlink" href="#scenario" title="Link to this heading">
</pre></div>
</div>
<p>Scenarios may have specific configuration variables, which we list using <a class="reference internal" href="../packages/navground_core.html#info"><span class="std std-ref">info</span></a></p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>info<span class="w"> </span>--scenario<span class="w"> </span>Corridor<span class="w"> </span>--properties
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>navground<span class="w"> </span>info<span class="w"> </span>--scenario<span class="w"> </span>Corridor<span class="w"> </span>--properties

<span class="go">Scenarios</span>
<span class="go">---------</span>
Expand All @@ -486,6 +486,10 @@ <h2>Scenario<a class="headerlink" href="#scenario" title="Link to this heading">
<span class="go"> width: 1 [float]</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you have installed navground from pip and don’t have the <code class="docutils literal notranslate"><span class="pre">navground</span></code> command, use <code class="docutils literal notranslate"><span class="pre">navground_py</span></code> instead.</p>
</div>
<p>Let’s make the corridor wider and shorter:</p>
<div class="highlight-YAML notranslate"><div class="highlight"><pre><span></span><span class="c1"># Experiment configuration</span>
<span class="nt">scenario</span><span class="p">:</span>
Expand Down Expand Up @@ -580,7 +584,7 @@ <h2>Agents<a class="headerlink" href="#agents" title="Link to this heading">#</a
</pre></div>
</div>
<p>We can try to sample a world from such a scenario. Save all but the root element <code class="docutils literal notranslate"><span class="pre">scenario</span></code> in <code class="docutils literal notranslate"><span class="pre">my_scenario.yaml</span></code> and run</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>sample<span class="w"> </span>--seed<span class="w"> </span><span class="m">0</span><span class="w"> </span>my_scenario.yaml
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>navground<span class="w"> </span>sample<span class="w"> </span>--seed<span class="w"> </span><span class="m">0</span><span class="w"> </span>my_scenario.yaml

<span class="go">obstacles:</span>
<span class="go"> []</span>
Expand Down Expand Up @@ -771,7 +775,7 @@ <h2>Runs<a class="headerlink" href="#runs" title="Link to this heading">#</a></h
</pre></div>
</div>
<p>Now we are ready to put the configuration in a file like <code class="docutils literal notranslate"><span class="pre">my_config.yaml</span></code> and to make <code class="docutils literal notranslate"><span class="pre">navground</span></code> execute the experiment.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>run<span class="w"> </span>my_config.yaml
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>navground<span class="w"> </span>run<span class="w"> </span>my_config.yaml

<span class="go">Experiment done</span>
<span class="go">Duration: 1.64725 s</span>
Expand Down
4 changes: 2 additions & 2 deletions tutorials/running_an_experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,12 @@ <h2>Running the experiment<a class="headerlink" href="#Running-the-experiment" t
</div>
</div>
<p>is equivalent to executing</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>run_py &lt;yaml_file&gt;
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>navground_py run &lt;yaml_file&gt;
</pre></div>
</div>
<p>from the command line after storing the configuration in a YAML file.</p>
<p>As all the components of this experiment (scenario, behavior, kinematics, state estimation, and task) are implemented in C++, we could run it using the C++ executable too:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>run &lt;yaml_file&gt;
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>navground run &lt;yaml_file&gt;
</pre></div>
</div>
<p>The experiment takes some time to execute</p>
Expand Down

0 comments on commit e550024

Please sign in to comment.