Update documentation

This commit is contained in:
Konstantin Lampalzer 2021-03-19 15:22:50 +01:00
parent dbe08c033a
commit cf7d60f002
No known key found for this signature in database
GPG key ID: 9A60A522835A2AD9
9 changed files with 360 additions and 6 deletions

View file

@ -171,12 +171,142 @@
<span id="lib-api"></span><h1>Api<a class="headerlink" href="#api" title="Permalink to this headline"></a></h1>
<div class="section" id="seeding">
<h2>Seeding<a class="headerlink" href="#seeding" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="compLib.Api.Seeding">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Api.</code><code class="sig-name descname">Seeding</code><a class="headerlink" href="#compLib.Api.Seeding" title="Permalink to this definition"></a></dt>
<dd><p>Class used for communicating with seeding api</p>
<dl class="py method">
<dt id="compLib.Api.Seeding.get_park">
<em class="property">static </em><code class="sig-name descname">get_park</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span>Dict<span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.Seeding.get_park" title="Permalink to this definition"></a></dt>
<dd><p>Get a parkingsapce from the api.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Json Object and status code as returned by the api.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[Dict, int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.Seeding.pay_park">
<em class="property">static </em><code class="sig-name descname">pay_park</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; int<a class="headerlink" href="#compLib.Api.Seeding.pay_park" title="Permalink to this definition"></a></dt>
<dd><p>Pay for parking.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Status code as returned by the api.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.Seeding.simon_says">
<em class="property">static </em><code class="sig-name descname">simon_says</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span>Dict<span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.Seeding.simon_says" title="Permalink to this definition"></a></dt>
<dd><p>Get next simon says zone from the api.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Json Object and status code as returned by the api.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[Dict, int]</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="double-elimination">
<h2>Double Elimination<a class="headerlink" href="#double-elimination" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="compLib.Api.DoubleElim">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Api.</code><code class="sig-name descname">DoubleElim</code><a class="headerlink" href="#compLib.Api.DoubleElim" title="Permalink to this definition"></a></dt>
<dd><p>Class used for communicating with double elimination api</p>
<dl class="py method">
<dt id="compLib.Api.DoubleElim.get_goal">
<em class="property">static </em><code class="sig-name descname">get_goal</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span><a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">compLib.Api.Position</a><span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.DoubleElim.get_goal" title="Permalink to this definition"></a></dt>
<dd><p>Get position of the goal</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A Position object with x and y coordinates of the goal, rotation is always -1</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[<a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">Position</a>, int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.DoubleElim.get_items">
<em class="property">static </em><code class="sig-name descname">get_items</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span>List<span class="p">[</span>Dict<span class="p">]</span><span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.DoubleElim.get_items" title="Permalink to this definition"></a></dt>
<dd><p>Get a list with all current items</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A list will all items currently on the game field. Items are dictionaries that look like: {“id”: 0, “x”: 0, “y”: 0}</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[List[Dict], int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.DoubleElim.get_opponent">
<em class="property">static </em><code class="sig-name descname">get_opponent</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span><a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">compLib.Api.Position</a><span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.DoubleElim.get_opponent" title="Permalink to this definition"></a></dt>
<dd><p>Get position of the opponents robot</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A Position object with opponents robot position</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[<a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">Position</a>, int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.DoubleElim.get_position">
<em class="property">static </em><code class="sig-name descname">get_position</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span><a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">compLib.Api.Position</a><span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.DoubleElim.get_position" title="Permalink to this definition"></a></dt>
<dd><p>Get position of the robot</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A Position object with robot position</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[<a class="reference internal" href="#compLib.Api.Position" title="compLib.Api.Position">Position</a>, int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Api.DoubleElim.get_scores">
<em class="property">static </em><code class="sig-name descname">get_scores</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Tuple<span class="p">[</span>Dict<span class="p">, </span>int<span class="p">]</span><a class="headerlink" href="#compLib.Api.DoubleElim.get_scores" title="Permalink to this definition"></a></dt>
<dd><p>Get the current scores</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A dictionary with all scores included like: {“self”:2,”opponent”:0}</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Tuple[Dict, int]</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="position">
<h2>Position<a class="headerlink" href="#position" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="compLib.Api.Position">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Api.</code><code class="sig-name descname">Position</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">x</span></em>, <em class="sig-param"><span class="n">y</span></em>, <em class="sig-param"><span class="n">degrees</span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Api.Position" title="Permalink to this definition"></a></dt>
<dd><p>Datastructure for holding a position</p>
</dd></dl>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>

View file

@ -168,6 +168,26 @@
<span id="lib-battery"></span><h1>Battery<a class="headerlink" href="#battery" 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.Battery.Battery">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Battery.</code><code class="sig-name descname">Battery</code><a class="headerlink" href="#compLib.Battery.Battery" title="Permalink to this definition"></a></dt>
<dd><p>Used to interact with the battery</p>
<dl class="py method">
<dt id="compLib.Battery.Battery.percent">
<em class="property">static </em><code class="sig-name descname">percent</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; int<a class="headerlink" href="#compLib.Battery.Battery.percent" title="Permalink to this definition"></a></dt>
<dd><p>Get battery percentage</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Percentage between 0 and 100</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>int</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>

View file

@ -168,6 +168,23 @@
<span id="lib-buzzer"></span><h1>Buzzer<a class="headerlink" href="#buzzer" 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.Buzzer.Buzzer">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Buzzer.</code><code class="sig-name descname">Buzzer</code><a class="headerlink" href="#compLib.Buzzer.Buzzer" title="Permalink to this definition"></a></dt>
<dd><p>Used to interact with the buzzer</p>
<dl class="py method">
<dt id="compLib.Buzzer.Buzzer.set">
<em class="property">static </em><code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">on</span><span class="p">:</span> <span class="n">bool</span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Buzzer.Buzzer.set" title="Permalink to this definition"></a></dt>
<dd><p>Turn the buzzer on / off</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>on</strong> True if on, False if off</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>

View file

@ -168,6 +168,35 @@
<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.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.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</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. 0-3, 0 -&gt; top left, 3 -&gt; top right</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>
</dd></dl>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>

View file

@ -159,6 +159,32 @@
<div class="section" id="servo">
<span id="lib-servo"></span><h1>Servo<a class="headerlink" href="#servo" title="Permalink to this headline"></a></h1>
<dl class="py class">
<dt id="compLib.Servo.Servo">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Servo.</code><code class="sig-name descname">Servo</code><a class="headerlink" href="#compLib.Servo.Servo" title="Permalink to this definition"></a></dt>
<dd><p>Control the servo ports on the robot</p>
<dl class="py method">
<dt id="compLib.Servo.Servo.set_position">
<em class="property">static </em><code class="sig-name descname">set_position</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">angle</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">offset</span><span class="p">:</span> <span class="n">float</span> <span class="o">=</span> <span class="default_value">90</span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Servo.Servo.set_position" title="Permalink to this definition"></a></dt>
<dd><p>Set position of servo connected to port</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>channel</strong> channel between 0 and 7</p></li>
<li><p><strong>angle</strong> Angle of servo</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Servo.Servo.setup_position">
<em class="property">static </em><code class="sig-name descname">setup_position</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Servo.Servo.setup_position" title="Permalink to this definition"></a></dt>
<dd><p>Set position of servos to the position used during the setup process</p>
</dd></dl>
</dd></dl>
</div>

View file

@ -178,6 +178,41 @@
<h2>Opencv Stream<a class="headerlink" href="#opencv-stream" title="Permalink to this headline"></a></h2>
<p>Because of the rtmp stream needing to buffer some frames and waiting for P-Frames, importing this module might take up
to 5 Seconds.</p>
<dl class="py class">
<dt id="compLib.Vision.__Streaming">
<em class="property">class </em><code class="sig-prename descclassname">compLib.Vision.</code><code class="sig-name descname">__Streaming</code><a class="headerlink" href="#compLib.Vision.__Streaming" title="Permalink to this definition"></a></dt>
<dd><p>Class that handles rtmp streaming for opencv.</p>
<p>DO NOT CREATE AN INSTANCE OF THIS CLASS YOURSELF!</p>
<p>This is automatically done when importing this module. Use Vision.Streaming which is
an instance of this class!</p>
<p>grab frames -&gt; do your own processing -&gt; publish frame -&gt; view on http server</p>
<dl class="py method">
<dt id="compLib.Vision.__Streaming.get_frame">
<code class="sig-name descname">get_frame</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Vision.__Streaming.get_frame" title="Permalink to this definition"></a></dt>
<dd><p>Grab the newest frame from the rtmp stream.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>An opencv frame</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="compLib.Vision.__Streaming.publish_frame">
<code class="sig-name descname">publish_frame</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">image</span></em><span class="sig-paren">)</span><a class="headerlink" href="#compLib.Vision.__Streaming.publish_frame" title="Permalink to this definition"></a></dt>
<dd><p>Publish an opencv frame to the http webserver.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>image</strong> Opencv frame that will be published</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>None</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>