This is an old revision of the document!
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. 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.
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
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
.
Timeout Monitor Aborts Main Sequence
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
.
Timeout Monitor Resumes Main Sequence
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.
Sequencer with Timeout Monitor and Exception Sequence
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/SequencerTest1
.
The main program starts the main sequence which itself runs five steps. Each step simply waits for a second.
The main sequence itself has its timeout condition set to 2.5s. After this timeout has expired an exception sequence runs which waits for another three seconds. As the monitor behavior for the sequence is set to restart
, the main sequence simply restarts after the exception sequence has finished. The timeout is automatically reset to 0 for the new run.
Aborting the Main Sequence
You can change the behavior of the timeout monitor to abort
, recompile the program, and run it with the altered behavior. This time the main sequence will simply stop after the exception sequence has stopped running.
Omit Exception Sequence
In the constructor of the main sequence the exception sequence is added with
setTimeoutExceptionSequence(eSeq);
Comment this statement out and recompile. This time there is no exception sequence. As soon as the timeout monitor fires the main sequence either aborts, restarts, or resumes.