This repo is to set up the pybind11 for the IvP libraries in MOOS-IvP
In particular we make a copy of parts of the ivp source files:
- pyivp/src/lib_geometry
- pyivp/src/lib_mbutils
- pyivp/src_unit_tests/
We intented to use pybind11 to create
- ivp/pybind11/
For the use of well-established functions.
pip install pyivp -U
Note : This may not work for some versions of python on some operating systems.
We will use Docker to manage the dependencies, which should be minimal. Docker mounts the volumn ~/pyivp between the host and container.
To get started:
git clone --recursive [email protected]:ARG-NCTU/pyivp.git
cd ~/pyivp
source docker_run.sh
Or
source docker_join.sh
Note that we should compile and run in Docker. We use a root account in order to access driver and other hardware. Therefore, everything edited in container will belong to root.
We suggest to edit code in host.
This is an example based on 2.680 CPP Labs (lab05 and lab06)
In Docker,
cd ~/pyivp/examples/cpplabs
make
Note that
- We will compile the lib_geometry and install it to /usr/local/lib, which is inside container. (so no worries to mess up your own system)
- We also run a python code to test the installed library in python (pytest/test_plus.py)
The pyivp repo has been configured to a nbdev repo. Quote from nbdev
nbdev is a library that allows you to develop a python library in Jupyter Notebooks, putting all your code, tests and documentation in one place. That is: you now have a true literate programming environment, as envisioned by Donald Knuth back in 1983!
We will use nbdev to develop "high-level" API based on IvP and test all ivp libraries in Jupyter Notebook.
After you compile and install the library.
source Docker/colab_jupyter.sh
Open a browser, and enter the following
http://127.0.0.1:8888/tree
Now you could open and enjoy IvP in Jupyter Notebooks.
nbdev_clean_nbs
Remember to run this command to clear notebooks
The class diagram is drawn by DotUML
Parts of the diagram is shown below:
source docker_run.sh
cd example
make
python3 pytest/test.py
You should see:
Made a bike called: Yamaha
Zoom Zoom on road: mullholland
without import errors or assert fails