diff --git a/doc/source/conf.py b/doc/source/conf.py index 28a9b83331208555006976e0dfca80c6a2e230e5..b11c5c5900ab6c8947da5e19b0c467635bda63bb 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,7 +42,8 @@ extensions = ['matplotlib.sphinxext.only_directives', 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', - 'sphinxarg.ext'] + 'sphinxarg.ext', + 'sphinx.ext.inheritance_diagram'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/doc/source/gettingstarted.rst b/doc/source/gettingstarted.rst index 5a07d027e29563b52970aaa39f1d9cfe0c298c4f..f2f18523a73c91285561c4ade8aa671d0fbdd395 100644 --- a/doc/source/gettingstarted.rst +++ b/doc/source/gettingstarted.rst @@ -3,6 +3,10 @@ Getting started Installing navipy ----------------- +It is recommanded to install navipy in a \ +`virtual environment <https://virtualenvwrapper.readthedocs.io/en/latest/install.html>`_ . By doing \ +so, the python version installed on the system and the one used by \ +navipy may differ, and ease the use of blender rendering engine. .. code-block:: bash @@ -15,6 +19,15 @@ Testing navipy python -m unittest discover navipy +Testing blender +--------------- +Navipy comes with a command line tool to run your script under blender.\ + It is however required that the python version used by blender, and the one use by navipy matche. To test your installation of blender and navipy you can download the (:download:`script <../../navipy/sensors/blendnavipy_test.py>`) and run it under blender with the following command: + + .. code-block:: bash + + blendnavipy --python-script='blendnavipy_test.py' + The core modules ---------------- diff --git a/doc/source/overview/moving.rst b/doc/source/overview/moving.rst index 9737f5c6197648505bde0613d3f040bb1f2e65f5..e02d22fdb62ac4cf53b8cf0736c761f678cfa527 100644 --- a/doc/source/overview/moving.rst +++ b/doc/source/overview/moving.rst @@ -8,3 +8,8 @@ Overview Summary ******* .. automodule:: navipy.moving.agent + +Inheritance +*********** +.. inheritance-diagram:: navipy.moving.agent + diff --git a/navipy/sensors/blendnavipy.py b/navipy/sensors/blendnavipy.py index baee99d320794578974e32908cda41ef52d359bc..16555dc0a47c37c92692a37f97fc7f9f6b1abcfc 100644 --- a/navipy/sensors/blendnavipy.py +++ b/navipy/sensors/blendnavipy.py @@ -7,6 +7,8 @@ import shutil import inspect import tempfile import argparse +from platform import system +from distutils.spawn import find_executable def activate_virtualenv(venv_path): @@ -52,7 +54,7 @@ def parser_blendnavipy(): arghelp = 'Path to the environment (.blend) in which your agent lives' parser.add_argument('--blender-world', type=str, - default=None, + default='', help=arghelp) arghelp = 'Path to your python script to be run in blender' parser.add_argument('--python-script', @@ -98,9 +100,14 @@ def main(): args = parser_blendnavipy().parse_args() if args.blender_command is None: - # Find blender command to do a system call - args.blender_command = shutil.which('blender') - + if system() == 'Windows': + args.blender_command = find_executable("blender") + else: + # Find blender command to do a system call + args.blender_command = shutil.which('blender') + if args.blender_command is None: + raise NameError('Blender executable could not be found. ' + + 'Please specify the full path to it') python_script = args.python_script header = '""" Script generated by {}"""\n'.format(sys.argv[0]) @@ -119,15 +126,15 @@ def main(): '# activate virtualenv within blender\n'.encode(encoding)) for line in inspect.getsourcelines(activate_virtualenv)[0]: tfile.write(line.encode(encoding)) - line = 'activate_virtualenv(\"{}\")\n'.format(venv_path) - tfile.write(line.encode(encoding)) + line = 'activate_virtualenv(\"{}\")\n'.format(venv_path) + tfile.write(line.encode(encoding)) elif syspath is not None: tfile.write( '# add navipy path within blender\n'.encode(encoding)) for line in inspect.getsourcelines(append_path)[0]: tfile.write(line.encode(encoding)) - line = 'activate_virtualenv({})\n'.format(str(syspath)) - tfile.write(line.encode(encoding)) + line = 'append_path({})\n'.format(str(syspath)) + tfile.write(line.encode(encoding)) else: raise NameError('The path to navipy could not be found')