Update documentation
This commit is contained in:
parent
0dbfc5fe6b
commit
aa6fb2fc8b
17 changed files with 776 additions and 47 deletions
|
@ -1,25 +1,21 @@
|
|||
Welcome to CompLib's documentation!
|
||||
===================================
|
||||
Robo4you Competition Library
|
||||
#############################
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
CompLib is the library used in the robo4you competition 2021.
|
||||
|
||||
|
||||
Table of Contents
|
||||
^^^^^^^^^^^^^^^^^
|
||||
Contents
|
||||
*********
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:glob:
|
||||
|
||||
self
|
||||
other/usage
|
||||
lib/*
|
||||
|
|
67
html/_sources/lib/Api.rst.txt
Normal file
67
html/_sources/lib/Api.rst.txt
Normal file
|
@ -0,0 +1,67 @@
|
|||
.. _lib_api:
|
||||
|
||||
Api
|
||||
=====
|
||||
|
||||
Seeding
|
||||
********
|
||||
|
||||
.. autoclass:: compLib.Api.Seeding
|
||||
:members:
|
||||
|
||||
Double Elimination
|
||||
*******************
|
||||
|
||||
.. autoclass:: compLib.Api.DoubleElim
|
||||
:members:
|
||||
|
||||
Position
|
||||
*********
|
||||
|
||||
.. autoclass:: compLib.Api.Position
|
||||
:members:
|
||||
|
||||
|
||||
Examples
|
||||
*********
|
||||
|
||||
Calling Seeding API
|
||||
---------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.Api import Seeding
|
||||
|
||||
park = Seeding.get_park()
|
||||
print(f"I should move to parking position: {park}")
|
||||
|
||||
if park == 0:
|
||||
print(f"I can't move to this position yet :(")
|
||||
elif park == 1:
|
||||
print(f"Moving to position 1!")
|
||||
# drive to parking position using Motors module...
|
||||
print(f"Now hopefully at position 1")
|
||||
# drive back using Motors module...
|
||||
elif park == 2:
|
||||
# do something similar to park == 1..
|
||||
elif park == 3:
|
||||
# do something similar to park == 1..
|
||||
|
||||
success = Seeding.pay_park()
|
||||
if success:
|
||||
print(f"We scored some points!")
|
||||
else:
|
||||
print(f"We failed :(")
|
||||
|
||||
Calling Double Elimination API
|
||||
----------------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.Api import DoubleElim
|
||||
|
||||
position = DoubleElim.get_position()
|
||||
print(f"Position of my robot is: x={position.x}, y={position.y} and rotation is: {position.degrees}")
|
||||
|
||||
goal = DoubleElim.get_goal()
|
||||
print(f"Goal is at: x={goal.x}, y={goal.y}")
|
28
html/_sources/other/usage.rst.txt
Normal file
28
html/_sources/other/usage.rst.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
.. _other_usage:
|
||||
|
||||
Usage
|
||||
######
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
from compLib.Motor import *
|
||||
|
||||
def forward():
|
||||
for port in range(0, 3):
|
||||
Motor.power(port, 30);
|
||||
|
||||
def backward():
|
||||
for port in range(0, 3):
|
||||
Motor.power(port, -30);
|
||||
|
||||
def main():
|
||||
print("hallo ich bin ein roboter beep buup")
|
||||
|
||||
forward()
|
||||
time.sleep(1)
|
||||
backward()
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Reference in a new issue