eeros_architecture:control_system:available_blocks:generic
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
eeros_architecture:control_system:available_blocks:generic [2025/08/08 15:35] – ursgraf | eeros_architecture:control_system:available_blocks:generic [2025/08/08 15:37] (current) – ursgraf | ||
---|---|---|---|
Line 15: | Line 15: | ||
Such an algorithm could theoretically calculate any output from a given set of inputs. Choose this method when the algorithm is simple and one wants to avoid using several other blocks doing a simple algorithm, e.g. adding a offset and scale to a signal as given in the example above. | Such an algorithm could theoretically calculate any output from a given set of inputs. Choose this method when the algorithm is simple and one wants to avoid using several other blocks doing a simple algorithm, e.g. adding a offset and scale to a signal as given in the example above. | ||
- | How could this be solved with predefined block from It can be especially valuable for cases like the following. A signal value must be applied with an offset and a scale. How to achieve this? | + | How could this be solved with predefined block from [[eeros_architecture: |
- | | + | Use a constant block delivering the offset together with a sum block which adds the offset to the signal. Finally, a gain block applies the desired scale. All in all, you will use three different blocks. |
- | - Use a generic block and define the necessary algorithm as follows <code cpp> | + | |
- | gen.getOut(0).getSignal().setValue(gen.getIn(0).getSignal().getValue() + 0.1) * 1.1); | + | |
- | gen.getOut(0).getSignal().setTimestamp(gen.getIn(0).getSignal().getTimestamp()); | + | |
- | })</ | + | |
- | Such a generic | + | Using a basic block with a lambda function as given in the example above saves valuable execution time in reducing the number of necessary blocks. It can also be useful when a given algorithm cannot be stitched together from predefined blocks. |
eeros_architecture/control_system/available_blocks/generic.txt · Last modified: 2025/08/08 15:37 by ursgraf