User Tools

Site Tools


getting_started:tutorials:sequencer1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:tutorials:sequencer1 [2020/12/03 14:44] – [Timeout Monitor Aborts Main Sequence] ursgrafgetting_started:tutorials:sequencer1 [2021/03/31 14:37] (current) – [Timeout Monitor Resumes Main Sequence] ursgraf
Line 3: Line 3:
  
 ===== Simple Sequence with Five Steps ===== ===== 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 + 
 +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 
 <code> <code>
 $ ./examples/sequencer/sequencerTest10 $ ./examples/sequencer/sequencerTest10
Line 21: Line 24:
 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. 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 ===== ===== Timeout Monitor Aborts Main Sequence =====
-Open a shell in the build directory of your EEROS library and run +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 
 <code> <code>
 $ ./examples/sequencer/sequencerTest11 $ ./examples/sequencer/sequencerTest11
Line 29: Line 32:
 \\ \\
 ===== Timeout Monitor Aborts Main Sequence ===== ===== Timeout Monitor Aborts Main Sequence =====
-Open a shell in the build directory of your EEROS library and run +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 
 <code> <code>
 $ ./examples/sequencer/sequencerTest12 $ ./examples/sequencer/sequencerTest12
Line 37: Line 40:
 \\ \\
 ===== Timeout Monitor Resumes Main Sequence ===== ===== Timeout Monitor Resumes Main Sequence =====
-Open a shell in the build directory of your EEROS library and run +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 
 <code> <code>
 $ ./examples/sequencer/sequencerTest13 $ ./examples/sequencer/sequencerTest13
 </code> </code>
 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. 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?350 |// Exception sequences runs after monitor fired// }}]+[{{ :getting_started:tutorials:sequencetest13.png?400 |//Main sequence resumes after exception// }}]
 \\ \\
-====== Sequencer with Timeout Monitor and Exception Sequence ====== +===== Timeout Monitor Resumes Main 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 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  
-The main program starts the main sequence which itself runs five steps. Each step simply waits for a second.  +<code> 
- +./examples/sequencer/sequencerTest14
-[{{ .:sequencerexample1.png?400 | //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. \\ +
- +
- +
-==== 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 +
-<code cpp> +
-setTimeoutExceptionSequence(eSeq);+
 </code> </code>
-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. +The same main sequence will start runningtimeout 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 restartThis would continue indefinitelyHowever, 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// }}] 
-==== Resuming the Main Sequence ==== +\\
-Change the behavior of the timeout monitor to ''resume'', recompile the program, and run it with the altered behaviorWhat 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: +
-<code cpp> +
-int action() { +
-  wait(3); +
-  caller->resetTimeout();  +
-  caller->setTimeoutTime(4.5); +
-  caller->setTimeoutBehavior(SequenceProp::abort); +
-+
-</code> +
-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.1607003061.txt.gz · Last modified: 2020/12/03 14:44 by ursgraf