
Python binding for Marvelmind C API
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Python binding for Marvelmind C API
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
- Python 3
- Marvelmind IPS
$ python pip install https://github.com/bertoramos/marvelmind_pylib/releases/download/{version}/{so-version-file}.whl
TODO
-
Install Visual Studio.
-
Create a python virtual environment and install pybind11.
$ conda create --prefix .\.venv python=3.11 $ conda activate .\.venv $ python -m pip install --upgrade pip (.\.venv) $ python -m pip install pybind11
-
Run win_make.bat to build library.
-
A file with extension .pyd must have been created. You can find it in makefiles/win_build/Release folder.
- Copy the .pyd file inside makefiles/marvelmind_pylib/marvelmind_pylib folder.
- Modify version and requires-python parameters pyproject.toml file.
version = "1.0.0"
requires-python = ">=3.11"
- Build wheel:
(.\.venv) $ python -m pip install build
(.\.venv) $ python -m build
``
4. Install wheel. Inside makefiles/marvelmind_pylib/dist folder you will find the wheel and tar files, ready to be installed.
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- USAGE EXAMPLES -->
## Usage
This is an example of the use of the library.
```python
import marvelmind_pylib
SERIAL_PORT = "COM5"
dev = marvelmind_pylib.MarvelMindDevice(SERIAL_PORT, True)
dev.start()
while True:
try:
mob_pos = dev.getMobileBeaconsPosition()
stat_pos = dev.getStationaryBeaconsPosition()
if len(mob_pos) > 0:
print(mob_pos)
if len(stat_pos) > 0:
print(stat_pos)
except KeyboardInterrupt:
break
dev.close()
You can compile or download the dynamic .so/.pyd file and place it in the same folder as the python script that imports the marvelmind_pylib library.
Alberto Ramos Sánchez - alberto.ramos104@alu.ulpgc.es