Skip to content

Commit

Permalink
deploy: 2804ff3
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmith-bdai committed Sep 25, 2024
1 parent 4acbf40 commit 6cdad18
Show file tree
Hide file tree
Showing 9 changed files with 2,420 additions and 2,292 deletions.
37 changes: 36 additions & 1 deletion _modules/omni/isaac/lab/envs/mdp/observations.html
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ <h1>Source code for omni.isaac.lab.envs.mdp.observations</h1><div class="highlig
<span class="kn">import</span> <span class="nn">omni.isaac.lab.utils.math</span> <span class="k">as</span> <span class="nn">math_utils</span>
<span class="kn">from</span> <span class="nn">omni.isaac.lab.assets</span> <span class="kn">import</span> <span class="n">Articulation</span><span class="p">,</span> <span class="n">RigidObject</span>
<span class="kn">from</span> <span class="nn">omni.isaac.lab.managers</span> <span class="kn">import</span> <span class="n">SceneEntityCfg</span>
<span class="kn">from</span> <span class="nn">omni.isaac.lab.sensors</span> <span class="kn">import</span> <span class="n">RayCaster</span>
<span class="kn">from</span> <span class="nn">omni.isaac.lab.sensors</span> <span class="kn">import</span> <span class="n">Camera</span><span class="p">,</span> <span class="n">RayCaster</span><span class="p">,</span> <span class="n">RayCasterCamera</span><span class="p">,</span> <span class="n">TiledCamera</span>

