User Tools

Site Tools


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.

Flow of SequencerTest1

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.

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);  

Please make sure to check for the sequence to be stopped by a monitor. If this happens the while statement must terminate. Recompile the program and run it.

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


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.

Resuming the Main Sequence

Change the behavior of the timeout monitor to resume, recompile the program, and run it with the altered behavior. What happens? The main sequence will run StepA. After 2.5s has elapsed the monitor will fire and the exception sequence will run. After this the main sequence resumes at the point where it was interrupted. However, as the timeout condition is still met, the monitor will immediately fire again which causes the exception sequence to run again.
Insert the following statements into the action method of the exception sequence:

int action() {

Recompile and run again. At the end of the exception sequence, the timeout is reset and furthermore its value is set to 4.5s. This time the main sequence will run as before and will be interrupted by the exception sequence. As the monitor behavior is changed to abort at the end of the exception sequence the main sequence will stop subsequently.

getting_started/tutorials/sequencer1.txt · Last modified: 2019/04/04 17:59 by graf