eeros_architecture:sequencer:define_sequence
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| eeros_architecture:sequencer:define_sequence [2019/03/21 07:54] – [Write your own Class] graf | eeros_architecture:sequencer:define_sequence [2023/02/26 00:25] (current) – [Add Parameters] ursgraf | ||
|---|---|---|---|
| Line 37: | Line 37: | ||
| </ | </ | ||
| - | If you define a main sequence which has no calling sequence and which must be nonblocking per default, you can make use of a simpler | + | If you define a main sequence which has no calling sequence and which must be nonblocking per default, you can make use of another | 
| <code cpp> | <code cpp> | ||
| class MainSequence : public Sequence { | class MainSequence : public Sequence { | ||
| Line 53: | Line 53: | ||
| step2(); | step2(); | ||
| step3(); | step3(); | ||
| + | return 0; | ||
| } | } | ||
| </ | </ | ||
| - | Its mandatory to implement this function. If not, no work is done and the step or sequence terminates immediately. \\ | + | Its mandatory to implement this function. If not, no work is done and the step or sequence terminates immediately. | 
| + | A step or blocking sequence can return a value of type '' | ||
| There might be sequences which should never stop. This must be done as shown below: | There might be sequences which should never stop. This must be done as shown below: | ||
| <code cpp> | <code cpp> | ||
| public: | public: | ||
| int action() { | int action() { | ||
| - | while (Sequencer::running) step1(); | + | while (state == SequenceState::running) step1(); | 
| // while (true) step1(); | // while (true) step1(); | ||
| + | return 0; | ||
| } | } | ||
| </ | </ | ||
| - | This guarantees that the sequence could be stopped by the main program | + | This guarantees that the sequence could be aborted, resumed or restarted | 
| ===== Define Preconditions ===== | ===== Define Preconditions ===== | ||
| You may want to start a sequence or step only if a certain precondition is met. Override the function // | You may want to start a sequence or step only if a certain precondition is met. Override the function // | ||
| Line 83: | Line 87: | ||
| <code cpp> | <code cpp> | ||
| int operator() (double x, double y) { | int operator() (double x, double y) { | ||
| - | this.x = x; // store the first parameter into a local variable for further use | + | this->x = x; // store the first parameter into a local variable for further use | 
| - | this.y = y; // store the second parameter into a local variable for further use | + | this->y = y; // store the second parameter into a local variable for further use | 
| return start(); | return start(); | ||
| } | } | ||
| Line 111: | Line 115: | ||
| As mentioned before you should never wait by using //sleep// in a action method. However, quite often it is desirable to wait for some time to pass when running sequences. How to do properly? Use the predefined step '' | As mentioned before you should never wait by using //sleep// in a action method. However, quite often it is desirable to wait for some time to pass when running sequences. How to do properly? Use the predefined step '' | ||
| - | ===== Returning Values ===== | + | |
| - | A step or blocking sequence can return a value of type '' | + | |
eeros_architecture/sequencer/define_sequence.1553151246.txt.gz · Last modified: 2019/03/21 07:54 by graf
                
                