Skip to content
Snippets Groups Projects
Commit 18fb451b authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Merge simplified euler to optic flow

parents 687fb470 ffe526ca
No related branches found
No related tags found
No related merge requests found
Showing
with 969 additions and 102 deletions
# .coveragerc to control coverage.py
[run]
omit =
# Omit all test_ functions
**/test_*
# Omit blender functions / can be only tested with blender files
**/blend*
source = navipy
[html]
directory = coverage_html_report
\ No newline at end of file
image: python:latest
stages:
- build
- test
- coverage
- doc_build
navipy_install:
stage: build
before_script:
- python3 -V # Print out python version for debugging
script:
- pip3 install virtualenv
- virtualenv -p python3 venv
- source venv/bin/activate
- pip3 install .
- python navipy/scripts/config_matplotlib_server.py # because no interactive backend
artifacts:
paths:
- venv
expire_in: 2 hours
artifacts:
paths:
- venv
flake8:
stage: test
dependencies:
- navipy_install
script:
- source $CI_PROJECT_DIR/venv/bin/activate
- python3 -m flake8 navipy/*.py
navipy_unittest:
stage: test
dependencies:
- navipy_install
script:
- source $CI_PROJECT_DIR/venv/bin/activate
- python3 -m coverage run -m unittest discover navipy
artifacts:
paths:
- .coverage
expire_in: 1 hours
coverage:
stage: coverage
dependencies:
- navipy_install
- navipy_unittest
script:
- source $CI_PROJECT_DIR/venv/bin/activate
- python3 -m coverage html
artifacts:
paths:
- coverage_html_report
expire_in: 1 day
doc_build:
stage: doc_build
dependencies:
- navipy_install
- coverage
script:
- source $CI_PROJECT_DIR/venv/bin/activate
- cd doc ; make html
artifacts:
paths:
- doc/build
expire_in: 1 week
\ No newline at end of file
We are glad that you are considering contributing to navipy, and are
looking forward to your contribution.
# Pre-requisit
We strongly recommand you to download, install, test, and compile the documentation
## Installation
```
git clone git@gitlab.ub.uni-bielefeld.de:olivier.bertrand/navipy.git
cd navipy
python setup.py install
```
## Unittesting
From the root directory of the repository
```
python -m unittest discover navipy
```
## Blend-unittesting
Several functionalty of navipy requires Blender, and thus code has to be run within blender (see doc for details). Unittesting of function requiring blender can be done as follow
```
blendunittest
```
Note: this command require blender to be installed
## Doc building
The doc is contained in doc/source
```
cd doc
make html
```
# Convention
We follow the PEP8 recommendation and the code should be formatted as such.
# Testing
Ideally every function should be properly tested. Test file should match the pattern 'test*.py' here the * should match the module to be tested. For example to test function within maths.py, a file named test_maths.py should be created and stored in the same folder than maths.py
Certain functionalities require the use of blender. Such test need to be stored in a file 'blendtest*.py'. Note that the blendunittest command uses the blender environment navipy/resources/twocylinders_world.blend. Therefore your test function should use this environment as well.
# Documentation
The documentation is based on Sphinx syntax. Although documenting functions is a must, tutorial is a bonus that will strongly encourage.
LICENSE 0 → 100644
This diff is collapsed.
......@@ -11,9 +11,67 @@ The navigation toolbox aims to bring in an intuitive python toolbox different me
- Avoid re-rendering by using grid constrained motion.
# How to install the navigation toolbox
The rendering from the insect point of view is done with the blender rendering engine. Thus, you will need to first install Blender
https://www.blender.org/
## Windows
We recommend using Anaconda (https://www.anaconda.com/) and create a virtual environment within it before installing the toolbox.
Start the Anaconda Prompt, and then enter
```
conda update conda
```
Upadate any packages if necessary by typing y to proceed
Then, create a virtual environment for your project
```
conda create -n yourenvname python=x.x anaconda
```
here `yourenvname` is the name of your project (without special characters and spaces), and `python=x.x` the version of python
to use, for example `python=3.5.3` (see table below to install a version matching with blender)
You can now activate your environment.
```
activate yourenvname
```
and install navipy by going the root folder of the toolbox (use cd to change directory and dir to list the content of a directory), and typing
```
python setup.py install
```
You can now use the navigation toolbox.
## Linux (Ubuntu)
From the terminal
```
pip install update
```
Upadate any packages if necessary by typing y to proceed
Then, create a virtual environment for your project
```
mkvirtualenv yourenvname
```
here `yourenvname` is the name of your project (without special characters and spaces)
You can now activate your environment.
```
workon yourenvname
```
and install navipy by going the root folder of the toolbox (use cd to change directory and ls to list the content of a directory), and typing
```
python setup.py install
```
## Blender-python version
| Blender version | Python version |
| --------------- | -------------- |
| 2.79b | 3.5.3 |
>>> python setup.py install
# Code of conduct
In the interest of fostering an open and welcoming environment, we as students and teachers pledge to making participation in this class a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
\ No newline at end of file
In the interest of fostering an open and welcoming environment, we as users and developers pledge to making participation with this project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
\ No newline at end of file
......@@ -19,9 +19,7 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../../src/'))
sys.path.insert(0, os.path.abspath('../../src/database/'))
sys.path.insert(0, os.path.abspath('../../tutorials'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
......@@ -34,7 +32,6 @@ sys.path.insert(0, os.path.abspath('../../src/database/'))
extensions = ['matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
......@@ -42,7 +39,8 @@ extensions = ['matplotlib.sphinxext.only_directives',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinxarg.ext']
'sphinx.ext.inheritance_diagram',
'nbsphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
......@@ -80,7 +78,7 @@ language = None
# 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 = []
exclude_patterns = ['**/.ipynb_checkpoints/*']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
......
......@@ -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,16 @@ 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
----------------
......
......@@ -26,7 +26,7 @@ Content
overview/index
tutorials/index
references/index
tests/index
Indices and tables
==================
......
doc/source/media/marked_bumblebee.png

114 KiB

......@@ -4,11 +4,12 @@ Database
Database are generated by the rendering module, and contains all \
images and there corresponding position-orientations.
* position_orientation: containing all position and orientation of where \
images were rendered. The position-orientation is described by \
['x','y','z','alpha_0','alpha_1','alpha_2']
* image: containing all images ever rendered. Each channel of each image \
are normalised, so to use the full coding range.
* position_orientation: containing all position and orientation \
of where images were rendered. The position-orientation is \
described by ['x','y','z','alpha_0','alpha_1','alpha_2']
* image: containing all images ever rendered. \
Each channel of each image are normalised, so to use the \
full coding range.
* normalisation: the normalisation constantes
......
"""
Example on how to use the rendering module
"""
import tempfile
import numpy as np
import os
from navipy.sensors.bee_sampling import BeeSampling
from navipy.sensors.renderer import BlenderRender
# create a bee sampling
cyberbee = BlenderRender()
cyberbee.cycle_samples = 5
bee_samp = BeeSampling(cyberbee)
# Create a list of point from which we want to render images
# Careful three d meshing grow quickly.
x = np.linspace(-5, 5, 3)
y = np.linspace(-5, 5, 3)
z = np.linspace(1.8, 1.8, 1)
alpha_1 = np.array([0]) + np.pi / 2
alpha_2 = np.array([0])
alpha_3 = np.array([0])
bee_samp.create_sampling_grid(
x, y, z, alpha1=alpha_1, alpha2=alpha_2, alpha3=alpha_3)
# Assign maximum world dimension. Otherwise the distance
# will go to infinity, and the distance to objects after compression
# will be set to 0
world_dim = 50 * np.sqrt(2)
bee_samp.world_dim = world_dim
# Rendering in a temporary folder.
with tempfile.TemporaryDirectory() as folder:
filename_db = os.path.join(folder, 'database.db')
bee_samp.render(filename_db)
......@@ -8,3 +8,8 @@ Overview
Summary
*******
.. automodule:: navipy.moving.agent
Inheritance
***********
.. inheritance-diagram:: navipy.moving.agent
......@@ -17,59 +17,6 @@ Using navipy in blender
>>> blendnavipy --blender-world='/path/to/world.blend' --python-script='/path/to/script.py'
.. argparse::
:filename: ../bin/blendnavipy.py
:filename: ../navipy/sensors/blendnavipy.py
:func: parser_blendnavipy
:prog: blendnavipy
How to generate a database using blender
----------------------------------------
.. literalinclude:: examples/blenddemo_beesampling.py
:lines: 7, 8
First we configure the rendering module
.. literalinclude:: examples/blenddemo_beesampling.py
:lines: 11, 12
With the toolbox at disposition we just need to configure the \
BeeSampling to render images on a regular 3D grid.
.. literalinclude:: examples/blenddemo_beesampling.py
:lines: 13,16-23
If we want to use the distance to objects, we need to tell the \
BeeSampling what is the maximum distance to objects in the environment.\
Otherwise the distance can go until infinity, and since the image are \
compressed in the database, all distances to object will be equal to \
zero:
.. literalinclude:: examples/blenddemo_beesampling.py
:lines: 27-28
Finally we can generate the database.
.. literalinclude:: examples/blenddemo_beesampling.py
:dedent: 4
:lines: 31-32
(:download:`Source code <examples/blenddemo_beesampling.py>`)
Custom sampling
---------------
.. literalinclude:: examples/blenddemo_cyberbee.py
:lines: 5
With the toolbox at disposition we just need to configure the \
Cyberbee to render images at desired positions.
.. literalinclude:: examples/blenddemo_cyberbee.py
:lines: 8-13
To render a scene at a given positions, we assign position orientation \
to and then tell the cyberbee to get the scene at that point.
.. literalinclude:: examples/blenddemo_cyberbee.py
:lines: 16-24
(:download:`Source code <examples/blenddemo_cyberbee.py>`)
......@@ -10,3 +10,4 @@ References
comparing
moving
database
maths
Maths
=====
.. automodule:: navipy.maths
:members:
Constants
---------
.. automodule:: navipy.maths.constants
:members:
Coordinates
-----------
.. automodule:: navipy.maths.coordinates
:members:
Homogeneous transformations
---------------------------
.. automodule:: navipy.maths.homogeneous_transformations
:members:
Euler
~~~~~
.. automodule:: navipy.maths.euler
:members:
Quaternions
~~~~~~~~~~~
.. automodule:: navipy.maths.quaternion
:members:
Random generator
----------------
.. automodule:: navipy.maths.random
:members:
Tools
-----
.. automodule:: navipy.maths.tools
:members:
Processing
----------
==========
.. automodule:: navipy.processing
Place code
~~~~~~~~~~
----------
.. automodule:: navipy.processing.pcode
:members:
Brain
=====
No test...
Comparing
=========
.. automodule:: navipy.comparing.test
:members:
Database
========
.. automodule:: navipy.database.test
:members:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment