User Tools

Site Tools


eeros_architecture:sequencer:monitors

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
eeros_architecture:sequencer:monitors [2017/09/13 17:38] – [Assign a Condition to a Monitor] grafeeros_architecture:sequencer:monitors [2021/10/20 16:07] (current) – [Define your own Condition] ursgraf
Line 16: Line 16:
 }; };
 </code> </code>
 +The method //validate// must return ''true'' in order for the monitor checking this condition to fire. 
 +
 IMPORTANT Every Sequence or step already has a timeout condition (of class ''ConditionTimeout''). It allows for checking a maximum duration of execution. Also, every sequence has an abort condition (of class ''ConditionAbort''). This condition makes it possible to abort a sequence, e.g. by pressing ''Ctrl-C''. IMPORTANT Every Sequence or step already has a timeout condition (of class ''ConditionTimeout''). It allows for checking a maximum duration of execution. Also, every sequence has an abort condition (of class ''ConditionAbort''). This condition makes it possible to abort a sequence, e.g. by pressing ''Ctrl-C''.
 +
 +IMPORTANT Make sure that your condition is properly set and reset. To give an example: A condition might be the state of a button. As soon as the button is pressed, the condition might return ''true'' and the associated monitor fires. This might lead to an abortion of the current sequence together with all its blocking subsequences. This might take some time. You have to make sure that the condition delivers ''true'' until this work is done. If the condition is simply the state of the button this might be too short, if you press only for a short time. 
 ===== Assign a Condition to a Monitor ===== ===== Assign a Condition to a Monitor =====
 The second step is to define a monitor and assign it a condition. The second step is to define a monitor and assign it a condition.
 <code cpp> <code cpp>
-  SequenceA seq(...);                                                 // define a sequence +SequenceA seq(...);                                                 // define a sequence 
-  MyCondition myCondition;                                            // and a condition +MyCondition myCondition;                                            // and a condition 
-  Monitor myMonitor("myMon", &seq, myCondition, SequenceProp::abort); // create an associated monitor +Monitor myMonitor("myMon", &seq, myCondition, SequenceProp::abort); // create an associated monitor 
-  setExceptionSequence(exceptionSeq);                                 // choose a sequence to run in case of a condition to become false +setExceptionSequence(exceptionSeq);                                 // choose a sequence to run in case of a condition to become false 
-  seq.addMonitor(&myMonitor);                                         // and add it to the sequence +seq.addMonitor(&myMonitor);                                         // and add it to the sequence
-};+
 </code> </code>
 IMPORTANT Here again, every sequence or step already has a timeout monitor which helps to check its associated timeout condition. A second monitor checks the abort condition. IMPORTANT Here again, every sequence or step already has a timeout monitor which helps to check its associated timeout condition. A second monitor checks the abort condition.
eeros_architecture/sequencer/monitors.1505317085.txt.gz · Last modified: 2017/09/13 17:38 (external edit)