diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..13e9b70 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,29 @@ +name: Build and Deploy Documentation + +on: + push: + branches: + - documented + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install sphinx sphinx_rtd_theme mock + - name: Build documentation + run: | + cd ./docs + make html + - name: Deploy documentation + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/build/html \ No newline at end of file diff --git a/ddcontroller/__init__.py b/ddcontroller/__init__.py index 376f4c9..b46edbc 100644 --- a/ddcontroller/__init__.py +++ b/ddcontroller/__init__.py @@ -1,21 +1,21 @@ #!/usr/bin/env python3 -''' -This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). -Copyright (C) 2022 Daniyal Ansari -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). +# Copyright (C) 2022 Daniyal Ansari -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' from .ddcontroller import * diff --git a/ddcontroller/ddcontroller.py b/ddcontroller/ddcontroller.py index 25a8840..7731453 100644 --- a/ddcontroller/ddcontroller.py +++ b/ddcontroller/ddcontroller.py @@ -1,22 +1,22 @@ #!/usr/bin/env python3 -''' -This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). -Copyright (C) 2022 Daniyal Ansari -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). +# Copyright (C) 2022 Daniyal Ansari -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' import time import threading @@ -31,16 +31,16 @@ class DDRobot: - """Initialize a DDRobot object. + def __init__(self, config_path='/opt/ddcontroller/config/default.yaml', debug=False): - This method initializes a DDRobot object by setting up the wheels and loading the configuration from a YAML file. The robot has various attributes such as its heading, linear velocity, and global position, as well as target motion, heading, and position. The robot also has various constants such as its wheel base, maximum linear and angular velocities, and tolerance for reaching the target position. + """Initialize a DDRobot object. - Args: - config_path (str, optional): The path to the YAML configuration file. Defaults to '/opt/ddcontroller/config/default.yaml'. - debug (bool, optional): Whether to print debugging messages. Defaults to False. - """ + This method initializes a DDRobot object by setting up the wheels and loading the configuration from a YAML file. The robot has various attributes such as its heading, linear velocity, and global position, as well as target motion, heading, and position. The robot also has various constants such as its wheel base, maximum linear and angular velocities, and tolerance for reaching the target position. - def __init__(self, config_path='/opt/ddcontroller/config/default.yaml', debug=False): + Args: + config_path (str, optional): The path to the YAML configuration file. Defaults to '/opt/ddcontroller/config/default.yaml'. + debug (bool, optional): Whether to print debugging messages. Defaults to False. + """ self.config = yaml.load(open(config_path, "r", encoding="utf-8").read()) self.debug = debug @@ -141,20 +141,15 @@ def __init__(self, config_path='/opt/ddcontroller/config/default.yaml', debug=Fa self.position_controller_thread.start() # start position contoller thread # Ideally we don't start this until it's needed def sleep(self, start_time): - """Sleep for a specified amount of time. - - This method calculates the amount of time that has passed since the start time - and subtracts that from the wait time specified in the `self._wait` attribute. - If the calculated sleep time is negative, it is set to 0 instead. The method - then calls the built-in `time.sleep()` method to pause the program for the - calculated amount of time. + """Pause the execution of the current thread for a specified amount of time. Args: - start_time (int): The starting timestamp in nanoseconds. + start_time (int): The starting time of the process being measured, in nanoseconds. Returns: - float: The amount of time slept in seconds. + float: The amount of time that the thread slept, in seconds. """ + # measure time since start and subtract from sleep time sleep_time = sorted( [self._wait - ((time.monotonic_ns() - start_time) / 1e9), 0] )[1] @@ -169,8 +164,8 @@ def _odometry_loop(self): start_time = time.monotonic_ns() # record loop start time - self.left_wheel.update() # update left wheel readings - self.right_wheel.update() # update right wheel readings + self.left_wheel.update() # update left wheel readings + self.right_wheel.update() # update right wheel readings self.linear_velocity, self.angular_velocity = self.get_motion() # get robot linear and angular velocities @@ -281,10 +276,10 @@ def define_heading(self, heading): This method defines the heading of the robot by taking the arctangent of the sine and cosine of the input heading, constraining the heading to be between -pi and pi. The defined heading is then stored as an attribute of the DDRobot object and returned. Args: - heading (float): The heading of the robot in radians. + heading (float): The heading of the robot in radians. Returns: - float: The defined heading of the robot in radians, constrained to be between -pi and pi. + float: The defined heading of the robot in radians, constrained to be between -pi and pi. """ self.heading = np.arctan2(np.sin(heading), np.cos(heading)) @@ -296,11 +291,8 @@ def set_heading(self, target_heading, max_angular_velocity=None): This method sets the target heading of the robot by taking the arctangent of the sine and cosine of the input heading, constraining the heading to be between -pi and pi. The maximum angular velocity of the robot can also be set as an optional parameter. The control level of the robot is set to 2, indicating that heading control is active. Args: - target_heading (float): The target heading of the robot in radians. - max_angular_velocity (float, optional): The maximum angular velocity of the robot in radians per second. Defaults to None. - - Returns: - None + target_heading (float): The target heading of the robot in radians. + max_angular_velocity (float, optional): The maximum angular velocity of the robot in radians per second. Defaults to None. """ if max_angular_velocity: @@ -315,7 +307,7 @@ def get_heading(self): This method returns the heading of the robot as an attribute of the DDRobot object. Returns: - float: The heading of the robot in radians. + float: The heading of the robot in radians. """ return self.heading @@ -325,10 +317,10 @@ def define_global_position(self, position): This method sets the global position of the robot as an attribute of the DDRobot object. Args: - position (list): A list containing the x and y position of the robot. + position (list): A list containing the x and y position of the robot. Returns: - list: The global position of the robot. + list: The global position of the robot. """ self.global_position = position return self.global_position @@ -339,7 +331,7 @@ def get_global_position(self): This method returns the global position of the robot as an attribute of the DDRobot object. Returns: - list: The global position of the robot, as a list containing the x and y position. + list: The global position of the robot, as a list containing the x and y position. """ return self.global_position @@ -349,7 +341,7 @@ def get_linear_velocity(self): This method returns the linear velocity of the robot as an attribute of the DDRobot object. Returns: - float: The linear velocity of the robot, in meters per second. + float: The linear velocity of the robot, in meters per second. """ return self.linear_velocity @@ -359,7 +351,7 @@ def get_angular_velocity(self): This method returns the angular velocity of the robot as an attribute of the DDRobot object. Returns: - float: The angular velocity of the robot, in radians per second. + float: The angular velocity of the robot, in radians per second. """ return self.angular_velocity @@ -392,8 +384,7 @@ def set_angular_velocity(self, angular_velocity): return self.target_motion def set_motion(self, target_motion): - """ - Set the target linear and angular velocities for the robot. + """Set the target linear and angular velocities for the robot. Args: target_motion (list): A list containing the target linear velocity (m/s) as the first element @@ -426,8 +417,7 @@ def set_motion(self, target_motion): return C def get_motion(self): - """ - Calculate and return the current linear and angular velocities of the robot. + """Calculate and return the current linear and angular velocities of the robot. Returns: list: A list of two floats, representing the linear and angular velocities of the robot, in that order. @@ -458,8 +448,7 @@ def get_motion(self): return [self.linear_velocity, self.angular_velocity] def go_to(self, target_position, tolerance=0.1, max_linear_velocity=None, max_angular_velocity=None, backwards=False): - """ - Moves the robot to the specified target position using a position controller. + """Moves the robot to the specified target position using a position controller. The robot will continue to move towards the target position until it is within the specified tolerance. Args: diff --git a/ddcontroller/motor.py b/ddcontroller/motor.py index 0b14bff..668ce6d 100644 --- a/ddcontroller/motor.py +++ b/ddcontroller/motor.py @@ -1,42 +1,44 @@ #!/usr/bin/env python3 -''' -This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). -Copyright (C) 2022 Daniyal Ansari -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). +# Copyright (C) 2022 Daniyal Ansari -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' import RPi.GPIO as GPIO GPIO.setwarnings(False) class Motor: - """Class for controlling a motor using the Raspberry Pi's GPIO pins. - - Args: - pins (list): A list of the GPIO pins that will be used to control the motor. - pwm_frequency (int): The frequency of the pulse width modulation (PWM) signal - that will be used to control the motor. - initial_duty (int, optional): The initial duty cycle of the PWM signal. Defaults to 0. - decay_mode (str, optional): The decay mode of the motor. Can be either "FAST" or - "SLOW". Defaults to "FAST". - invert (bool, optional): A boolean value indicating whether the motor's direction - should be reversed. Defaults to False. - rpm (int, optional): The speed of the motor in rotations per minute. Defaults to 200. - """ def __init__(self, pins, pwm_frequency, initial_duty=0, decay_mode='FAST', invert=False, rpm=200): + + """Class for controlling a motor using the Raspberry Pi's GPIO pins. + + Args: + pins (list): A list of the GPIO pins that will be used to control the motor. + pwm_frequency (int): The frequency of the pulse width modulation (PWM) signal + that will be used to control the motor. + initial_duty (int, optional): The initial duty cycle of the PWM signal. Defaults to 0. + decay_mode (str, optional): The decay mode of the motor. Can be either "FAST" or + "SLOW". Defaults to "FAST". + invert (bool, optional): A boolean value indicating whether the motor's direction + should be reversed. Defaults to False. + rpm (int, optional): The speed of the motor in rotations per minute. Defaults to 200. + """ + self.pins = pins self._pins = [] diff --git a/ddcontroller/wheels.py b/ddcontroller/wheels.py index 4a5e2bd..ffb9c92 100644 --- a/ddcontroller/wheels.py +++ b/ddcontroller/wheels.py @@ -1,22 +1,22 @@ #!/usr/bin/env python3 -''' -This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). -Copyright (C) 2022 Daniyal Ansari -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This file is part of the ddcontroller library (https://github.com/ansarid/ddcontroller). +# Copyright (C) 2022 Daniyal Ansari -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' import time import numpy as np @@ -28,46 +28,6 @@ class Wheel: - """A class for representing and controlling a single wheel. - - This class represents a single wheel, including its motor and encoder, and provides methods for controlling the speed of the motor and calculating the rotation and linear velocity of the wheel. - - Attributes: - closed_loop (bool): A flag indicating whether closed loop control should be used to control the motor. - motor (Motor): An instance of the Motor class representing the motor driving the wheel. - encoder (AS5048B): An instance of the AS5048B class representing the encoder attached to the wheel. - pid (PID): An instance of the PID class representing the PID controller used for closed loop control. - radius (float): The radius of the wheel, in meters. - pulley_ratio (float): The ratio of the number of teeth on the motor pulley to the number of teeth on the wheel pulley. - rpm (float): The rotational speed of the motor, in revolutions per minute. - max_angular_velocity (float): The maximum angular velocity of the wheel, in radians per second, based on the maximum RPM of the motor. - target_angular_velocity (float): The target angular velocity of the system, in radians per second, used to control the motor. - position (int): The raw encoder position of the wheel, in ticks. - timestamp (int): The timestamp of the last measurement of the encoder position, in nanoseconds. - target_velocity (float): The target linear velocity of the wheel, in meters per second. - angular_velocity (float): The current angular velocity of the wheel, in radians per second. - linear_velocity (float): The current linear velocity of the wheel, in meters per second. - rollover_limit (int): The limit at which the encoder position will rollover, in ticks. - _positions (deque): A deque object containing the last two encoder positions of the wheel, in ticks. - _timestamps (deque): A deque object containing the timestamps of the last two encoder position measurements, in nanoseconds. - - Args: - motor_pins (tuple): A tuple containing the pins of the motor driver connected to the motor. - pwm_frequency (int): The frequency of the pulse width modulation used to control the motor, in hertz. - i2c_bus (int): The number of the I2C bus on which the encoder is connected. - encoder_address (int): The I2C address of the encoder. - wheel_radius (float): The radius of the wheel, in meters. - motor_pulley_teeth (int): The number of teeth on the pulley attached to the motor shaft. - wheel_pulley_teeth (int): The number of teeth on the pulley attached to the wheel hub. - motor_decay_mode (str, optional): The decay mode of the motor. Can be 'FAST' or 'SLOW'. Defaults to 'FAST'. - invert_motor (bool, optional): A flag indicating whether the motor should be inverted. Defaults to False. - invert_encoder (bool, optional): A flag indicating whether the encoder readings should be inverted. Defaults to False. - closed_loop (bool, optional): A flag indicating whether closed loop control should be used to control the motor. Defaults to False. - Kp (int, optional): The proportional gain of the PID controller. Defaults to 0. - Ki (int, optional): The integral gain of the PID controller. Defaults to 0. - Kd (int, optional): The derivative gain of the PID controller. Defaults to 0. - """ - def __init__( self, motor_pins, @@ -86,6 +46,47 @@ def __init__( Kd=0, ): + """A class for representing and controlling a single wheel. + + This class represents a single wheel, including its motor and encoder, and provides methods for controlling the speed of the motor and calculating the rotation and linear velocity of the wheel. + + Attributes: + closed_loop (bool): A flag indicating whether closed loop control should be used to control the motor. + motor (Motor): An instance of the Motor class representing the motor driving the wheel. + encoder (AS5048B): An instance of the AS5048B class representing the encoder attached to the wheel. + pid (PID): An instance of the PID class representing the PID controller used for closed loop control. + radius (float): The radius of the wheel, in meters. + pulley_ratio (float): The ratio of the number of teeth on the motor pulley to the number of teeth on the wheel pulley. + rpm (float): The rotational speed of the motor, in revolutions per minute. + max_angular_velocity (float): The maximum angular velocity of the wheel, in radians per second, based on the maximum RPM of the motor. + target_angular_velocity (float): The target angular velocity of the system, in radians per second, used to control the motor. + position (int): The raw encoder position of the wheel, in ticks. + timestamp (int): The timestamp of the last measurement of the encoder position, in nanoseconds. + target_velocity (float): The target linear velocity of the wheel, in meters per second. + angular_velocity (float): The current angular velocity of the wheel, in radians per second. + linear_velocity (float): The current linear velocity of the wheel, in meters per second. + rollover_limit (int): The limit at which the encoder position will rollover, in ticks. + _positions (deque): A deque object containing the last two encoder positions of the wheel, in ticks. + _timestamps (deque): A deque object containing the timestamps of the last two encoder position measurements, in nanoseconds. + + Args: + motor_pins (tuple): A tuple containing the pins of the motor driver connected to the motor. + pwm_frequency (int): The frequency of the pulse width modulation used to control the motor, in hertz. + i2c_bus (int): The number of the I2C bus on which the encoder is connected. + encoder_address (int): The I2C address of the encoder. + wheel_radius (float): The radius of the wheel, in meters. + motor_pulley_teeth (int): The number of teeth on the pulley attached to the motor shaft. + wheel_pulley_teeth (int): The number of teeth on the pulley attached to the wheel hub. + motor_decay_mode (str, optional): The decay mode of the motor. Can be 'FAST' or 'SLOW'. Defaults to 'FAST'. + invert_motor (bool, optional): A flag indicating whether the motor should be inverted. Defaults to False. + invert_encoder (bool, optional): A flag indicating whether the encoder readings should be inverted. Defaults to False. + closed_loop (bool, optional): A flag indicating whether closed loop control should be used to control the motor. Defaults to False. + Kp (int, optional): The proportional gain of the PID controller. Defaults to 0. + Ki (int, optional): The integral gain of the PID controller. Defaults to 0. + Kd (int, optional): The derivative gain of the PID controller. Defaults to 0. + """ + + self.closed_loop = closed_loop self.motor = motor.Motor( @@ -154,7 +155,7 @@ def get_rotation(self): This method calculates and returns the rotation of the wheel, in ticks, based on the positions of the encoder at two different points in time. It also accounts for rollover, where the encoder position resets after reaching a certain value. The rotation is calculated by taking the difference between the encoder positions and applying a pulley ratio to convert from motor pulley rotation to wheel rotation. Returns: - int: The rotation of the wheel, in ticks. + int: The rotation of the wheel, in ticks. """ rotation = ( @@ -179,7 +180,7 @@ def get_travel(self): # calculate travel of the wheel in meters This method calculates and returns the distance traveled by the wheel, in meters, based on the rotation of the wheel and the radius of the wheel. Returns: - float: The distance traveled by the wheel. + float: The distance traveled by the wheel. """ # get wheel rotation between measurements @@ -195,7 +196,7 @@ def get_linear_velocity(self): # get wheel linear velocity This method calculates and returns the current linear velocity of the wheel, in meters per second, based on the distance traveled by the wheel and the elapsed time between measurements. Returns: - float: The current linear velocity of the wheel. + float: The current linear velocity of the wheel. """ distance = self.get_travel() # get wheel travel # calculate delta_time, convert from ns to s @@ -210,7 +211,7 @@ def get_angular_velocity(self): This method calculates and returns the current angular velocity of the wheel, in radians per second, based on the rotation of the wheel and the elapsed time between measurements. Returns: - float: The current angular velocity of the wheel. + float: The current angular velocity of the wheel. """ # get wheel rotation between measurements @@ -229,7 +230,7 @@ def set_angular_velocity(self, angular_velocity): This method sets the target angular velocity of the wheel, which is used to control the speed of the motor. The motor's duty cycle is adjusted based on the target angular velocity, using either open loop or closed loop control. Args: - angular_velocity (float): The target angular velocity to set, in radians per second. + angular_velocity (float): The target angular velocity to set, in radians per second. """ self.target_angular_velocity = angular_velocity diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..773fbc9 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,28 @@ +# 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 +SPHINXPROJ = DDController +SOURCEDIR = . +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) + +# Build the documentation +html: + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +clean: + rm -rf "$(BUILDDIR)" \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..cb9d6e1 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,39 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +import os +import sys +sys.path.insert(0, os.path.abspath("..")) + +project = 'DDController' +copyright = '2022, Daniyal Ansari' +author = 'Daniyal Ansari' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.viewcode', +] + +autodoc_mock_imports = ['mock', 'RPi.GPIO', 'as5048b'] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] diff --git a/docs/ddcontroller.rst b/docs/ddcontroller.rst new file mode 100644 index 0000000..11ad258 --- /dev/null +++ b/docs/ddcontroller.rst @@ -0,0 +1,37 @@ +ddcontroller package +==================== + +Submodules +---------- + +ddcontroller.ddcontroller module +-------------------------------- + +.. automodule:: ddcontroller.ddcontroller + :members: + :undoc-members: + :show-inheritance: + +ddcontroller.motor module +------------------------- + +.. automodule:: ddcontroller.motor + :members: + :undoc-members: + :show-inheritance: + +ddcontroller.wheels module +-------------------------- + +.. automodule:: ddcontroller.wheels + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: ddcontroller + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..dc2ff91 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. DDController documentation master file, created by + sphinx-quickstart on Sat Dec 31 10:09:28 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to DDController's documentation! +======================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + modules + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%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.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..79b0831 --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,7 @@ +ddcontroller +============ + +.. toctree:: + :maxdepth: 4 + + ddcontroller diff --git a/docs/setup.rst b/docs/setup.rst new file mode 100644 index 0000000..552eb49 --- /dev/null +++ b/docs/setup.rst @@ -0,0 +1,7 @@ +setup module +============ + +.. automodule:: setup + :members: + :undoc-members: + :show-inheritance: