Giter Club home page Giter Club logo

pysmurf-custom-transmitter-example's Introduction

Custom pysmurf data transmitter example

Example of how to write an example custom data transmitter class for pysmurf, and how to use it.

Description

This example's transmitter class defines a CustomTransmitter device which is added to the pysmurf's SmurfProcessor device (for more details see here). The CustomTransmitter device has a variable called Debug; when set to True, the custom class will print some word of the header and some data points from the SmurfPacket every time a new packet is received.

How to write a custom transmitter

To write a custom transmitter, which is described in the pysmurf repository here, you would:

  • Write a C++ class which inherits from the pysmurf's BaseTransmitter class. In that class you should override the transmit method to process every new SMuRF packet according to your requirements. You can take a look in this repository to my_transmitter.cpp as an example.
    • In your new C++ class you can add new variable and methods (as the debug flag, and the setDebug and getDebug in this example),
    • In you new C++ class you can expose methods to python if you want to expose then in the pysmurf's pysmurf tree (this example expose the setDebug and getDebug methods),
  • Write a python wrapper for your C++ class (see MyTransmitter.py as an example),
  • Configure cmake to find Rogue, smurf and all other needed libraries (see CMakeLists.txt as an example),
  • Finally, white a startup script where you call the appropriate pysmurf root device, attaching your new module (see cmb_eth.py and dev_board_eth.py as examples).

Docker image

This example provides a Dockerfile as well as a script to build a docker image with this code. Once you have built your image, you can start the container, and call one of the server startup scripts. For more information about how to run pysmurf in docker container take a look here.

pysmurf-custom-transmitter-example's People

Contributors

jesusvasquez333 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.