Skip to content

Commit

Permalink
Merge pull request #1 from AleksandarPetrov/master19
Browse files Browse the repository at this point in the history
Docs updates
  • Loading branch information
gibernas authored Aug 1, 2019
2 parents ea7d967 + b923abd commit b0165d0
Show file tree
Hide file tree
Showing 43 changed files with 596 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/build
*pyc
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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) -T $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -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
124 changes: 124 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# 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:
# http://www.sphinx-doc.org/en/master/config

# -- 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.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../../packages/'))
print(sys.path)


# -- Project information -----------------------------------------------------

project = 'duckiebot-interface'
copyright = '2019, Duck Quackermann'
author = 'Duck Quackermann'

# The full version, including alpha/beta/rc tags
release = '0.0.1'


# -- General configuration ---------------------------------------------------


# Napoleon (for Google-style docstrings)
extensions = ['sphinxcontrib.napoleon']

# Autodocs
extensions += ['sphinx.ext.autodoc']


# Add intersphynx to connect with the base ROS
# extensions += ['sphinx.ext.intersphinx']
# intersphinx_mapping = {'ros':
# ('http://otamachan.github.io/sphinxros/indigo/', None)}

# Autodocs Configuration
with open('mock_imports') as f:
autodoc_mock_imports = f.readlines()
for idx in range(len(autodoc_mock_imports)):
autodoc_mock_imports[idx] = autodoc_mock_imports[idx].strip(' ').strip('\n')
print(autodoc_mock_imports)

autodoc_default_flags = {'members': True,
'member-order': 'bysource',
'undoc-members': True}

# Napoleon settings
napoleon_google_docstring = True
napoleon_numpy_docstring = False
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
napoleon_use_ivar = False
napoleon_use_param = False
napoleon_use_rtype = True
napoleon_use_keyword = True
napoleon_custom_sections = [('Subscribers', 'Parameters'),
('Subscriber', 'Parameters'),
('Publishers', 'Parameters'),
('Publisher', 'Parameters'),
('Services', 'Parameters'),
('Service', 'Parameters')
]


# 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 = []

# Set the index page
master_doc = 'index'

# -- 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'

html_theme_options = {
# 'canonical_url': '',
# 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
# 'logo_only': False,
# 'display_version': True,
'prev_next_buttons_location': 'bottom',
# 'style_external_links': False,
# 'vcs_pageview_mode': '',
'style_nav_header_background': '#fbc10b',
# Toc options
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': False,
'titles_only': False,
# 'github_url': True
}

html_logo = "logo_textonly.png"
html_favicon = "favicon.png"
# html_style = 'dt_style.css'



# 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']
5 changes: 5 additions & 0 deletions docs/source/dt_style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import 'theme.css'

p.caption, h1, h2 {
color: #f14720;
}
Binary file added docs/source/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. duckiebot-interface documentation master file, created by
sphinx-quickstart on Fri Jul 19 20:26:50 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to duckiebot-interface's documentation!
===============================================

.. toctree::
:maxdepth: 2
:caption: Contents:

packages



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Binary file added docs/source/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/logo_textonly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions docs/source/mock_imports
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cv2
numpy
rospy
Adafruit_PWM_Servo_Driver
camera_driver
sensor_msgs
cv_bridge
picamera
thread
yaml
duckietown_msgs
wheels_driver
Adafruit_MotorHAT
yaml
std_msgs
led_emitter.srv
Adafruit_GPIO
Adafruit_I2C
8 changes: 8 additions & 0 deletions docs/source/packages.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Packages
========

.. toctree::
:glob:
:maxdepth: 4

packages/*
4 changes: 4 additions & 0 deletions docs/source/packages/adafruit_drivers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
adafruit\_drivers package
=========================

.. automodule:: adafruit_drivers
4 changes: 4 additions & 0 deletions docs/source/packages/camera_driver.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
camera\_driver package
======================

.. automodule:: camera_driver
6 changes: 6 additions & 0 deletions docs/source/packages/led_emitter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
led\_emitter package
====================

.. automodule:: led_emitter


4 changes: 4 additions & 0 deletions docs/source/packages/rgb_led.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rgb\_led package
================

.. automodule:: rgb_led
4 changes: 4 additions & 0 deletions docs/source/packages/wheels_driver.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wheels\_driver package
======================

.. automodule:: wheels_driver
20 changes: 20 additions & 0 deletions packages/adafruit_drivers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
The `adafruit_driver` package blablabla
.. contents::
Quick start
-----------
TODO: WRITE STUFF
Included libraries
------------------
.. automodule:: adafruit_drivers.include
"""

from .include import *
11 changes: 10 additions & 1 deletion packages/adafruit_drivers/include/Adafruit_GPIO/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
Adafruit_GPIO
-------------
.. automodule:: adafruit_drivers.include.Adafruit_GPIO.GPIO
:show-inheritance:
"""

from __future__ import absolute_import

from Adafruit_GPIO.GPIO import *
from .GPIO import *
16 changes: 8 additions & 8 deletions packages/adafruit_drivers/include/Adafruit_I2C/Adafruit_I2C.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def write8(self, reg, value):
try:
self.bus.write_byte_data(self.address, reg, value)
if self.debug:
print "I2C: Wrote 0x%02X to register 0x%02X" % (value, reg)
print ("I2C: Wrote 0x%02X to register 0x%02X" % (value, reg))
except IOError, err:
return self.errMsg()

Expand All @@ -81,16 +81,16 @@ def writeRaw8(self, value):
try:
self.bus.write_byte(self.address, value)
if self.debug:
print "I2C: Wrote 0x%02X" % value
print ("I2C: Wrote 0x%02X" % value)
except IOError, err:
return self.errMsg()

def writeList(self, reg, list):
"Writes an array of bytes using I2C format"
try:
if self.debug:
print "I2C: Writing list to register 0x%02X:" % reg
print list
print ("I2C: Writing list to register 0x%02X:" % reg)
print (list)
self.bus.write_i2c_block_data(self.address, reg, list)
except IOError, err:
return self.errMsg()
Expand All @@ -102,7 +102,7 @@ def readList(self, reg, length):
if self.debug:
print ("I2C: Device 0x%02X returned the following from reg 0x%02X" %
(self.address, reg))
print results
print (results)
return results
except IOError, err:
return self.errMsg()
Expand Down Expand Up @@ -139,7 +139,7 @@ def readU16(self, reg, little_endian=True):
if not little_endian:
result = ((result << 8) & 0xFF00) + (result >> 8)
if (self.debug):
print "I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % (self.address, result & 0xFFFF, reg)
print ("I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % (self.address, result & 0xFFFF, reg))
return result
except IOError, err:
return self.errMsg()
Expand All @@ -156,6 +156,6 @@ def readS16(self, reg, little_endian=True):
if __name__ == '__main__':
try:
bus = Adafruit_I2C(address=0)
print "Default I2C bus is accessible"
print ("Default I2C bus is accessible")
except:
print "Error accessing default I2C bus"
print ("Error accessing default I2C bus")
8 changes: 8 additions & 0 deletions packages/adafruit_drivers/include/Adafruit_I2C/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
"""
Adafruit_I2C
------------
.. automodule:: adafruit_drivers.include.Adafruit_I2C
"""

from .Adafruit_I2C import Adafruit_I2C
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
"""
Adafruit_MotorHAT
-----------------
.. automodule:: adafruit_drivers.include.Adafruit_MotorHAT
"""

from .Adafruit_MotorHAT import Adafruit_StepperMotor, Adafruit_DCMotor, Adafruit_MotorHAT

Loading

0 comments on commit b0165d0

Please sign in to comment.