<span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">omni.isaac.lab.envs</span> <span class="kn">import</span> <span class="n">ManagerBasedEnv</span><span class="p">,</span> <span class="n">ManagerBasedRLEnv</span>
Expand Down Expand Up @@ -677,6 +677,41 @@ <h1>Source code for omni.isaac.lab.envs.mdp.observations</h1><div class="highlig
<span class="k">return</span> <span class="n">link_incoming_forces</span><span class="o">.</span><span class="n">view</span><span class="p">(</span><span class="n">env</span><span class="o">.</span><span class="n">num_envs</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span></div>


<div class="viewcode-block" id="grab_images"><a class="viewcode-back" href="../../../../../../source/api/lab/omni.isaac.lab.envs.mdp.html#omni.isaac.lab.envs.mdp.observations.grab_images">[docs]</a><span class="k">def</span> <span class="nf">grab_images</span><span class="p">(</span>
<span class="n">env</span><span class="p">:</span> <span class="n">ManagerBasedEnv</span><span class="p">,</span>
<span class="n">sensor_cfg</span><span class="p">:</span> <span class="n">SceneEntityCfg</span> <span class="o">=</span> <span class="n">SceneEntityCfg</span><span class="p">(</span><span class="s2">&quot;tiled_camera&quot;</span><span class="p">),</span>
<span class="n">data_type</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;rgb&quot;</span><span class="p">,</span>
<span class="n">convert_perspective_to_orthogonal</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
<span class="n">normalize</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Grab all of the latest images of a specific datatype produced by a specific camera.</span>

<span class="sd"> Args:</span>
<span class="sd"> env: The environment the cameras are placed within.</span>
<span class="sd"> sensor_cfg: The desired sensor to read from. Defaults to SceneEntityCfg(&quot;tiled_camera&quot;).</span>
<span class="sd"> data_type: The data type to pull from the desired camera. Defaults to &quot;rgb&quot;.</span>
<span class="sd"> convert_perspective_to_orthogonal: Whether to convert perspective</span>
<span class="sd"> depth images to orthogonal depth images. Defaults to False.</span>
<span class="sd"> normalize: Set to True to normalize images. Defaults to True.</span>

<span class="sd"> Returns:</span>
<span class="sd"> The images produced at the last timestep</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">sensor</span><span class="p">:</span> <span class="n">TiledCamera</span> <span class="o">|</span> <span class="n">Camera</span> <span class="o">|</span> <span class="n">RayCasterCamera</span> <span class="o">=</span> <span class="n">env</span><span class="o">.</span><span class="n">scene</span><span class="o">.</span><span class="n">sensors</span><span class="p">[</span><span class="n">sensor_cfg</span><span class="o">.</span><span class="n">name</span><span class="p">]</span>
<span class="n">images</span> <span class="o">=</span> <span class="n">sensor</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">output</span><span class="p">[</span><span class="n">data_type</span><span class="p">]</span>
<span class="k">if</span> <span class="p">(</span><span class="n">data_type</span> <span class="o">==</span> <span class="s2">&quot;distance_to_camera&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">convert_perspective_to_orthogonal</span><span class="p">:</span>
<span class="n">images</span> <span class="o">=</span> <span class="n">math_utils</span><span class="o">.</span><span class="n">convert_perspective_depth_to_orthogonal_depth</span><span class="p">(</span><span class="n">images</span><span class="p">,</span> <span class="n">sensor</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">intrinsic_matrices</span><span class="p">)</span>

<span class="k">if</span> <span class="n">normalize</span><span class="p">:</span>
<span class="k">if</span> <span class="n">data_type</span> <span class="o">==</span> <span class="s2">&quot;rgb&quot;</span><span class="p">:</span>
<span class="n">images</span> <span class="o">=</span> <span class="n">images</span> <span class="o">/</span> <span class="mi">255</span>
<span class="n">mean_tensor</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">images</span><span class="p">,</span> <span class="n">dim</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">keepdim</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">images</span> <span class="o">-=</span> <span class="n">mean_tensor</span>
<span class="k">elif</span> <span class="s2">&quot;distance_to&quot;</span> <span class="ow">in</span> <span class="n">data_type</span> <span class="ow">or</span> <span class="s2">&quot;depth&quot;</span> <span class="ow">in</span> <span class="n">data_type</span><span class="p">:</span>
<span class="n">images</span><span class="p">[</span><span class="n">images</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="s2">&quot;inf&quot;</span><span class="p">)]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">return</span> <span class="n">images</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span></div>


<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Actions.</span>
<span class="sd">&quot;&quot;&quot;</span>
Expand Down
13 changes: 10 additions & 3 deletions _sources/source/overview/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ Classic environments that are based on IsaacGymEnvs implementation of MuJoCo-sty
| | | |
| | |cartpole-direct-link| | |
+------------------+-----------------------------+-------------------------------------------------------------------------+
| |cartpole| | |cartpole-camera-rgb-link| | Move the cart to keep the pole upwards in the classic cartpole control |
| | | using perceptive inputs |
| |cartpole| | |manager-camera-rgb-link| | Move the cart to keep the pole upwards in the classic cartpole control |
| | | and perceptive inputs |
| | |manager-camera-dpt-link| | |
| | | |
| | |cartpole-camera-rgb-link| | |
| | | |
| | |cartpole-camera-dpt-link| | |
+------------------+-----------------------------+-------------------------------------------------------------------------+

Expand All @@ -68,11 +72,14 @@ Classic environments that are based on IsaacGymEnvs implementation of MuJoCo-sty

.. |humanoid-direct-link| replace:: `Isaac-Humanoid-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/humanoid/humanoid_env.py>`__
.. |ant-direct-link| replace:: `Isaac-Ant-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/ant/ant_env.py>`__
.. |manager-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
.. |manager-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
.. |cartpole-direct-link| replace:: `Isaac-Cartpole-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_env.py>`__
.. |manager-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
.. |manager-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
.. |cartpole-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__
.. |cartpole-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__


Manipulation
~~~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -2703,6 +2703,8 @@ <h2 id="G">G</h2>
<li><a href="source/api/lab/omni.isaac.lab.sim.html#omni.isaac.lab.sim.PhysxCfg.gpu_temp_buffer_capacity">gpu_temp_buffer_capacity (omni.isaac.lab.sim.PhysxCfg attribute)</a>
</li>
<li><a href="source/api/lab/omni.isaac.lab.sim.html#omni.isaac.lab.sim.PhysxCfg.gpu_total_aggregate_pairs_capacity">gpu_total_aggregate_pairs_capacity (omni.isaac.lab.sim.PhysxCfg attribute)</a>
</li>
<li><a href="source/api/lab/omni.isaac.lab.envs.mdp.html#omni.isaac.lab.envs.mdp.observations.grab_images">grab_images() (in module omni.isaac.lab.envs.mdp.observations)</a>
</li>
<li><a href="source/api/lab/omni.isaac.lab.sim.html#omni.isaac.lab.sim.SimulationCfg.gravity">gravity (omni.isaac.lab.sim.SimulationCfg attribute)</a>
</li>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6cdad18

Please sign in to comment.