documentation, IP writing service
This commit is contained in:
parent
03daabaa37
commit
afe5e9c766
22 changed files with 502 additions and 12 deletions
3
client_s2/docs/.gitignore
vendored
Normal file
3
client_s2/docs/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
build
|
||||
logs.db
|
||||
!lib
|
20
client_s2/docs/Makefile
Normal file
20
client_s2/docs/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
35
client_s2/docs/make.bat
Normal file
35
client_s2/docs/make.bat
Normal file
|
@ -0,0 +1,35 @@
|
|||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
0
client_s2/docs/source/_static/.gitkeep
Normal file
0
client_s2/docs/source/_static/.gitkeep
Normal file
63
client_s2/docs/source/conf.py
Normal file
63
client_s2/docs/source/conf.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
sys.setrecursionlimit(1500)
|
||||
os.environ["EXTENSIVE_LOGGING"] = "False"
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'CompLib'
|
||||
copyright = '2022, Verein zur Förderung von Wissenschaft und Technik an Schulen (F-WuTS)'
|
||||
author = 'robo4you'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '0.2.3'
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx_rtd_theme'
|
||||
]
|
||||
|
||||
autodoc_mock_imports = ["smbus", "compLib.PCA9685", "RPi",
|
||||
"pigpio", "flask", "apt", "influxdb_client"]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = []
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
|
||||
language = "de"
|
189
client_s2/docs/source/images/compair-logo-white.svg
Normal file
189
client_s2/docs/source/images/compair-logo-white.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 188 KiB |
18
client_s2/docs/source/index.rst
Normal file
18
client_s2/docs/source/index.rst
Normal file
|
@ -0,0 +1,18 @@
|
|||
.. image:: images/compair-logo-white.svg
|
||||
|
||||
Dokumentation des Roboters
|
||||
##########################
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
Contents
|
||||
*********
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:glob:
|
||||
|
||||
other/usage
|
||||
lib/index.rst
|
47
client_s2/docs/source/lib/classes/Motor.rst
Normal file
47
client_s2/docs/source/lib/classes/Motor.rst
Normal file
|
@ -0,0 +1,47 @@
|
|||
.. _lib_motor:
|
||||
|
||||
Motoren
|
||||
********
|
||||
|
||||
Dokumentation der Klasse
|
||||
========================
|
||||
|
||||
.. autoclass:: compLib.Motor.Motor
|
||||
:members:
|
||||
|
||||
Genauere Informationen
|
||||
======================
|
||||
|
||||
Power vs Speed
|
||||
--------------
|
||||
Zur ansteuerung der Motoren kann entweder ``Motor.power(...)`` oder ``Motor.speed(...)`` verwendet werden.
|
||||
Der Unterschied der 2 Funktionen liegt dabei in der Einheit des 2. Parameters. Bei ``Motor.power()`` wird dabei ein Wert zwischen -100% und 100% der maximalen Geschwindigkeit angegeben.
|
||||
Im Gegensatz dazu erlaubt einem ``Motor.speed()`` eine Geschwindigkeit in Umdrehungen pro Minute.
|
||||
|
||||
Normal vs Multiple
|
||||
------------------
|
||||
Der Aufruf der funktionen kann entweder über ``Motor.power(port, percent)`` oder ``Motor.power((port, percent), (port, percent), ..)`` erfolgen.
|
||||
Der zweite Aufruf ermöglicht dem Entwickler dabei beide Motoren in einem Aufruf anzusteuern und bringt einen kleinen Vorteil in der Leistungsfähigkeit der Software.
|
||||
|
||||
|
||||
Beispiele
|
||||
=========
|
||||
|
||||
Vorwärts fahren
|
||||
-------------
|
||||
|
||||
Mit folgenden Programm drehen sich beide Motoren mit 50% ihrer maximalen Geschwindigkeit.
|
||||
Dabei ist zu beachten, dass ein Motor in die entgegengesetzte Richtung zum aneren Motor gedreht werden muss, da diese spiegelverkehrt montiert sind.
|
||||
|
||||
Zusätzlich ist ein ``time.sleep(5)`` notwendig, welches das Programm für 5 Sekunden pausiert. Diese Pause wird benötigt, da der Roboter automatisch alle Motoren beim Ende des Progammes deaktiviert.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.Motor import Motor
|
||||
import time
|
||||
|
||||
Motor.power(0, -50)
|
||||
Motor.power(3, 50)
|
||||
|
||||
time.sleep(5)
|
||||
|
BIN
client_s2/docs/source/lib/classes/images/chessboard.jpg
Normal file
BIN
client_s2/docs/source/lib/classes/images/chessboard.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
BIN
client_s2/docs/source/lib/classes/images/chessboard_detected.jpg
Normal file
BIN
client_s2/docs/source/lib/classes/images/chessboard_detected.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
client_s2/docs/source/lib/classes/images/opencv_http_stream.png
Normal file
BIN
client_s2/docs/source/lib/classes/images/opencv_http_stream.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 391 KiB |
BIN
client_s2/docs/source/lib/classes/images/opencv_processed.png
Normal file
BIN
client_s2/docs/source/lib/classes/images/opencv_processed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 KiB |
8
client_s2/docs/source/lib/index.rst
Normal file
8
client_s2/docs/source/lib/index.rst
Normal file
|
@ -0,0 +1,8 @@
|
|||
compLib
|
||||
#######
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:glob:
|
||||
|
||||
classes/*
|
32
client_s2/docs/source/other/usage.rst
Normal file
32
client_s2/docs/source/other/usage.rst
Normal file
|
@ -0,0 +1,32 @@
|
|||
.. _other_usage:
|
||||
|
||||
Beispiele
|
||||
#########
|
||||
|
||||
Vorwärts und rückwärts fahren
|
||||
*****************************
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
from compLib.Motor import *
|
||||
|
||||
def forward():
|
||||
Motor.power(1, -30);
|
||||
Motor.power(2, 30);
|
||||
|
||||
|
||||
def backward():
|
||||
Motor.power(1, 30);
|
||||
Motor.power(2, -30);
|
||||
|
||||
def main():
|
||||
print("hallo ich bin ein roboter beep buup")
|
||||
|
||||
forward()
|
||||
time.sleep(1)
|
||||
backward()
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
23
client_s2/sphinx_to_github.sh
Executable file
23
client_s2/sphinx_to_github.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
export BUILDING_DOCS=true
|
||||
cd docs || exit
|
||||
rm -rf build
|
||||
rm -rf gh-pages
|
||||
|
||||
make html
|
||||
|
||||
git clone git@github.com:F-WuTS/compLIB.git gh-pages
|
||||
|
||||
cd gh-pages || exit
|
||||
git checkout gh-pages
|
||||
|
||||
cp -r ../build/html/* .
|
||||
|
||||
git add .
|
||||
git commit -a -m "Update documentation"
|
||||
git push origin gh-pages
|
||||
|
||||
cd ..
|
||||
rm -rf gh-pages
|
||||
|
||||
cd ..
|
||||
export BUILDING_DOCS=false
|
Reference in a new issue