The Executor runs the time domains of the control system and the safety system. The time domains are handled by harmonic tasks. The following examples demonstrate the use of such harmonic tasks.
In the EEROS library you will find a directory with examples. For this example see PeriodicExample1.cpp.
Open a shell in the build directory of your EEROS library and run
$ sudo ./examples/task/periodicExample1
This examples does:
Lambda
with a run method given by an empty lambda function. Both harmonic tasks have a periodic counter which measure its periods and run times. Once every 200th run the results of the main task are logged. The harmonic task logs every time it runs. The results are printed in units of seconds. Additionally both harmonics have a default monitor function added. This monitor function logs a warning if the measured period differs more than 5%. Depending on your hardware platform and realtime support of your operating system you might get no warnings, several or many warnings.
If you don't specify a main task, the executor will create a default main task, which does nothing, see PeriodicExample2.cpp.
Run
$ sudo ./examples/task/periodicExample2
This examples does:
The tasks has a periodic counter which measure its periods and run times. The harmonic task logs every time it runs. The results are printed in units of seconds.
An example with many tasks can be found under PeriodicExample3.cpp.
Run
$ sudo ./examples/task/periodicExample3
This examples does:
Lambda
with a run method given by a lambda function. It prints out two messages with a short delay in between.All of the harmonic tasks have a periodic counter which measure its periods and run times. Once every 10th run the results are logged. The results are printed in milliseconds.