Skip to content
Snippets Groups Projects
Commit 2e7a4561 authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Merge branch 'develop'

Patches master to version v0.3-rc.7
parents 2c7d8b0c a34ebf7f
No related branches found
No related tags found
No related merge requests found
Showing
with 1187 additions and 171 deletions
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " epub3 to make an epub3"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
@echo " dummy to check syntax errors of document sources"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MindstormsEV3Toolbox.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MindstormsEV3Toolbox.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/MindstormsEV3Toolbox"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MindstormsEV3Toolbox"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: epub3
epub3:
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
@echo
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
.PHONY: dummy
dummy:
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
@echo
@echo "Build finished. Dummy builder generates no files."
# -*- coding: utf-8 -*-
#
# Mindstorms EV3 Toolbox documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 25 15:42:28 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# 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('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# 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.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.matlab',
'sphinx.ext.napoleon'
]
# MATLAB extension settings
matlab_src_dir = os.path.abspath('..')
primary_domain = 'mat'
#autoclass_content = 'init'
#autodoc_member_order = 'groupwise'
#autodoc_default_flags = ''
# 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 = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True
napoleon_use_keyword = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Mindstorms EV3 Toolbox'
copyright = u'2016, Tim Stadtmann'
author = u'Tim Stadtmann'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'v0.3'
# The full version, including alpha/beta/rc tags.
release = u'v0.3-rc.6'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '*hidapi*', '*.dll', '*.dylib', '*proto*', '*.h', '*.lib', '*.exp', 'ID.m', 'include', 'lib', 'private', '*.class', '*.java*', '*_*']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- 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 = 'classic'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'Mindstorms EV3 Toolbox vv0.3-rc.6'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# 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']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'MindstormsEV3Toolboxdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MindstormsEV3Toolbox.tex', u'Mindstorms EV3 Toolbox Documentation',
u'Tim Stadtmann', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It false, will not define \strong, \code, itleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'mindstormsev3toolbox', u'Mindstorms EV3 Toolbox Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MindstormsEV3Toolbox', u'Mindstorms EV3 Toolbox Documentation',
author, 'MindstormsEV3Toolbox', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False
.. source documentation master file, created by
sphinx-quickstart on Fri Nov 25 16:05:22 2016.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
EV3-Toolbox for controlling Lego Mindstorms EV3 with MATLAB
===========================================================
Contents:
.. toctree::
:maxdepth: 4
source
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. epub3 to make an epub3
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
echo. dummy to check syntax errors of document sources
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 1>NUL 2>NUL
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 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
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\MindstormsEV3Toolbox.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\MindstormsEV3Toolbox.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "epub3" (
%SPHINXBUILD% -b epub3 %ALLSPHINXOPTS% %BUILDDIR%/epub3
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub3 file is in %BUILDDIR%/epub3.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
if "%1" == "dummy" (
%SPHINXBUILD% -b dummy %ALLSPHINXOPTS% %BUILDDIR%/dummy
if errorlevel 1 exit /b 1
echo.
echo.Build finished. Dummy builder generates no files.
goto end
)
:end
.. automodule:: source
EV3
---
.. autoclass:: EV3
:members:
Motor
-----
.. autoclass:: Motor
:members: start, stop, syncedStart, syncedStop, waitFor, internalReset, resetTachoCount, setBrake, setProperties
Sensor
------
.. autoclass:: Sensor
:members: reset, setProperties
classdef Motor < MaskedHandle & dynamicprops
% Motor High-level class to work with motors.
% High-level class to work with motors.
%
% This class is supposed to ease the use of the brick's motors. It is possible to set all
% kinds of parameters, request the current status of the motor ports and of course send
......@@ -8,115 +8,169 @@ classdef Motor < MaskedHandle & dynamicprops
% Notes:
% * You don't need to create instances of this class. The EV3-class automatically creates
% instances for each motor port, and you can work with them via the EV3-object.
% * The Motor-class represents motor ports, not individual motors!
%
%
% Signature
% Author: Tim Stadtmann
% Date: 2016/05/19
% Updated: 2016/08/15
% Attributes:
% power (numeric in [-100, 100]): Power level of motor in percent. [WRITABLE]
% speedRegulation (bool): Speed regulation turned on or off. When turned on, motor will
% try to 'hold' its speed at given power level, whatever the load. In this mode, the
% highest possible speed depends on the load and mostly goes up to around 70-80 (at
% this point, the Brick internally input 100% power). When turned off, motor will
% constantly input the same power into the motor. The resulting speed will be
% somewhat lower, depending on the load. [WRITABLE]
% smoothStart (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly start. Depending on limitMode,
% the input is interpreted either in degrees or milliseconds. The first
% {smoothStart}-milliseconds/degrees of limitValue the motor will slowly accelerate
% until reaching its defined speed. [WRITABLE]
% smoothStop (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly stop. Depending on limitMode, the
% input is interpreted either in degrees or milliseconds. The last
% [smoothStop]-milliseconds/degrees of limitValue the motor will slowly slow down
% until it has stopped. [WRITABLE]
% limitValue (numeric>=0): Degrees/Time indicating how far/long the motor should run.
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. [WRITABLE]
% limitMode ('Tacho'|'Time'): Mode for motor limit. [WRITABLE]
% brakeMode ('Brake'|'Coast'): Mode for braking. If 'Coast', the motor will (at
% tacholimit, if ~=0) coast to a stop. If 'Brake', the motor will stop immediately
% (at tacholimit, if ~=0) and hold the brake. [WRITABLE]
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
% isRunning (bool): True if motor is running. [READ-ONLY]
% tachoCount (numeric): Current tacho count. [READ-ONLY]
% currentSpeed (numeric): Current speed of motor. If speedRegulation=on this should equal power,
% otherwise it will probably be lower than that. [READ-ONLY]
% type (DeviceType): Type of connected device if any. [READ-ONLY]
properties % Standard properties to be set by user
%power - [Writable] Power level of motor in percent (numeric in [-100, 100])
% power (numeric in [-100, 100]): Power level of motor in percent. [WRITABLE]
power;
%speedRegulation - [Writable] Speed regulation turned on or off (0/1/off/on/'false'/'true')
% When turned on, motor will try to 'hold' its speed at given power level, whatever the
% load. In this mode, the highest possible speed depends on the load and mostly goes up
% to around 70-80 (at this point, the Brick internally input 100% power).
% When turned off, motor will constantly input the same power into the motor. The
% resulting speed will be somewhat lower, depending on the load.
% speedRegulation (bool): Speed regulation turned on or off. When turned on, motor will
% try to 'hold' its speed at given power level, whatever the load. In this mode, the
% highest possible speed depends on the load and mostly goes up to around 70-80 (at
% this point, the Brick internally input 100% power). When turned off, motor will
% constantly input the same power into the motor. The resulting speed will be
% somewhat lower, depending on the load. [WRITABLE]
speedRegulation;
%smoothStart - [Writable] Degrees/Time indicating how far/long the motor should smoothly start (numeric such that smoothStart+smoothStop < limitValue)
% Depending on limitMode, the input is interpreted either in degrees or milliseconds.
% The first [smoothStart]-milliseconds/degrees of limitValue the motor will slowly
% accelerate until reaching it's defined speed.
% See also MOTOR.LIMITMODE
% smoothStart (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly start. Depending on limitMode,
% the input is interpreted either in degrees or milliseconds. The first
% {smoothStart}-milliseconds/degrees of limitValue the motor will slowly accelerate
% until reaching its defined speed. [WRITABLE]
smoothStart;
%smoothStop - [Writable] Degrees/Time indicating how far/long the motor should smoothly stop (numeric such that smoothStart+smoothStop < limitValue)
% Depending on limitMode, the input is interpreted either in degrees or milliseconds.
% The last [smoothStop]-milliseconds/degrees of limitValue the motor will slowly
% slow down until it has stopped.
% See also MOTOR.LIMITMODE
% smoothStop (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly stop. Depending on limitMode, the
% input is interpreted either in degrees or milliseconds. The last
% [smoothStop]-milliseconds/degrees of limitValue the motor will slowly slow down
% until it has stopped. [WRITABLE]
smoothStop;
%limitValue - [Writable] Degrees/Time indicating how far/long the motor should run (numeric>=0)
% Depending on limitMode, the input is interpreted either in degrees or milliseconds.
% limitValue (numeric>=0): Degrees/Time indicating how far/long the motor should run.
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. [WRITABLE]
% See also MOTOR.LIMITMODE
limitValue;
%limitMode - [Writable] Mode for motor limit ('Tacho'/'Time')
% limitMode ('Tacho'|'Time'): Mode for motor limit. [WRITABLE]
% See also MOTOR.SMOOTHSTART, MOTOR.SMOOTHSTOP, MOTOR.LIMITMODE
limitMode;
%brakeMode - [Writable] Mode for braking ('Brake'/'Coast')
% If 'Coast', the motor will (at tacholimit, if ~=0) coast to a stop. If
% 'Brake', the motor will stop immediately (at tacholimit, if ~=0) and hold the brake.
% brakeMode ('Brake'|'Coast'): Mode for braking. If 'Coast', the motor will (at
% tacholimit, if ~=0) coast to a stop. If 'Brake', the motor will stop immediately
% (at tacholimit, if ~=0) and hold the brake. [WRITABLE]
brakeMode;
%debug - [Writable] Debug turned on or off (0/1/off/on/'false'/'true')
% In debug mode, everytime a command is passed to the sublayer ('communication layer'),
% there is feedback in the console about what command has been called
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
debug;
end
properties (Dependent) % Read-only parameters to be read directly from physical brick
%isRunning - [Read-only] True if motor is running (i.e. speed > 0)
% isRunning (bool): True if motor is running. [READ-ONLY]
isRunning;
%tachoCount - [Read-only] Current tacho count
% tachoCount (numeric): Current tacho count. [READ-ONLY]
tachoCount;
%currentSpeed - [Read-only] Current speed of motor
% If speedRegulation=on this should equal power, otherwise it will probably be lower
% than that.
% currentSpeed (numeric): Current speed of motor. If speedRegulation=on this should
% equal power, otherwise it will probably be lower than that. [READ-ONLY]
% See also MOTOR.SPEEDREGULATION
currentSpeed;
%type - [Read-only] Type of connected device if any
% See also DEVICETYPE
% type (DeviceType): Type of connected device if any. [READ-ONLY]
type;
end
properties (Hidden, Access = 'private') % Hidden properties for internal use only
commInterface; % Communication interface
properties (Hidden, Access = private) % Hidden properties for internal use only
% commInterface (CommunicationInterface): Commands are created and sent via the
% communication interface class.
commInterface;
%% Hidden brick parameters
%port - [Read-only] Motor port
% This is only the string representation of the motor port to work with.
% Internally, either MotorPort-, MotorBitfield- or MotorInput-member will be used.
% port (string): Motor port. This is only the string representation of the motor port
% to work with. Internally, either MotorPort-, MotorBitfield- or MotorInput-member
% will be used.
port;
% brakeMode_ (BrakeMode): Byte value, corresponding to brakeMode, that will be sent to the brick
% brakeMode is an actual parameter on the brick. To avoid inconsistencies with other
% modi and to prettify the output, a string representing it is saved. In order to avoid
% using string comparisons each time it is used, the corresponding value, that is going
% to be sent, is saved (hidden from the user).
% See also BRAKEMODE
brakeMode_;
%% Flags
init = true; % Indicates 'init-phase' (True as long as constructor is running)
connectedToBrick = false; % Connection to physical Brick?
state = MotorState(); % State consisting of several special Motor-flags
% init (bool): Indicates init-phase (i.e. constructor is running).
init = true;
% connectedToBrick (bool): True if virtual brick is connected to physical brick.
connectedToBrick = false;
% state (MotorState): State-struct consisting of several special Motor-flags
% See also MOTORSTATE
state = MotorState();
end
properties (Hidden, Dependent, Access = 'private') % Hidden, dependent properties for internal use only
portNo; % Port number
portInput; % Port number for input functions
properties (Hidden, Dependent, Access = private) % Hidden, dependent properties for internal use only
% portNo (PortNo): Internal number of motor port.
% * Port 'A': 0
% * Port 'B': 1
% * Port 'C': 2
% * Port 'D': 3
% See also PORTNO
portNo;
%portInput (PortInput): Internal number of motor port if accessed via input-opCodes
% * Port 'A': 16
% * Port 'B': 17
% * Port 'C': 18
% * Port 'D': 19
% See also PORTINPUT
portInput;
isSynced; % Is motor running in synced mode?
physicalMotorConnected; % Physical motor connected to this port?
%isSynced (bool): True if motor is running in synced mode
isSynced;
internalTachoCount; % Internal tachocount used for positioning the motor with tacholimit
%physicalMotorConnected (bool): True if physical motor is connected to this port
physicalMotorConnected;
%internalTachoCount (numeric): internal tacho counter used for positioning the motor with a limit
internalTachoCount;
end
methods % Standard methods
%% Constructor
function motor = Motor(varargin)
%Motor Sets properties of Motor-object and indicates end of init-phase when it's done.
%Motor Sets properties of Motor-object and indicates end of init-phase when it's done
%
% Arguments
% * varargin: see EV3::setProperties(ev3, varargin)
% Arguments:
% * varargin: see setProperties(motor, varargin)
%
motor.setProperties(varargin{:});
......@@ -125,9 +179,9 @@ classdef Motor < MaskedHandle & dynamicprops
%% Brick functions
function start(motor)
%start Starts the motor
% Starts the motor
%
% Notes
% Notes:
% * Right now, alternatingly calling this function with and without tacho limit
% may lead to unexpected behaviour. For example, if you run the motor without
% a tacholimit for some time using Coast, then stop using Coast, and then try
......@@ -271,7 +325,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function stop(motor)
%stop Stops the motor
% Stops the motor
if ~motor.connectedToBrick
error('Motor::stop: Motor-Object not connected to comm handle.');
......@@ -293,7 +347,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function syncedStart(motor, syncMotor, varargin)
%syncedStart Starts this motor synchronized with another
% Starts this motor synchronized with another
% This motor acts as a 'master', meaning that the synchronized control is done via
% this one. When syncedStart is called, the master sets some of the slave's
% (syncMotor) properties to keep it consistent with the physical brick. So, for
......@@ -302,26 +356,27 @@ classdef Motor < MaskedHandle & dynamicprops
% The following parameters will be affected on the slave: power, brakeMode,
% limitValue, speedRegulation
%
% Arguments
% * syncMotor (the other motor object to sync with)
% * 'turnRatio', numeric in [-200,200]
%
% Notes
% * Description of turn_ratio (Excerpt of Firmware-comments, in c_output.c):
% "Turn ratio is how tight you turn and to what direction you turn.
% -> 0 value is moving straight forward
% -> Negative values turn to the left
% -> Positive values turn to the right
% -> Value -100 stops the left motor
% -> Value +100 stops the right motor
% -> Values less than -100 makes the left motor run the opposite
% Arguments:
% syncMotor (Motor): the motor-object to sync with
% turnRatio (numeric in [-200,200]): Description of turn_ratio (Excerpt of Firmware-comments, in c_output.c):
% "Turn ratio is how tight you turn and to what direction you turn. [OPTIONAL]
% * 0 value is moving straight forward
% * Negative values turn to the left
% * Positive values turn to the right
% * Value -100 stops the left motor
% * Value +100 stops the right motor
% * Values less than -100 makes the left motor run the opposite
% direction of the right motor (Spin)
% -> Values greater than +100 makes the right motor run the opposite
% * Values greater than +100 makes the right motor run the opposite
% direction of the left motor (Spin)"
%
% Notes:
% * This is right now a pretty 'heavy' function, as it tests if both motors are
% connected AND aren't running, wasting four packets, so keep that in mind
% connected AND aren't running, wasting four packets, keep that in mind
% * It is necessary to call syncedStop() and not stop() for stopping the motors
% (otherwise the sync-state cannot be exited correctly)
%
% Example
% Example:
% b = EV3(); b.connect('usb');
% m = b.motorA;
% m.power = 50;
......@@ -420,7 +475,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function syncedStop(motor)
%syncedStop Stops both motors previously started with syncedStart
% Stops both motors previously started with syncedStart.
% Obviously, if motors have not been started synchronized, this throws an error.
%
% See also MOTOR.SYNCEDSTART
......@@ -471,7 +526,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function waitFor(motor)
%waitFor Stops execution of program as long as motor is running
% Stops execution of program as long as motor is running
%
% Notes:
% * (OLD)This one's a bit tricky. The opCode OutputReady makes the brick stop sending
......@@ -529,7 +584,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function internalReset(motor)
% internalReset Resets internal tacho count
% Resets internal tacho count
% Use this if motor behaves weird (i.e. not starting at all, or not correctly
% running to limitValue)
%
......@@ -559,6 +614,8 @@ classdef Motor < MaskedHandle & dynamicprops
end
function resetTachoCount(motor)
% Resets tachocount
if ~motor.connectedToBrick
error('Motor::resetTachoCount: Motor-Object not connected to comm handle.');
elseif ~motor.physicalMotorConnected
......@@ -575,10 +632,10 @@ classdef Motor < MaskedHandle & dynamicprops
end
function setBrake(motor, brake)
%setBrake Apply or release brake of motor
% Apply or release brake of motor
%
% Arguments
% * brake (0/1/off/on/'false'/'true')
% Arguments:
% brake (bool): If true, brake will be pulled
if ~isBool(brake)
error('Motor::setBrake: Given parameter is not a valid bool.');
......@@ -736,20 +793,20 @@ classdef Motor < MaskedHandle & dynamicprops
end
function setProperties(motor, varargin)
%setProperties Sets multiple Motor properties at once using MATLAB's inputParser.
% Sets multiple Motor properties at once using MATLAB's inputParser.
%
% Arguments
% * 'debug', bool
% * 'smoothStart', numeric in [0, limitValue]
% * 'smoothStop', numeric in [0, limitValue]
% * 'speedRegulation', bool
% * 'brakeMode', 'Coast'/'Brake'
% * 'limitMode', 'Time'/'Tacho'
% * 'limitValue', numeric > 0
% * 'power', numeric in [-100,100]
% * 'batteryMode', 'Voltage'/'Percentage'
% Arguments:
% debug (bool)
% smoothStart (numeric in [0, limitValue])
% smoothStop (numeric in [0, limitValue])
% speedRegulation (bool)
% brakeMode ('Coast'|'Brake')
% limitMode ('Time'|'Tacho')
% limitValue (numeric > 0)
% power (numeric in [-100,100])
% batteryMode ('Voltage'|'Percentage')
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.motorA.setProperties('debug', 'on', 'power', 50, 'limitValue', 720, 'speedRegulation', 'on');
......@@ -758,6 +815,7 @@ classdef Motor < MaskedHandle & dynamicprops
% % b.motorA.limitValue = 720;
% % b.motorA.speedRegulation = 'on';
%
p = inputParser();
p.KeepUnmatched = 1;
......@@ -894,7 +952,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
methods (Access = 'private') % Private functions that directly interact with commLayer
methods (Access = private) % Private functions that directly interact with commLayer
function success = setPower(motor, power)
%setPower Sets given power value on the physical Brick.
%
......@@ -905,6 +963,9 @@ classdef Motor < MaskedHandle & dynamicprops
% with the new value instantly. However, this sometimes leads to unexpected behaviour.
% Therefore, if motor is running with a limit, setPower aborts with a warning.
%
% Returns:
% success (bool): if true, power has successfully been set
if ~motor.connectedToBrick || ~motor.physicalMotorConnected
% error('Motor::getTachoCount: Motor-Object not connected to comm handle.');
success = false;
......@@ -1077,7 +1138,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
methods (Access = 'private', Hidden = true)
methods (Access = private, Hidden = true)
function saveState(motor)
%saveState Saves current motor state in dynamic property
......@@ -1118,22 +1179,18 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
methods (Access = {?EV3})
methods (Access = ?EV3)
function connect(motor,commInterface)
%connect Connects Motor-object to physical brick.
%
% Notes:
% * This method is automatically called by EV3.connect()
% * This method actually only saves a handle to a Brick-object which has been
% created beforehand (probably by an EV3-object).
%
% Arguments
% * commInterface: instance of Brick-class
%
% Examples (for use without EV3-class)
% m = Motor();
% brickInterface = Brick('usb');
% m.connect(brickInterface);
% % do stuff
% Arguments:
% commInterface (CommunicationInterface): Handle to a communication interface
% device
%
if motor.connectedToBrick
......@@ -1162,23 +1219,17 @@ classdef Motor < MaskedHandle & dynamicprops
%disconnect Disconnects Motor-object from physical brick.
%
% Notes:
% * As with Motor::connect, this method actually only sets the property, in which
% the handle to the Brick-class was stored, to 0.
%
% Examples (for use without EV3-class)
% m = Motor();
% brickInterface = Brick('usb');
% m.connect(brickInterface);
% % do stuff
% m.disconnect();
% brickInterface.delete(); % Actual disconnecting!!!
% * This method is automatically called by EV3.disconnect()
% * This method actually only sets the property, in which
% the handle to the CommInterface-class was stored, to 0.
%
motor.commInterface = 0; % Note: actual deleting is done in EV3::disconnect.
motor.commInterface = 0;
motor.connectedToBrick = false;
end
function resetPhysicalMotor(motor)
%
if ~motor.connectedToBrick || ~motor.physicalMotorConnected
return;
end
......
......
classdef Sensor < MaskedHandle
% Sensor High-level class to work with sensors.
% High-level class to work with sensors.
%
% Signature
% Author: Tim Stadtmann
% Date: 2016/05/20
% Updated: 2016/08/15
% The Sensor-class facilitates the communication with sensors. This mainly consists of
% reading the sensor's type and current value in a specified mode.
%
% Notes:
% * You don't need to create instances of this class. The EV3-class automatically creates
% instances for each sensor port, and you can work with them via the EV3-object.
% * The Sensor-class represents sensor ports, not individual sensors!
%
% Attributes:
% mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default,
% mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected
% to the port *and* the physical Brick is connected to the EV3-object, the allowed
% mode and the default mode for a Sensor-object are the following (depending on the
% sensor type): [WRITABLE]
%
% * Touch-Sensor:
% * DeviceMode.Touch.Pushed [Default]
% * DeviceMode.Touch.Bumps
% * Ultrasonic-Sensor:
% * DeviceMode.UltraSonic.DistCM [Default]
% * DeviceMode.UltraSonic.DistIn
% * DeviceMode.UltraSonic.Listen
% * Color-Sensor:
% * DeviceMode.Color.Reflect [Default]
% * DeviceMode.Color.Ambient
% * DeviceMode.Color.Col
% * Gyro-Sensor:
% * DeviceMode.Gyro.Angular [Default]
% * DeviceMode.Gyro.Rate
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
% value (numeric): Value read from hysical sensor. What the value represents depends on
% sensor.mode.
% type (DeviceType): Type of physical sensor connected to the port. Possible types are: [READ-ONLY]
% * DeviceType.NXTTouch
% * DeviceType.NXTLight
% * DeviceType.NXTSound
% * DeviceType.NXTColor
% * DeviceType.NXTUltraSonic
% * DeviceType.NXTTemperature
% * DeviceType.LargeMotor
% * DeviceType.MediumMotor
% * DeviceType.Touch
% * DeviceType.Color
% * DeviceType.UltraSonic
% * DeviceType.Gyro
% * DeviceType.InfraRed
% * DeviceType.Unknown
% * DeviceType.None
% * DeviceType.Error
properties % Standard properties to be set by user
%mode - [Writable] Sensor mode in which the value will be read (DeviceMode.[...])
......@@ -42,7 +89,7 @@ classdef Sensor < MaskedHandle
type;
end
properties (Hidden, Access = 'private') % Hidden properties for internal use only
properties (Hidden, Access = private) % Hidden properties for internal use only
commInterface = 0; % Communication interface
%port - [Read-only] Sensor port ('1'/'2'/'3'/'4')
......@@ -56,7 +103,7 @@ classdef Sensor < MaskedHandle
init = true; % Indicates 'init-phase' (True as long as constructor is running)
end
properties (Hidden, Dependent, Access = 'private')
properties (Hidden, Dependent, Access = private)
physicalSensorConnected; % Physical sensor connected to this port?
end
......@@ -70,6 +117,7 @@ classdef Sensor < MaskedHandle
%% Brick functions
function reset(sensor)
%reset Resets value on sensor
%
% Note: This clears ALL the sensors right now, no other Op-Code available... :(
if ~sensor.connectedToBrick
error('Sensor::reset: Sensor-Object not connected to comm handle.');
......@@ -139,11 +187,11 @@ classdef Sensor < MaskedHandle
function setProperties(sensor, varargin)
%setProperties Sets multiple Sensor properties at once using MATLAB's inputParser.
%
% Arguments
% Arguments:
% * 'debug', 0/1/'on'/'off'/'true'/'false'
% * 'mode', DeviceMode.[...]
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient);
......@@ -221,7 +269,7 @@ classdef Sensor < MaskedHandle
end
end
methods (Access = 'private') % Private brick functions that are wrapped by dependent params
methods (Access = private) % Private brick functions that are wrapped by dependent params
function setMode(sensor, mode)
if ~sensor.connectedToBrick
error('Sensor::getTachoCount: Sensor-Object not connected to comm handle.');
......@@ -242,7 +290,7 @@ classdef Sensor < MaskedHandle
function val = getValue(sensor, varargin)
%getValue Reads value from sensor
%
% Notes
% Notes:
% * After changing the mode, sensors initially always send an invalid value. In
% this case, the inputReadSI-opCode is sent again to get the correct value.
%
......@@ -324,7 +372,7 @@ classdef Sensor < MaskedHandle
end
methods (Access = {?EV3})
methods (Access = ?EV3)
function connect(sensor,commInterface)
%connect Connects Sensor-object to physical brick
......@@ -368,4 +416,3 @@ classdef Sensor < MaskedHandle
end
end
end
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment