User Tools

Site Tools


eeros_architecture:control_system:custom_blocks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eeros_architecture:control_system:custom_blocks [2021/05/16 15:28] – [How Many Inputs and Outputs?] ursgrafeeros_architecture:control_system:custom_blocks [2025/08/08 15:41] (current) – [Basic Block] ursgraf
Line 1: Line 1:
 ====== Custom Blocks ====== ====== Custom Blocks ======
-If a certain functionality cannot be found in the [[eeros_architecture:control_system:available_blocks|]] you have to implement it in your own block. This is also the case if you want to create a[[eeros_architecture:control_system:subsystem|Subsystem]].+If a certain functionality cannot be found in the [[eeros_architecture:control_system:available_blocks|]] you have to implement it in your own block. This is also the case if you want to create a [[eeros_architecture:control_system:subsystem|Subsystem]].
  
 ==== How Many Inputs and Outputs? ==== ==== How Many Inputs and Outputs? ====
-If your block has one input, one output, or one input and one output, you should design your block as an extension of ''Block1i'', ''Block1o'', or ''Block1i1o'', respectively\\+You should design your block as an extension of ''Blockio''. Choose the template parameters so that you get the desired number of input and output signals together with their types. If signals carry different typesyou have will have to define the necessary inputs and outputs as fields of your new block class
  
-For all other cases your block will have to define the necessary inputs and outputs as fields of your new block class.  +As a example we take a look at a new block 
- +
-As a example we take a block which is of type ''Block1i1o''+
 <code cpp> <code cpp>
 template < typename T = double >  // make it available for many types template < typename T = double >  // make it available for many types
-class MyBlock : public Block1i1o<T> {+class MyBlock : public Blockio<1,2,T,T> {  // has 1 input, 2 outputs
  public:  public:
   MyBlock() { ... }   // constructor   MyBlock() { ... }   // constructor
Line 24: Line 22:
  
 There are cases that your blocks produces signals which do not depend on input signals from other blocks. It might generate its output signals from various other sources and will set its timestamp to a actual system time, or the time the original source signal was generated.  There are cases that your blocks produces signals which do not depend on input signals from other blocks. It might generate its output signals from various other sources and will set its timestamp to a actual system time, or the time the original source signal was generated. 
 +
 +===== Using Basic Block =====
 +Have a look at the [[eeros_architecture:control_system:available_blocks:generic|]]. It allows to pass its algorithm with a lambda function. This can be handy and avoids the need to write your custom block.
eeros_architecture/control_system/custom_blocks.1621171698.txt.gz · Last modified: 2021/05/16 15:28 by ursgraf