Skip to content

Commit

Permalink
deploy: f7350c7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhoeller19 committed Nov 1, 2024
1 parent dc45451 commit 2a9bed6
Show file tree
Hide file tree
Showing 5 changed files with 2,514 additions and 2,473 deletions.
8 changes: 6 additions & 2 deletions main/_modules/omni/isaac/lab/managers/manager_term_cfg.html
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,13 @@ <h1>Source code for omni.isaac.lab.managers.manager_term_cfg</h1><div class="hig
<span class="w"> </span><span class="sd">&quot;&quot;&quot;The clipping range for the observation after adding noise. Defaults to None,</span>
<span class="sd"> in which case no clipping is applied.&quot;&quot;&quot;</span>

<span class="n">scale</span><span class="p">:</span> <span class="nb">float</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">scale</span><span class="p">:</span> <span class="nb">tuple</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">|</span> <span class="nb">float</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;The scale to apply to the observation after clipping. Defaults to None,</span>
<span class="sd"> in which case no scaling is applied (same as setting scale to :obj:`1`).&quot;&quot;&quot;</span></div>
<span class="sd"> in which case no scaling is applied (same as setting scale to :obj:`1`).</span>

<span class="sd"> We leverage PyTorch broadcasting to scale the observation tensor with the provided value. If a tuple is provided,</span>
<span class="sd"> please make sure the length of the tuple matches the dimensions of the tensor outputted from the term.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>


<div class="viewcode-block" id="ObservationGroupCfg"><a class="viewcode-back" href="../../../../../source/api/lab/omni.isaac.lab.managers.html#omni.isaac.lab.managers.ObservationGroupCfg">[docs]</a><span class="nd">@configclass</span>
Expand Down
19 changes: 18 additions & 1 deletion main/_modules/omni/isaac/lab/managers/observation_manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ <h1>Source code for omni.isaac.lab.managers.observation_manager</h1><div class="
<span class="n">obs</span> <span class="o">=</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">noise</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="n">obs</span><span class="p">,</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">noise</span><span class="p">)</span>
<span class="k">if</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">clip</span><span class="p">:</span>
<span class="n">obs</span> <span class="o">=</span> <span class="n">obs</span><span class="o">.</span><span class="n">clip_</span><span class="p">(</span><span class="nb">min</span><span class="o">=</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">clip</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">max</span><span class="o">=</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">clip</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">if</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">:</span>
<span class="k">if</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">obs</span> <span class="o">=</span> <span class="n">obs</span><span class="o">.</span><span class="n">mul_</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">)</span>
<span class="c1"># add value to list</span>
<span class="n">group_obs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">obs</span>
Expand Down Expand Up @@ -842,6 +842,23 @@ <h1>Source code for omni.isaac.lab.managers.observation_manager</h1><div class="
<span class="n">obs_dims</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_env</span><span class="p">,</span> <span class="o">**</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">params</span><span class="p">)</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_group_obs_term_dim</span><span class="p">[</span><span class="n">group_name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">obs_dims</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>

<span class="c1"># if scale is set, check if single float or tuple</span>
<span class="k">if</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)):</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Scale for observation term &#39;</span><span class="si">{</span><span class="n">term_name</span><span class="si">}</span><span class="s2">&#39; in group &#39;</span><span class="si">{</span><span class="n">group_name</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
<span class="sa">f</span><span class="s2">&quot; is not of type float, int or tuple. Received: &#39;</span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">)</span><span class="si">}</span><span class="s2">&#39;.&quot;</span>
<span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">)</span> <span class="o">!=</span> <span class="n">obs_dims</span><span class="p">[</span><span class="mi">1</span><span class="p">]:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Scale for observation term &#39;</span><span class="si">{</span><span class="n">term_name</span><span class="si">}</span><span class="s2">&#39; in group &#39;</span><span class="si">{</span><span class="n">group_name</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
<span class="sa">f</span><span class="s2">&quot; does not match the dimensions of the observation. Expected: </span><span class="si">{</span><span class="n">obs_dims</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot; but received: </span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">)</span><span class="si">}</span><span class="s2">.&quot;</span>
<span class="p">)</span>

<span class="c1"># cast the scale into torch tensor</span>
<span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">tensor</span><span class="p">(</span><span class="n">term_cfg</span><span class="o">.</span><span class="n">scale</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">float</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_env</span><span class="o">.</span><span class="n">device</span><span class="p">)</span>

<span class="c1"># prepare modifiers for each observation</span>
<span class="k">if</span> <span class="n">term_cfg</span><span class="o">.</span><span class="n">modifiers</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># initialize list of modifiers for term</span>
Expand Down
2 changes: 1 addition & 1 deletion main/searchindex.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion main/source/api/lab/omni.isaac.lab.managers.html
Original file line number Diff line number Diff line change
Expand Up @@ -1582,9 +1582,11 @@ <h2>Observation Manager<a class="headerlink" href="#observation-manager" title="

<dl class="py attribute">
<dt class="sig sig-object py" id="omni.isaac.lab.managers.ObservationTermCfg.scale">
<span class="sig-name descname"><span class="pre">scale</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></em><a class="headerlink" href="#omni.isaac.lab.managers.ObservationTermCfg.scale" title="Permalink to this definition">#</a></dt>
<span class="sig-name descname"><span class="pre">scale</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.13)"><span class="pre">tuple</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="p"><span class="pre">...</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></em><a class="headerlink" href="#omni.isaac.lab.managers.ObservationTermCfg.scale" title="Permalink to this definition">#</a></dt>
<dd><p>The scale to apply to the observation after clipping. Defaults to None,
in which case no scaling is applied (same as setting scale to <code class="xref py py-obj docutils literal notranslate"><span class="pre">1</span></code>).</p>
<p>We leverage PyTorch broadcasting to scale the observation tensor with the provided value. If a tuple is provided,
please make sure the length of the tuple matches the dimensions of the tensor outputted from the term.</p>
</dd></dl>

<dl class="py attribute">
Expand Down
Loading

0 comments on commit 2a9bed6

Please sign in to comment.