GithubHelp home page GithubHelp logo

pothosware / pothosblocks Goto Github PK

View Code? Open in Web Editor NEW
11.0 19.0 7.0 738 KB

A collection of core processing blocks

Home Page: https://github.com/pothosware/PothosBlocks/wiki

License: Boost Software License 1.0

CMake 2.63% C++ 97.37%
pothos dataflow blocks utility network packet streaming pothos-framework

pothosblocks's Introduction

A collection of core processing blocks

The processing blocks found in this project offer core functionality, and do not incur external dependencies. More information to come as this project fills in.

Documentation

Dependencies

  • Pothos library

Building and installing

configure, build, and install with CMake

Licensing information

Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

pothosblocks's People

Contributors

ashley-b avatar bjorksteinsson avatar eduardosm avatar guruofquality avatar jasonabele avatar mitchellkrome avatar ncorgan avatar rinatzakirov avatar xloem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pothosblocks's Issues

socket endpoint is throwing on close comms

This thow is the sign of a handshake error. To replicate, just enable disable the topology in the GUI until fail. The thrower seems to not be getting an ack, and waiting until timeout in the last ack state.

pseudorandom test case generator + verification harness

A number of unit tests have boiler plate duplication for creating a memory buffer, filing it, and verifying it. In some cases we want a pseudorandom stream buffer, in others we want labels and messages as well to test other aspects. In quite a number of the cases, the blocks in the test harness just need to be tested against arbitrary input -- and handwritten test cases are suboptimal.

  • generate pseudorandom test patterns of streams, messages, labels
  • test patterns of arbitrary length and/or repetition
  • verification at output of pseudorandom test patterns

Blocks

Hi Guys,

Just getting started with Pothos and I have been learning about LoRa and experimenting with it.

I wanted to see if I could modify one of the demo Pothos flows which simulates generating signals and then reading them back in and decoding them (https://github.com/myriadrf/LoRa-SDR/tree/master/examples/lora_simulation.pth)

I was trying to change it so the user could enter a word in and have it generate a signal and have it decode their word. Currently LoRa Test Gen just generates random numbers and then stores each of them in the payload so you essentially get a counter.

The demo I was looking at had LoRa Test Gen >> Pacer >> LoRa Encoder >> LoRa Mod etc

I tried plugging in a chat box instead of LoRa Test Gen like this :

Chat Box >> Pacer >> LoRa Encoder >> LoRa Mod

but I think that fails because it is not generating a packet correctly.

My question is, how do I create a packet and place a word in the payload which I believe is required for my planned above modification to work.

Or do I need to find the code for LoRa Test Gen and then try and learn C in order to compile my own version of LoRa Test Gen ?

Any help would be appreciated.

Dan

network endpoint: udt so broken

The socket endpoint and network source/sink supported two reliable transports: TCP, and UDT (a reliable stream layer for UDP). We ended up removing the udt from the unit tests because it randomly failed... not so reliable. However, at this point, it seems to completely not work. The block handshakes fail immediately. I wanted to keep UDT around for benchmarks and experimentation.

sporadic subnormal needs template

Some compiler quick, inBuff.as<const void*>(), needs to be inBuff.template as<const void*>(),

I have a poor CI setup, so it doesnt run unless I update the submodules manually, it should probably be a CI per project

https://travis-ci.org/github/pothosware/PothosCore/jobs/695417531

home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp: In member function ‘void SporadicSubnormal<T>::work()’:

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:84:24: error: expected primary-expression before ‘void’

             outBuff.as<void*>(),

                        ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:84:24: error: expected ‘)’ before ‘void’

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:85:23: error: expected primary-expression before ‘const’

             inBuff.as<const void*>(),

                       ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:85:23: error: expected ‘)’ before ‘const’

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:47: error: expected primary-expression before ‘*’ token

                 } while(_checkFcn(outBuff.as<T*>()[index]));

                                               ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:48: error: expected primary-expression before ‘>’ token

                 } while(_checkFcn(outBuff.as<T*>()[index]));

                                                ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:50: error: expected primary-expression before ‘)’ token

                 } while(_checkFcn(outBuff.as<T*>()[index]));

                                                  ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:29: error: expected primary-expression before ‘*’ token

                 outBuff.as<T*>()[index] = _subVal;

                             ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:30: error: expected primary-expression before ‘>’ token

                 outBuff.as<T*>()[index] = _subVal;

                              ^

/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:32: error: expected primary-expression before ‘)’ token

                 outBuff.as<T*>()[index] = _subVal;

                                ^

make[2]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o] Error 1

make[1]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/all] Error 2

framer block w/ preamble

Options:

  • configurable preamble vector

Ports:

  • input packets (with labels)
  • output stream with full packed bytes
  • stream has preamble and input packet's payload and associated labels

test message generator

A block that generates test messages for comms testing (for example). We have used the chat box often to stimulate messages. This should have options to generate stuff like random packet payloads incrementing counters, and current timestamps. The random payloads and counters should have a binary and ascii option. Ascii lets us see the messages received in a chat box for helpful debugging. The output is a Pothos::Packet where the payload contains the message bytes.

