This is an old revision of the document!
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 Has Timeout Monitor
In the EEROS library you will find a directory with examples. 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
A next example demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run
$ examples/sequencer/sequencerTest21
The main sequence simply starts Sequence A
which is called blocking. Sequence A
has its timeout set to 3.5s. It does two Step A
(each of them waits for a second) and then calls Sequence B
which itself does several Step B
. After Sequence B
has started Sequence A
times out. Its timeout monitor has no associated exception sequence. Hence, as the monitor has its sequence property set to abort
, Sequence A
will stop immediately. Sequence B
will obviously stop as well. The main sequence has no further work to do and will reach its end.
Restarting Sequence A
Change the timeout behavior of the monitor to restart
, recompile, and rerun the application. This time you will note, that Sequence A
is interrupted after 2.5s together with Sequence B
. However, Sequence A
will restart and the whole procedure will repeat. You could change the action method of Sequence B
to
while (getRunningState() == SequenceState::running) stepB(1);
The behavior does not change, because Sequence B
never reaches more than one step.
Resuming Sequence A
For the last experiment change the timeout behavior of the monitor to resume
. As soon as the timeout monitor fires, Sequence A
resumes. The monitor would immediately fire again, as the timeout is not automatically reset for resume
. In order for the example to make sense, you have to enable the exception sequence with
setTimeoutExceptionSequence(eSeq);
This in turn will reset the timeout and increase its value to allow Sequence A
and Sequence B
to finish.