Example with Blocking Sequence
The following example all have a main sequence which calls a few steps and a another sequence. This second sequence is a blocking sequence. That means that the main sequence pauses while the second sequence runs. A timeout monitor either supervises the main sequence or the second sequence.
Main Sequence Calls Blocking Sequence
In the EEROS library you will find a directory with examples. For this example see SequencerTest20.cpp. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest20
The main sequences starts with three Step A
after which the Sequence B
is called. Sequence B
is blocking, that means, that the main sequence pauses while it runs. The main sequence will subsequently do three more Step A
before finishing.
Main Sequence Has Timeout Monitor
The next example can be found under SequencerTest21.cpp. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run
$ examples/sequencer/sequencerTest21
The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that the main sequence together with the second sequence immediately stop as the timeout behavior is set to abort
.
Main Sequence Has Timeout Monitor with Resume
The next example can be found under SequencerTest22.cpp. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run
$ examples/sequencer/sequencerTest22
The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that the main sequence together with the second sequence continue from their previous state as the timeout behavior is set to resume
.
Main Sequence Has Timeout Monitor with Restart
The next example can be found under SequencerTest23.cpp. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run
$ examples/sequencer/sequencerTest23
The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that both sequences stop immediately and the main starts again as the timeout behavior is set to resume
. The timeout monitor will fire again with the same consequences. This would go on forever. After three restarts the timeout behavior is set to abort
and the example terminates.
Subsequence Has Timeout Monitor
The next example can be found under SequencerTest24.cpp. It demonstrates what happens if the subsequence is interrupted by a monitor. Run
$ examples/sequencer/sequencerTest24
The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the sugsequence stops immediately as the timeout behavior is set to abort
. The main sequence will continue to run until it is done.
Subsequence Has Timeout Monitor with Resume
The next example can be found under SequencerTest25.cpp. It demonstrates what happens if the subsequence is interrupted by a monitor. Run
$ examples/sequencer/sequencerTest25
The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the subsequence continues from where it was interrupted as its timeout behavior is set to resume
. After the subsequence has terminated the main sequence will continue until it is done.
Subsequence Has Timeout Monitor with Restart
The next example can be found under SequencerTest26.cpp. It demonstrates what happens if the subsequence is interrupted by a monitor. Run
$ examples/sequencer/sequencerTest26
The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the subsequence restarts from the beginning as its timeout behavior is set to restart
. This would go on forever. After three restarts the behavior is set to abort
which causes the subsequence to terminate. After this, the main sequence will continue until it is done.