Update documentation
This commit is contained in:
parent
d2498e8a04
commit
99e3a06d39
24 changed files with 3016 additions and 12756 deletions
133
lib/Motor.html
133
lib/Motor.html
|
@ -1,14 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Motor — CompLib 0.0.2 documentation</title><link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<title>Motor — CompLib 0.0.2 documentation</title>
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="../_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
|
@ -80,14 +83,120 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="motor">
|
||||
<section id="motor">
|
||||
<span id="lib-motor"></span><h1>Motor<a class="headerlink" href="#motor" title="Permalink to this headline"></a></h1>
|
||||
<div class="section" id="class-documentation">
|
||||
<section id="class-documentation">
|
||||
<h2>Class Documentation<a class="headerlink" href="#class-documentation" title="Permalink to this headline"></a></h2>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor">
|
||||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">compLib.Motor.</span></span><span class="sig-name descname"><span class="pre">Motor</span></span><a class="headerlink" href="#compLib.Motor.Motor" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Class used to control the motors</p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.active_break">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">active_break</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.active_break" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Actively break with a specific motor</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>port</strong> – Port, which the motor is connected to. 1-4</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.all_off">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">all_off</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.all_off" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Turns of all motors</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.get_motor_curve">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_motor_curve</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.get_motor_curve" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Get the currently active motor curve. Check set_motor_curve() for more info.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>current motor curve</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.power">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">power</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">percent</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.power" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Set specified motor to percentage power, percentage is linearized
|
||||
so that it’s roughly proportional to the speed</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>port</strong> – Port, which the motor is connected to. 1-4</p></li>
|
||||
<li><p><strong>percent</strong> – Percentage of max speed. between -100 and 100</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p>IndexError</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.power_raw">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">power_raw</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">percent</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">log_metric</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.power_raw" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Set specified motor to percentage power</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>port</strong> – Port, which the motor is connected to. 1-4</p></li>
|
||||
<li><p><strong>percent</strong> – Percentage of max speed. between -100 and 100</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p>IndexError</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.pwm">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">pwm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pwm</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">compLib.Motor.MotorMode</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.pwm" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Set specified motor to a specific pwm value and motor mode</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>port</strong> – Port, which the motor is connected to. 1-4 allowed</p></li>
|
||||
<li><p><strong>pwm</strong> – Raw PWM value which the motor should be set to. From 0 to 2^16 - 1</p></li>
|
||||
<li><p><strong>mode</strong> – Motor mode. See enum MotorMode for more info</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p>IndexError</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="compLib.Motor.Motor.set_motor_curve">
|
||||
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">set_motor_curve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">curve</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Motor.Motor.set_motor_curve" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Set the global motor curve, must be a float array with exactly 21 elements.
|
||||
[0] = x ticks/s (0% power)
|
||||
[1] = x ticks/s (5% power)
|
||||
[2] = x ticks/s (10% power)
|
||||
…
|
||||
[20] = x ticks/s (100% power)</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>curve</strong> – float array with 21 elements</p>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p>ValueError</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
</section>
|
||||
<section id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
|
||||
<div class="section" id="driving-straight-maybe">
|
||||
<section id="driving-straight-maybe">
|
||||
<h3>Driving straight (maybe)<a class="headerlink" href="#driving-straight-maybe" title="Permalink to this headline"></a></h3>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">compLib.Motor</span> <span class="kn">import</span> <span class="n">Motor</span>
|
||||
|
||||
|
@ -95,9 +204,9 @@
|
|||
<span class="n">Motor</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">50</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
Reference in a new issue