FIR taps generation block

The FIR taps generation block takes in parameters about an filter, such as stopband, passband, cutoff, and generates an array of taps for an FIR filter.

  • this is not a streaming block, signals and slots only
  • taps are type std::vector(std::complex(double)) -- lesser type conversions already supported
  • this block has a tapsChanged signal that is emitted on activate() and when a parameter slot changes

Consider making this block widget-aware in the future. The widget will be a filter designer GUI to select parameters and preview the filter's profile.

network blocks need flow control

Use a counter/tokens to limit the amount of bytes in the ether between send() and recv(),
without this, send can block, and blocking is bad, we want to guaruntee that there is always space in the ether to accept the data.

bus companion blocks

Core bus support blocks

Goal: create a set of core blocks for dealing with bus manipulation in a programmatic way. This allows gui users and JSON markup users to manipulate buses without loops.

  • bus concat - concatenate several ports or buses into a single larger bus. This is effectively a Topology block composed of only connections - no runtime overhead.
  • bus splitter - split an input bus into several sub ports or buses. Also a pure topology block without runtime overhead.

simplify label deframer

We got a little carried away with the first implementation. It can be done stateless without any memory copies, and passive buffer forwarding:

  • The implementation should stop at the first label, consume all elements preceding the label, set inputPort->setReserve(Nelements), and return.
  • The next call, work() will be called with at least one label at position 0, and Nelements worth of buffer. The buffer reference can simply be copied to the output Packet message (with any other labels seen by the stream).
  • The work implementation should then go back to consuming until it encounters the next label. The next label could be anywhere, far off, or in the middle of the packet just produced.

Also, we should install the circular buffer to avoid any memory copies within the scheduler. After all, we are sliding through the input stream looking for size-N contiguous buffers. So it fits to use a circular buffer here:

    Pothos::BufferManager::Sptr getInputBufferManager(const std::string &, const std::string &)
    {
        return Pothos::BufferManager::make("circular");
    }

stream buffer to/from message

As part of the the basic set of stock conversion blocks:

  • A zero copy stream to message which transplants a stream buffer into a message. Any labels on the stream buffer will get passed along with the buffer in the message.
  • A zero copy message to stream which does the reverse, including re-inserting labels.
  • Need a message structure to represent this -- perhaps a struct containing a BufferChunk and a vector of Labels.

[includes fix] Build issue gcc 7.3.1 rhel 7.7

This issue appears newly introduced.

[ 50%] Building CXX object stream/CMakeFiles/StreamBlocks.dir/IsX.cpp.o                                                                                                               [16/911]
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsFinite" and "<" does not give a valid preprocessing token
             return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
                                                      ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:140:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isfinite, IsFinite)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsFinite" and "<" does not give a valid preprocessing token
             return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
                                                       ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:140:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isfinite, IsFinite)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsInf" and "<" does not give a valid preprocessing token
             return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
                                                      ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:157:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isinf, IsInf)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsInf" and "<" does not give a valid preprocessing token
             return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
                                                       ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:157:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isinf, IsInf)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNaN" and "<" does not give a valid preprocessing token
             return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
                                                      ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:174:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnan, IsNaN)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNaN" and "<" does not give a valid preprocessing token
             return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
                                                       ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:174:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnan, IsNaN)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNormal" and "<" does not give a valid preprocessing token
             return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
                                                      ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:192:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnormal, IsNormal)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNormal" and "<" does not give a valid preprocessing token
             return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
                                                       ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:192:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnormal, IsNormal)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNegative" and "<" does not give a valid preprocessing token
             return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
                                                      ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:209:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnegative, IsNegative)
 ^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNegative" and "<" does not give a valid preprocessing token
             return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
                                                       ^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:209:1: note: in expansion of macro ‘registerBlock’
 registerBlock(isnegative, IsNegative)
 ^~~~~~~~~~~~~
make[2]: *** [stream/CMakeFiles/StreamBlocks.dir/build.make:380: stream/CMakeFiles/StreamBlocks.dir/IsX.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:350: stream/CMakeFiles/StreamBlocks.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

converter block needs backpressure

Oh no. The converter block is allocating a new buffer on every call. This can be disaster if it converts faster than a downstream block consumes. We should be using the output buffers provided by the ABI for proper back-pressure.

waveform trigger block

waveform trigger block

Just like the stream snooper, this is the backend block for the waveform plotter with special capabilities that one would need in a virtual oscilloscope. Because this is a separate block from the waveform plotter itself, this block may run on the remote host or scratch process so that only the display data is forwarded to the plotter.

notable features

  • alignment option to force matched consumption of elements across channels, this way triggered data will always be exactly time-aligned in the sense of identical number of samples per channel. The stream snooper has this option already
  • select trigger channel
  • trigger mode (automatic vs normal) automatic will trigger after a trigger point is not found
  • trigger slope (pos/neg), trigger position (y-axis), trigger position (x-axis)

StreamToPacket stalls.

I have noticed when running Waveform Source into StreamToPacket it stalls, when its is free running (with not start or end Labels).
I have noticed the block code is consuming the Packet length, I assume this is meant to be the elements().
I did try this change and the block no longer stalls but it produces garbled data after a while.

inputPort->consume(packet.payload.length);

Also should inputPort->consume do some sanity check to see if there is that much data to consume?

bursty level detector

The bursty level detector (may need better name) searches an input stream for continuous regions energy > threshold. These regions are forwarded to the output with start and end labels to indicate the burst boundaries. We may employ a window to avoid false end of bursts and or to pad out the boundaries of the burst.

This block can be used with the stream fragmenter: #31

mega-buffering passthrough block

Create a simple passthrough block with a "boundless" input buffer. The purpose is to be able to buffer vast amounts of data in memory when it cannot be read out fast enough -- at the expense of 1) backing up the flow and 2) consuming available PC memory resources.

