Update documentation

This commit is contained in:
Konstantin Lampalzer 2021-09-13 18:47:18 +02:00
parent ccd46ee8a7
commit 4c1cfa6735
9 changed files with 466 additions and 7 deletions

View file

@ -170,6 +170,112 @@
<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">
<h2>Class Documentation<a class="headerlink" href="#class-documentation" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="compLib.Motor.Motor">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Motor.</code><code class="sig-name descname">Motor</code><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 id="compLib.Motor.Motor.active_break">
<em class="property">static </em><code class="sig-name descname">active_break</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">port</span><span class="p">:</span> <span class="n">int</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 id="compLib.Motor.Motor.all_off">
<em class="property">static </em><code class="sig-name descname">all_off</code><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 id="compLib.Motor.Motor.get_motor_curve">
<em class="property">static </em><code class="sig-name descname">get_motor_curve</code><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 id="compLib.Motor.Motor.power">
<em class="property">static </em><code class="sig-name descname">power</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">port</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">percent</span><span class="p">:</span> <span class="n">float</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 its 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 id="compLib.Motor.Motor.power_raw">
<em class="property">static </em><code class="sig-name descname">power_raw</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">port</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">percent</span><span class="p">:</span> <span class="n">float</span></em>, <em class="sig-param"><span class="n">log_metric</span><span class="o">=</span><span class="default_value">True</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 id="compLib.Motor.Motor.pwm">
<em class="property">static </em><code class="sig-name descname">pwm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">port</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">pwm</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">mode</span><span class="p">:</span> <span class="n">compLib.Motor.MotorMode</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 id="compLib.Motor.Motor.set_motor_curve">
<em class="property">static </em><code class="sig-name descname">set_motor_curve</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">curve</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>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>