====== Running a Simple Sequence ======
The following examples demonstrate how a single sequence runs a few steps. When the sequence takes too long to run, a timeout monitor fires and runs an exception sequence.
===== Simple Sequence with Five Steps =====
In the EEROS library you will find a directory with examples. For this example see [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest10.cpp|SequencerTest10.cpp]].
Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest10
The main sequence will start running. It consists of five steps. Each of them simply waits for one second. After five seconds the sequence will terminate.
[{{ :getting_started:tutorials:sequencetest10.png?100 |// Simple sequence with steps// }}]
\\
==== Main Sequence Running Infinitely ====
Instead of running five consecutive steps of type ''StepA'', the main sequence could be changed to run infinitely. Change the code of the sequence as follows:
while (getRunningState() == SequenceState::running) stepA(1);
Recompile the program and run it. Please make sure to check for the sequence to be still running. This is for the case that you want to terminate the program by pressing CTRL-C.
===== Timeout Monitor Aborts Main Sequence =====
The next example is [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest11.cpp|SequencerTest11.cpp]]. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest11
The same main sequence will start running. A timeout monitor supervises the main sequence. Its timeout time is set to 2.5s. After the monitor fires the main sequence aborts because its timeout behavior is set to ''abort''.
[{{ :getting_started:tutorials:sequencetest11.png?250 |// Time monitor fires// }}]
\\
===== Timeout Monitor Aborts Main Sequence =====
The next example is [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest12.cpp|SequencerTest12.cpp]]. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest12
The same main sequence will start running. A timeout monitor supervises the main sequence. Its timeout time is set to 2.5s. After the monitor fires an exception sequence runs. This consists of a single step which waits for 3 s. After termination of the exception sequence the main sequence aborts because its timeout behavior is set to ''abort''.
[{{ :getting_started:tutorials:sequencetest12.png?350 |// Exception sequences runs after monitor fired// }}]
\\
===== Timeout Monitor Resumes Main Sequence =====
The next example is [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest13.cpp|SequencerTest13.cpp]]. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest13
The same main sequence will start running. A timeout monitor supervises the main sequence. Its timeout time is set to 2.5s. After the monitor fires an exception sequence runs. This consists of a single step which waits for 3 s. After termination of the exception sequence the main sequence resumes because its timeout behavior is set to ''resume''. Observe that the remaining steps of the main sequence run.
[{{ :getting_started:tutorials:sequencetest13.png?400 |//Main sequence resumes after exception// }}]
\\
===== Timeout Monitor Resumes Main Sequence =====
The next example is [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest14.cpp|SequencerTest14.cpp]]. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest14
The same main sequence will start running. A timeout monitor supervises the main sequence. Its timeout time is set to 2.5s. After the monitor fires an exception sequence runs. This consists of a single step which waits for 3 s. After termination of the exception sequence the main sequence restarts because its timeout behavior is set to ''restart''. Observe that the monitor fires again after 2.5s which causes the exception sequence to run and another restart. This would continue indefinitely. However, the times of the restart get counted in the example and after the count reaches 3 the timeout behavior is set to ''abort''.
[{{ :getting_started:tutorials:sequencetest14.png?400 |//Main sequence restarts after exception// }}]
\\