eeros_architecture:sequencer:monitors
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| eeros_architecture:sequencer:monitors [2017/08/16 11:37] – graf | eeros_architecture:sequencer:monitors [2021/10/20 16:07] (current) – [Define your own Condition] ursgraf | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Conditions and Monitors ====== | ====== Conditions and Monitors ====== | ||
| - | A monitor allows to supervise certain | + | A monitor allows to supervise certain | 
| * A sequence steers a robot along a given path. A monitors checks for obstacles. As soon as an obstacle is close enough, the monitor causes a predefined exception sequence to be executed. | * A sequence steers a robot along a given path. A monitors checks for obstacles. As soon as an obstacle is close enough, the monitor causes a predefined exception sequence to be executed. | ||
| * A sequence takes too long to run due to some erroneous behavior. A monitor checks for timeout and either restarts or aborts the sequence or switches to an exception sequence. | * A sequence takes too long to run due to some erroneous behavior. A monitor checks for timeout and either restarts or aborts the sequence or switches to an exception sequence. | ||
| 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? | + | Implement your condition by extending the class '' | 
| + | <code cpp> | ||
| + | class MyCondition : public Condition | ||
| + | public: | ||
| + | MyCondition() : { } // initialize any attributes necessary | ||
| + | bool validate() {return yourTest;} // implement whatever your condition should check | ||
| + | }; | ||
| + | </ | ||
| + | The method // | ||
| + | IMPORTANT Every Sequence or step already has a timeout condition (of class '' | ||
| + | |||
| + | 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 '' | ||
| + | ===== Assign a Condition to a Monitor ===== | ||
| + | The second step is to define a monitor and assign it a condition. | ||
| + | <code cpp> | ||
| + | SequenceA seq(...); | ||
| + | MyCondition myCondition; | ||
| + | Monitor myMonitor(" | ||
| + | setExceptionSequence(exceptionSeq); | ||
| + | seq.addMonitor(& | ||
| + | </ | ||
| + | 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.1502876220.txt.gz · Last modified: 2017/08/16 11:37 by graf
                
                