From 796d0bddd993da7c6fcc1550b4e56105e4292bee Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 15 Sep 2018 15:04:02 +0200 Subject: [PATCH] Add base doc files --- .gitignore | 2 + docs/Makefile | 20 ++++ docs/README.md | 25 +++++ docs/conf.py | 169 ++++++++++++++++++++++++++++++++++ docs/getting_started.rst | 29 ++++++ docs/index.rst | 47 ++++++++++ docs/make.bat | 36 ++++++++ docs/modules/localization.rst | 89 ++++++++++++++++++ docs/modules/mapping.rst | 43 +++++++++ docs/modules/slam.rst | 104 +++++++++++++++++++++ 10 files changed, 564 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/README.md create mode 100644 docs/conf.py create mode 100644 docs/getting_started.rst create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/modules/localization.rst create mode 100644 docs/modules/mapping.rst create mode 100644 docs/modules/slam.rst diff --git a/.gitignore b/.gitignore index 28921ba1..9c4e9521 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ __pycache__/ *.py[cod] *$py.class +_build/ +.idea/ # C extensions *.so diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..9296811e --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = PythonRobotics +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) \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..de982ed4 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,25 @@ +## Python Robotics Documentation + +This folder contains documentation for the Python Robotics project. + + +### Build the Documentation + +#### Install Sphinx and Theme + +``` +pip install sphinx sphinx-autobuild sphinx-rtd-theme +``` + +#### Building the Docs + +In the `docs/` folder: +``` +make html +``` + +if you want to building each time a file is changed: + +``` +sphinx-autobuild . _build/html +``` diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..20bcca12 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain 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('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'PythonRobotics' +copyright = '2018, Atsushi Sakai' +author = 'Atsushi Sakai' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- 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.mathjax', + 'sphinx.ext.viewcode', +] + +# 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 master toctree document. +master_doc = 'index' + +# 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 + +# 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 = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +# Fix for read the docs +on_rtd = os.environ.get('READTHEDOCS') == 'True' +if on_rtd: + html_theme = 'default' +else: + html_theme = 'sphinx_rtd_theme' + +# 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_logo = '../icon.png' +html_theme_options = { + 'display_version': False, +} + +# 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'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'PythonRoboticsdoc' + + +# -- 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, 'PythonRobotics.tex', 'PythonRobotics Documentation', + 'Atsushi Sakai', 'manual'), +] + + +# -- 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, 'pythonrobotics', 'PythonRobotics Documentation', + [author], 1) +] + + +# -- 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, 'PythonRobotics', 'PythonRobotics Documentation', + author, 'PythonRobotics', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Extension configuration ------------------------------------------------- diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 00000000..153c3d9c --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,29 @@ +.. _getting_started: + +Getting Started +=============== + +Requirements +------------- + +- Python 3.6.x +- numpy +- scipy +- matplotlib +- pandas +- `cvxpy`_ + +.. _cvxpy: http://www.cvxpy.org/en/latest/ + + +How to use +---------- + +1. Install the required libraries. You can use environment.yml with + conda command. + +2. Clone this repo. + +3. Execute python script in each directory. + +4. Add star to this repo if you like it 😃. diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..cd112c86 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,47 @@ +.. PythonRobotics documentation master file, created by + sphinx-quickstart on Sat Sep 15 13:15:55 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to PythonRobotics's documentation! +========================================== + +Python codes for robotics algorithm. + +This is a Python code collection of robotics algorithms, especially for autonomous navigation. + +Features: + +1. Easy to read for understanding each algorithm's basic idea. + +2. Widely used and practical algorithms are selected. + +3. Minimum dependency. + +See this paper for more details: + +- `[1808.10703] PythonRobotics: a Python code collection of robotics + algorithms`_ (`BibTeX`_) + +.. _`[1808.10703] PythonRobotics: a Python code collection of robotics algorithms`: https://arxiv.org/abs/1808.10703 +.. _BibTeX: https://github.com/AtsushiSakai/PythonRoboticsPaper/blob/master/python_robotics.bib + + + +.. toctree:: + :maxdepth: 2 + :caption: Guide + + getting_started + modules/localization + modules/mapping + modules/slam + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..6aab964d --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ=PythonRobotics + +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% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/modules/localization.rst b/docs/modules/localization.rst new file mode 100644 index 00000000..a69ab51c --- /dev/null +++ b/docs/modules/localization.rst @@ -0,0 +1,89 @@ +.. _localization: + +Localization +============ + +Extended Kalman Filter localization +----------------------------------- + +.. raw:: html + + + +This is a sensor fusion localization with Extended Kalman Filter(EKF). + +The blue line is true trajectory, the black line is dead reckoning +trajectory, + +the green point is positioning observation (ex. GPS), and the red line +is estimated trajectory with EKF. + +The red ellipse is estimated covariance ellipse with EKF. + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +Unscented Kalman Filter localization +------------------------------------ + +|2| + +This is a sensor fusion localization with Unscented Kalman Filter(UKF). + +The lines and points are same meaning of the EKF simulation. + +Ref: + +- `Discriminatively Trained Unscented Kalman Filter for Mobile Robot + Localization`_ + +Particle filter localization +---------------------------- + +|3| + +This is a sensor fusion localization with Particle Filter(PF). + +The blue line is true trajectory, the black line is dead reckoning +trajectory, + +and the red line is estimated trajectory with PF. + +It is assumed that the robot can measure a distance from landmarks +(RFID). + +This measurements are used for PF localization. + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +Histogram filter localization +----------------------------- + +|4| + +This is a 2D localization example with Histogram filter. + +The red cross is true position, black points are RFID positions. + +The blue grid shows a position probability of histogram filter. + +In this simulation, x,y are unknown, yaw is known. + +The filter integrates speed input and range observations from RFID for +localization. + +Initial position is not needed. + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +.. _PROBABILISTIC ROBOTICS: http://www.probabilistic-robotics.org/ +.. _Discriminatively Trained Unscented Kalman Filter for Mobile Robot Localization: https://www.researchgate.net/publication/267963417_Discriminatively_Trained_Unscented_Kalman_Filter_for_Mobile_Robot_Localization + +.. |2| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Localization/unscented_kalman_filter/animation.gif +.. |3| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Localization/particle_filter/animation.gif +.. |4| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Localization/histogram_filter/animation.gif diff --git a/docs/modules/mapping.rst b/docs/modules/mapping.rst new file mode 100644 index 00000000..9da79fd6 --- /dev/null +++ b/docs/modules/mapping.rst @@ -0,0 +1,43 @@ +.. _mapping: + +Mapping +======= + +Gaussian grid map +----------------- + +This is a 2D Gaussian grid mapping example. + +|2| + +Ray casting grid map +-------------------- + +This is a 2D ray casting grid mapping example. + +|3| + +k-means object clustering +------------------------- + +This is a 2D object clustering with k-means algorithm. + +|4| + +Object shape recognition using circle fitting +--------------------------------------------- + +This is an object shape recognition using circle fitting. + +|5| + +The blue circle is the true object shape. + +The red crosses are observations from a ranging sensor. + +The red circle is the estimated object shape using circle fitting. + +.. |2| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Mapping/gaussian_grid_map/animation.gif +.. |3| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Mapping/raycasting_grid_map/animation.gif +.. |4| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Mapping/kmeans_clustering/animation.gif +.. |5| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/Mapping/circle_fitting/animation.gif diff --git a/docs/modules/slam.rst b/docs/modules/slam.rst new file mode 100644 index 00000000..13a122d8 --- /dev/null +++ b/docs/modules/slam.rst @@ -0,0 +1,104 @@ +.. _slam: + +SLAM +==== + +Simultaneous Localization and Mapping(SLAM) examples + +.. _iterative-closest-point-(icp)-matching: + +Iterative Closest Point (ICP) Matching +-------------------------------------- + +This is a 2D ICP matching example with singular value decomposition. + +It can calculate a rotation matrix and a translation vector between +points to points. + +|3| + +Ref: + +- `Introduction to Mobile Robotics: Iterative Closest Point Algorithm`_ + +EKF SLAM +-------- + +This is an Extended Kalman Filter based SLAM example. + +The blue line is ground truth, the black line is dead reckoning, the red +line is the estimated trajectory with EKF SLAM. + +The green crosses are estimated landmarks. + +|4| + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +FastSLAM 1.0 +------------ + +This is a feature based SLAM example using FastSLAM 1.0. + +The blue line is ground truth, the black line is dead reckoning, the red +line is the estimated trajectory with FastSLAM. + +The red points are particles of FastSLAM. + +Black points are landmarks, blue crosses are estimated landmark +positions by FastSLAM. + +|5| + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +- `SLAM simulations by Tim Bailey`_ + +FastSLAM 2.0 +------------ + +This is a feature based SLAM example using FastSLAM 2.0. + +The animation has the same meanings as one of FastSLAM 1.0. + +|6| + +Ref: + +- `PROBABILISTIC ROBOTICS`_ + +- `SLAM simulations by Tim Bailey`_ + +Graph based SLAM +---------------- + +This is a graph based SLAM example. + +The blue line is ground truth. + +The black line is dead reckoning. + +The red line is the estimated trajectory with Graph based SLAM. + +The black stars are landmarks for graph edge generation. + +|7| + +Ref: + +- `A Tutorial on Graph-Based SLAM`_ + +.. _`Introduction to Mobile Robotics: Iterative Closest Point Algorithm`: https://cs.gmu.edu/~kosecka/cs685/cs685-icp.pdf +.. _PROBABILISTIC ROBOTICS: http://www.probabilistic-robotics.org/ +.. _SLAM simulations by Tim Bailey: http://www-personal.acfr.usyd.edu.au/tbailey/software/slam_simulations.htm +.. _A Tutorial on Graph-Based SLAM: http://www2.informatik.uni-freiburg.de/~stachnis/pdf/grisetti10titsmag.pdf + +.. |3| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/SLAM/iterative_closest_point/animation.gif +.. |4| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/SLAM/EKFSLAM/animation.gif +.. |5| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/SLAM/FastSLAM1/animation.gif +.. |6| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/SLAM/FastSLAM2/animation.gif +.. |7| image:: https://github.com/AtsushiSakai/PythonRobotics/raw/master/SLAM/GraphBasedSLAM/animation.gif