Giter Club home page Giter Club logo

distantio's Introduction

DEPRECATED : See https://github.com/Overdrivr/pytelemetrycli for a much, much better alternative

DistantIO

DistantIO is a convenient framework for reading and writing variables on a microcontroller in real time. This is a master-slave protocol. Master can be for instance a computer and the slave an embedded device such as a MicroController Unit (MCU).

The whole program was designed to be simple to setup and use.

On the slave side, only two steps are required. Simply register variables during initialization time and update the API from time to time and you're good to go.

Master side, the user interface provided can be used as is, for reading/writing/plotting MCU variables. Or you can ditch it entirely and develop your own user interface with the API. ;)

Authors

  • Rémi Bèges
  • Jerôme Mallet (UI improvements)
  • Dan Faudemer (python API improvements)

Contents of this repository

TODO : rewrite, speak about features.

Master-side User Interface

The User Interface is made with Tkinter/ttk. It is supplied for communicating with the MCU in a more friendly manner. The UI is light but gives a good example on how to use the API.

Master-side API

The master-side API is entirely located in the API/ folder. The Model class exposes all the methods you will need to call in your application. To avoid coupling from API to UI, the Model class also defines a set of signals, which you can connect to slots in your UI. It is using the lightweight python module signalslot (https://pypi.python.org/pypi/signalslot/0.1.0).

To use distantio in your project, simply copy distantio folder into your project folder, and add your project folder to the PYTHONPATH.

This project is not hosted on PyPi yet and cannot be installed using pip. This might change in a near future now that both master and slave APIs are going closer to be stable.

Slave-side

C implementation

A first implementation in C (standard C99) is available in Slave/C/ Simply add the 6 files to your project.

See the examples (todo) or wiki (todo) for detailed instructions.

Supported Boards:

  • Freescale Freedom boards (KL25Z, KL46Z, etc).
  • Arduino : The implementation is standard C, so you should be able to simply add it to any Arduino program. Haven't tested it though
  • And any other board programmed in C language.

ARM mbed

The C implementation is available on ARM mbed development platform(https://developer.mbed.org/users/Overdrivr/code/DistantIO/). This increases considerably the amount of supported hardware platform. See the full list on https://developer.mbed.org/platforms/

A C++ interface is in development.

Python installation requirements

Core version

Python 3.4.2 minimum (https://www.python.org/downloads/)

If you have an older python version and wish to keep both, have a look at the virtualenv module (https://pypi.python.org/pypi/virtualenv). This module will enable you to switch between python versions/installations with a simple console command.

Modules to install (manually or via pip)

TODO : Use virtualenv requirements system for installing modules. But install numpy first from precompiled sources

  • pyserial
  • tkinter (optionnal, for running the UI)
  • pyttk (optionnal, for running the UI)
  • matplotlib 1.4.2 (optionnal, for running the UI)
  • numpy 1.9.0 minimum (optionnal, for running the UI)
  • scipy 0.14 minimum (optionnal, for running the UI)
  • pytest (optional, for running tests)
  • pytest-cov (optional, for getting test coverage)

Running the User Interface

The UI can be launched by running the following command in a console pointing to DistantIO folder

python application.py

You will most likely have import errors from the API. If this is the case, add the DistantIO folder to the PYTHONPATH.

Note : If you have spaces in your pathname, don't forget to use "".

For instance C:/Program Files/GitHub/DistantIO -> C:/"Program Files"/Github/DistantIO

Running tests

For now, both protocols in the API can be automatically tested using pytest. You can run the following commands in a console pointing to DistantIO/ to run the tests

py.test -v

This will have a verbose (-v) output. It will tell you which individual test passed or failed.

Coverage results can additionally be obtained using pytest-cov using the --cov flag

py.test --cov --cov-report html -v

It will also generate a coverage report in html format that you can find in the generated htmlcov/ folder. Open index.html in a browser to see the coverage results.

Protocols

Two different protocols are used in distantio. Serial frames are delimited using flags with a classic byte-stuffing algorithm. Frames are fixed-size, because this reduces at lot the constraints on the slave code.

The second protocol is the core of distantio and defines what is contained in a delimited frame. Each frames carries a 16 bits CRC (Cyclic Redundancy Check) to ensure the received value was not corrupted during transport or processing.

Protocols are defined in serial_protocols_definition.xlsx

Furure work for slave-side

distantio's People

Contributors

overdrivr avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

distantio's Issues

Remove variable manager

Instead, a checkbox next to each variable in the GUI should be available to make sure a variable is being requested and plotted

Reduce number of emitted signals

So far one signal is emitted per value update, which kills performances when a lot of values are received.

Instead, the Model should contain one deque per variable. Size limited to 512 or 1024 samples.

Each time a new reading is received, append to the deque.
Signals on the other hand are emitted at most 10 times per second.
This should make program performances independant of the serial flow speed

variable FPS

Compute how many times in the last second a variable reading was received
Display the result in the UI

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.