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
Last revisionBoth sides next revision
eeros_architecture:sequencer:monitors [2017/08/17 20:47] grafeeros_architecture:sequencer:monitors [2019/03/28 13:22] – [Define your own Condition] graf
Line 7: Line 7:
 All these situations have in common, that a user does want to check for a given set of conditions during the running of the sequence (including subsequences or steps). All these situations have in common, that a user does want to check for a given set of conditions during the running of the sequence (including subsequences or steps).
  
-TODO +===== Define your own Condition ===== 
-[{.:sequencemonitorcase1.png?500 | //Monitor checks condition and causes a switch to an exception sequence after which the original sequence is restarted//}}]+Implement your condition by extending the class ''Condition'' as given below: 
 +<code cpp> 
 +class MyCondition : public Condition { 
 +public: 
 +  MyCondition() : { }                 // initialize any attributes necessary 
 +  bool validate() {return yourTest;}  // implement whatever your condition should check 
 +}
 +</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''.
 +===== Assign a Condition to a Monitor =====
 +The second step is to define a monitor and assign it a condition.
 +<code cpp>
 +SequenceA seq(...);                                                 // define a sequence
 +MyCondition myCondition;                                            // and a condition
 +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
 +seq.addMonitor(&myMonitor);                                         // and add it to the sequence
 +</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.
eeros_architecture/sequencer/monitors.txt · Last modified: 2021/10/20 16:07 by ursgraf