-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
230aee7
commit 5c9de57
Showing
110 changed files
with
16,569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: f3c29cb065486f67119fd2e6437ed8b6 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<!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>armour.agent.ArmourAgentCollision — RTD-code Python (development) v0.0.1-dev</title> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=80d5e7a1" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" /> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/katex-math.css?v=91adb8b6" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/css/custom.css" /> | ||
|
||
|
||
<!--[if lt IE 9]> | ||
<script src="../../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js?v=d40ce7ee"></script> | ||
<script src="../../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=4825356b"></script> | ||
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script> | ||
<script src="../../../_static/copybutton.js?v=f281be69"></script> | ||
<script src="../../../_static/design-tabs.js?v=36754332"></script> | ||
<script src="../../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.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"> | ||
RTD-code Python (development) | ||
</a> | ||
<div class="version"> | ||
0.0.1-dev | ||
</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" aria-label="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="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../introduction.html">Introduction</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../setup.html">Setup Guide</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../planner/planner.html">Planner Reference</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../simulation/simulation.html">Simulation Reference</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../utils/utils.html">RTD Code Utilities Reference</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../index.html">RTD-code Python (development)</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">armour.agent.ArmourAgentCollision</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for armour.agent.ArmourAgentCollision</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">trimesh</span> <span class="kn">import</span> <span class="n">Trimesh</span> | ||
<span class="kn">from</span> <span class="nn">rtd.sim.systems.collision</span> <span class="kn">import</span> <span class="n">DynamicCollisionObject</span><span class="p">,</span> <span class="n">CollisionObject</span> | ||
<span class="kn">from</span> <span class="nn">armour.agent</span> <span class="kn">import</span> <span class="n">ArmourAgentInfo</span><span class="p">,</span> <span class="n">ArmourAgentState</span> | ||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> | ||
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">OrderedDict</span> | ||
<span class="kn">from</span> <span class="nn">rtd.util.mixins.Typings</span> <span class="kn">import</span> <span class="n">Matnp</span> | ||
|
||
|
||
|
||
<div class="viewcode-block" id="ArmourAgentCollision"><a class="viewcode-back" href="../../../simulation/components.html#armour.agent.ArmourAgentCollision">[docs]</a><span class="k">class</span> <span class="nc">ArmourAgentCollision</span><span class="p">(</span><span class="n">DynamicCollisionObject</span><span class="p">):</span> | ||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arm_info</span><span class="p">:</span> <span class="n">ArmourAgentInfo</span><span class="p">,</span> <span class="n">arm_state</span><span class="p">:</span> <span class="n">ArmourAgentState</span><span class="p">):</span> | ||
<span class="c1"># initialize base classes</span> | ||
<span class="n">DynamicCollisionObject</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> | ||
<span class="c1"># initialize</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">arm_info</span> <span class="o">=</span> <span class="n">arm_info</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">arm_state</span> <span class="o">=</span> <span class="n">arm_state</span> | ||
|
||
<span class="c1"># self.reset()</span> | ||
|
||
|
||
<div class="viewcode-block" id="ArmourAgentCollision.reset"><a class="viewcode-back" href="../../../simulation/components.html#armour.agent.ArmourAgentCollision.reset">[docs]</a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">'''</span> | ||
<span class="sd"> Not needed as collision objects are created on demand</span> | ||
<span class="sd"> '''</span> | ||
<span class="k">pass</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="ArmourAgentCollision.getCollisionObject"><a class="viewcode-back" href="../../../simulation/components.html#armour.agent.ArmourAgentCollision.getCollisionObject">[docs]</a> <span class="k">def</span> <span class="nf">getCollisionObject</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">q</span><span class="p">:</span> <span class="n">Matnp</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">time</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">CollisionObject</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">'''</span> | ||
<span class="sd"> Generates a CollisionObject for a given time `time` or</span> | ||
<span class="sd"> configuration `q` (only one or none must be provided)</span> | ||
<span class="sd"> '''</span> | ||
<span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">arm_state</span><span class="o">.</span><span class="n">position</span><span class="p">[:,</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="c1"># default to last position</span> | ||
<span class="k">if</span> <span class="n">time</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">q</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">config</span> <span class="o">=</span> <span class="n">q</span> | ||
<span class="k">elif</span> <span class="n">time</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">q</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">arm_state</span><span class="o">.</span><span class="n">get_state</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">time</span><span class="p">]))</span><span class="o">.</span><span class="n">position</span> <span class="c1"># position at given time</span> | ||
|
||
<span class="n">fk</span><span class="p">:</span> <span class="n">OrderedDict</span><span class="p">[</span><span class="n">Trimesh</span><span class="p">,</span> <span class="n">Matnp</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">arm_info</span><span class="o">.</span><span class="n">urdf</span><span class="o">.</span><span class="n">collision_trimesh_fk</span><span class="p">(</span><span class="n">cfg</span><span class="o">=</span><span class="n">config</span><span class="p">)</span> | ||
<span class="n">meshes</span> <span class="o">=</span> <span class="p">[</span><span class="n">mesh</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">apply_transform</span><span class="p">(</span><span class="n">transform</span><span class="p">)</span> <span class="k">for</span> <span class="n">mesh</span><span class="p">,</span> <span class="n">transform</span> <span class="ow">in</span> <span class="n">fk</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span> | ||
<span class="k">return</span> <span class="n">CollisionObject</span><span class="p">(</span><span class="n">meshes</span><span class="p">,</span> <span class="nb">id</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arm_info</span><span class="p">))</span></div> | ||
|
||
|
||
<span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="p">(</span><span class="sa">f</span><span class="s2">"Collision component </span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="si">}</span><span class="s2"> with properties:</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> | ||
<span class="sa">f</span><span class="s2">" arm_info: </span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arm_info</span><span class="p">)</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> | ||
<span class="sa">f</span><span class="s2">" arm_state: </span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arm_state</span><span class="p">)</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> </div> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2024, ROAHM Lab.</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> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.