eeros_architecture:control_system:blocks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eeros_architecture:control_system:blocks [2015/10/14 15:27] – graf | eeros_architecture:control_system:blocks [2022/04/19 12:36] (current) – [Predefined Blocks] ursgraf | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Inputs and Outputs ===== | ===== Inputs and Outputs ===== | ||
- | Every output carries a signal. An input simply refers to a connected output. | + | Every output carries a [[eeros_architecture: |
- | {{ 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 12: | Line 12: | ||
Step<> | Step<> | ||
step.setName(" | step.setName(" | ||
- | step.getOut().getSignal().setName(" | ||
Sum< | Sum< | ||
sum.setName(" | sum.setName(" | ||
- | sum.getOut().getSignal().setName(" | ||
sum.getIn(0).connect(step.getOut()); | sum.getIn(0).connect(step.getOut()); | ||
- | Gain<> | + | Gain<Vector2> posController(174.5); |
posController.setName(" | posController.setName(" | ||
</ | </ | ||
Line 27: | Line 25: | ||
Output signals are created together with the blocks. On the other side, there is no need to generate and name input signals. | Output signals are created together with the blocks. On the other side, there is no need to generate and name input signals. | ||
+ | For most blocks you have to specify the signal types on its inputs or outputs with template parameters, see [[tools: | ||
- | =====Signals===== | ||
- | The signals used to connect the blocks can be of different types. They can be parametrized with the aid of template parameters. Supported types are | ||
- | * Arithmetic (int, double ...) | ||
- | * Logic (bool) | ||
- | * Vector (Vector2, Vector3, Vector4) | ||
- | * Matrix | ||
- | Each signal can be assigned a name and a unit. All dimensions of a signal share the same name and unit.\\ | ||
- | As an example we look at a block which does summation. Two signals, each of dimension 3, will be added together. | + | =====Making Connections===== |
+ | When all necessary blocks have been created the blocks must be wired together. | ||
<code cpp> | <code cpp> | ||
- | Sum< | ||
- | sum.setName(" | ||
- | sum.getOut().getSignal().setName(" | ||
sum.getIn(0).connect(step.getOut()); | sum.getIn(0).connect(step.getOut()); | ||
sum.getIn(1).connect(gain.getOut()); | sum.getIn(1).connect(gain.getOut()); | ||
- | </ | + | posController.getIn().connect(sum.getOut()); |
- | This is shown in the following diagram: | + | </ |
- | {{ sumblock.png?300 | //Summation block with threedimensional signals//}} | + | // |
- | The functions //getIn()// and // | + | ===== Initial State of Outputs ===== |
- | In order to access the individual dimensions of a certain signal, use functions like | + | All outputs of any block carry a value of NaN (not a number) after the block has been created. Only after the first execution of its run-method does the signal |
- | <code c> | + | |
- | sum.getOut().getValue(); | + | |
- | sum.getOut().getValue(0); | + | |
- | sum.getOut().getValue(2); | + | |
- | sum.getIn(1).getValue(2); | + | |
- | </ | + | |
- | =====Making Connections===== | ||
- | When all necessary blocks have been created the blocks must be wired together. | ||
- | <code c> | ||
- | sum.getIn(0).connect(step.getOut()); | ||
- | sum.getIn(1).connect(enc.getOut()); | ||
- | posController.getIn().connect(sum.getOut()); | ||
- | </ |
eeros_architecture/control_system/blocks.txt · Last modified: 2022/04/19 12:36 by ursgraf