Coder Social home page Coder Social logo

marvelmind_pylib's Introduction


Logo

marvelmind_pylib

Python binding for Marvelmind C API
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact


About The Project

Python binding for Marvelmind C API

(back to top)

Built With

(back to top)

Getting Started

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.

Prerequisites

Installation

$ python pip install https://github.com/bertoramos/marvelmind_pylib/releases/download/{version}/{so-version-file}.zip

Install from source

Building

Unix
  1. Create a python virtual environment and install pybind11

    $ python3 -m venv ./pybind_env
    $ source activate pybind_env/bin/activate
    (pybind_env) $ pip install pybind11
  2. In marvelmind_pylib folder create a build folder

    (pybind_env) $ cd marvelmind_pylib
    (pybind_env) $ mkdir build
  3. In build folder execute : cmake .. -Dpybind11_DIR=$(python -m pybind11 --cmakedir)

    (pybind_env) $ cd build
    (pybind_env) $ cmake .. -Dpybind11_DIR=$(python3 -m pybind11 --cmakedir)
    (pybind_env) $ make
  4. A file with extension .so must have been created.

Windows
  1. Install Visual Studio.

  2. Create a python virtual environment and install pybind11.

    $ python3 -m venv ./pybind_env
    $ pybind_env\Scripts\activate
    (pybind_env) $ pip install pybind11
  3. In marvelmind_pylib folder create a build folder.

    (pybind_env) $ cd marvelmind_pylib
    (pybind_env) $ mkdir build
  4. In build folder execute

    (pybind_env) $ cmake ..
    (pybind_env) $ cmake --build . --config Release --target marvelmind_pylib
  5. A file with extension .pyd must have been created. You can find it in Release folder.

Installation
  1. Deactivate environment. In this example we will install the marvelmind_pylib module in the global python3 installation. Choose where you want to install it and use that python executable instead.

    (pybind_env) $ deactivate # Deactivate pybind_env environment
  2. Copy the previously compiled .so/.pyd file in a new empty folder.

  3. Copy the setup.py file to the newly created folder.

  4. Modify setup.py file.

    Change line:

    package_data = {'': ['{dynamic file}']} # add dynamic file name

    to the name of the .so/.pyd file:

    package_data = {'': ['marvelmind_pylib.cpython-39-x86_64-linux-gnu.so']}
  5. Execute following command inside setup.py folder:

        $ python -m pip install .

(back to top)

Usage

This is an example of the use of the library.

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()

Portable usage

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.

(back to top)

Contact

Alberto Ramos Sánchez - [email protected]

(back to top)

marvelmind_pylib's People

Contributors

bertoramos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.