User Tools

Site Tools


eeros_architecture:control_system: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
Next revisionBoth sides next revision
eeros_architecture:control_system:blocks [2015/10/14 14:50] grafeeros_architecture:control_system:blocks [2017/03/17 09:55] – [Inputs and Outputs] graf
Line 3: Line 3:
  
 ===== Inputs and Outputs ===== ===== Inputs and Outputs =====
-Every output carries a signal. An input simply refers to connected output. +Every output carries a signal. An input can be connected to an output and simply refers to the signal of this connected output. 
-{{ inoutputuml.png?500 | //Input und Output Type//}}+[{{ block.png?200 | //Two blocks connected together//}}]
 This makes sure that each input is connected to a single output. On the other hand, an output can carry its signal to many inputs. This makes sure that each input is connected to a single output. On the other hand, an output can carry its signal to many inputs.
  
Line 38: Line 38:
 As an example we look at a block which does summation. Two signals, each of dimension 3, will be added together.  As an example we look at a block which does summation. Two signals, each of dimension 3, will be added together. 
 <code cpp> <code cpp>
-  Sum<3> sum;+  Sum<2,Vector3> sum;
   sum.setName("adds feedback");   sum.setName("adds feedback");
   sum.getOut().getSignal().setName("control signal");   sum.getOut().getSignal().setName("control signal");
-  sum.getIn(0).connect(step.getOut()); 
- Sum sum(3); 
- sum.getOut().setName("phi"); 
- sum.getOut().setUnit("rad"); 
 </code>  </code> 
 This is shown in the following diagram: This is shown in the following diagram:
 {{ sumblock.png?300 | //Summation block with threedimensional signals//}} {{ sumblock.png?300 | //Summation block with threedimensional signals//}}
  
-The functions //getIn()// and //getOut()// return an input or output signal, respectively. With the summation block, //getOut()// returns the single output signal. //getIn()// returns the first input signal. This is the same as //getIn(0)//. To obtain the second input signal you have to write //getIn(1)//+The functions //getIn()// and //getOut()// return an input or output signal, respectively. With the summation block, //getOut()// returns the single output signal. 
-In order to access the individual dimensions of a certain signal, use functions like +
-<code c> +
- sum.getOut().getValue();  // returns dimension 0 of output   +
- sum.getOut().getValue(0);  // returns dimension 0 of output  +
- sum.getOut().getValue(2);  // returns dimension 2 of output  +
- sum.getIn(1).getValue(2);  // returns dimension 2 of input 1  +
-</code> +
  
 =====Making Connections===== =====Making Connections=====
 When all necessary blocks have been created the blocks must be wired together. When all necessary blocks have been created the blocks must be wired together.
-<code c+<code cpp
- sum.getIn(0).connect(step.getOut()); +  sum.getIn(0).connect(step.getOut()); 
- sum.getIn(1).connect(enc.getOut()); +  sum.getIn(1).connect(gain.getOut());  
- posController.getIn().connect(sum.getOut());+  posController.getIn().connect(sum.getOut());
 </code> </code>
 +//getIn(0)// returns the first input signal. With //getIn(1)// you will get the second input signal.
 +
 +
eeros_architecture/control_system/blocks.txt · Last modified: 2022/04/19 12:36 by ursgraf