# Real-Time Robotics Framework

### Sidebar

eeros_architecture:control_system:blocks

# Blocks

EEROS's control system is mainly made up of blocks. A block can have several inputs and outputs, which carry signals. These signals are transformed from inputs to outputs by the algorithm of the block.

## Inputs and Outputs

Every output carries a signal. An input can be connected to an output and simply refers to the signal of this connected output.

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.

## Predefined Blocks

Build your control system by instantiating all the necessary blocks. For example:

  Step<> step(0.0, -3.14159265359, 5);
step.setName("step 1");

Sum<3> sum;
sum.getIn(0).connect(step.getOut());

Gain<> posController(174.5); // kp=174.5
posController.setName("gain block for position control");

Each block has inputs and/or outputs. Name the output in a meaningful way and assign a physical unit to each of the outputs. The signals which connect the different blocks will be created automatically.

The block step is created with an initial output value of 0.0. After 5 seconds this values steps to -pi. step has a single output with the dimension 1.

Output signals are created together with the blocks. On the other side, there is no need to generate and name input signals.

## Making Connections

When all necessary blocks have been created the blocks must be wired together.

  sum.getIn(0).connect(step.getOut());
sum.getIn(1).connect(gain.getOut());
posController.getIn().connect(sum.getOut());

getIn(0) returns the first input signal. With getIn(1) you will get the second input signal.

## Initial State of Outputs

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 have a meaningful value.