This block will have custom input buffer manager that will 1) allocate more buffers on demand, and 2) never report empty (or report empty at some specified maximum).

debug blocks?

It would be nice to have debug blocks which log labels and messages as in gnuradio

abort block

a block with configurable failure options to test the recovery for the GUI

  • abort on activate/deactivate
  • abort on work
  • abort on contruction
  • abort on setting call

network blocks must fragment for sends > 4096 bytes

The OS cant handle sends this large (winsock is 4096, linux may be larger?). But in any case, the reliability breaks down when larger items are unnecessarily lost. We should handle the fragmentation and recovery.

bursty stream fragmentation and reassembly blocks

Consider a bursty stream that uses start of frame labels (optional) and end of frame labels to designate the boundaries of a burst.

  • The burst fragmenter block is responsible for slicing the stream into MTU sized packets and appending a header that specifies the packet index (within the burst), start of burst an end of burst markers. The first element in a start of burst packet is the element with the start of frame label. The last element in an end of burst packet is the element with the end of frame label. This block is data type agnostic.
  • The burst reassembler block is responsible for converting between these formatted packets back into a labelled stream of bursts. This block takes the desired output data type as an input parameter.

Immediate use case: The burst fragmenter will accept bursts from a level detector that is fed by an audio source. This will enable the transmission of useful audio data over a link. The burst reassembler will feed the bursts to an audio sink which will use the end of frame label to stop the audio device and avoid underflow: pothosware/PothosAudio#2

templated numeric conversion block

GIven the desired output type, this block can convert any input type (thats numeric) to that output type. The block will contain a NxN table of factories for template instantiations of said block.

The block should support automatic input type determination: pothosware/pothos-library#36

VRL stream to/from arbitrary port

The VRL protocol is one possible way to store stream data and serialized messages, labels in a bounded protocol that can be sent over a wire or to/from a file -- and recover bounds in the face of errors. Create a:

  • VRL serializer that reads a port and outputs a stream containing VRL
  • VRL deserializer that reads a VRL stream and outputs to a port -- this recovers bounds in the face of missing pieces

Compile Error with GCC 7.3.1

I'm on a system with an old release of rhel 7.7, using gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) and it seems there is an ambiguity around std::isnan(double) somehow.

[ 67%] Building CXX object blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp: In function ‘Pothos::Block* makeSporadicNaN(const Pothos::DType&)’:
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:132:104: error: overloaded function with no contextual type information
             return new SporadicSubnormal<T>(std::numeric_limits<T>::quiet_NaN(), CheckFcn<T>(std::isnan), "NaN");
                                                                                                        ^
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:135:5: note: in expansion of macro ‘ifTypeDeclareIsNaN’
     ifTypeDeclareIsNaN(double)
     ^~~~~~~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp: In function ‘Pothos::Block* makeSporadicInf(const Pothos::DType&)’:
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:146:103: error: overloaded function with no contextual type information
             return new SporadicSubnormal<T>(std::numeric_limits<T>::infinity(), CheckFcn<T>(std::isinf), "Inf");
                                                                                                       ^
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:149:5: note: in expansion of macro ‘ifTypeDeclareIsInf’
     ifTypeDeclareIsInf(double)
     ^~~~~~~~~~~~~~~~~~
make[2]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/build.make:240: blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3586: blocks/testers/CMakeFiles/TesterBlocks.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Generic de/interleaver for stream blocks

  • Interleave element by element using each buffer's dtype. Its not supposed an efficient implementation. Output type is specified in the block options
  • Deinterleave from one into into many. Output type is specified in the block options. Again, not supposed to be efficient.
  • Each block has a chunk size option for controlling how multiple of an input type get inter/deinterleaved.

inline buffer test race condition

The inline buffer test with the adder shows failures. An extra reference count can be seen on the buffer, and the read before write buffer inlining fails to activate. Best I can tell this is a race condition since changing the registry path for the adder block can fix this on the laptop. Windows VM appears OK, but did notice a failure once...

signal-slot interceptor block

  • This is a block that accepts an arbitrary signal, passes the signal args to a user defined function, and emits the output of the user function.
  • The user function is a JIT compiled C++ function
  • The purpose of this block is to make it easy to mutate signal-slots with a stateless function, minimal boilerplate.

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.