User Tools

Site Tools


eeros_architecture:sequencer:define_sequence

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:define_sequence [2020/09/30 08:06] – [Returning Values] ursgrafeeros_architecture:sequencer:define_sequence [2023/02/26 00:25] (current) – [Add Parameters] ursgraf
Line 56: Line 56:
   }   }
 </code> </code>
-Its mandatory to implement this function. If not, no work is done and the step or sequence terminates immediately. The method can return a value, e.g.  \\+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 ''int''This can be useful to hand back basic information to the calling sequence.  \\ 
 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();  // WRONG!     // while (true) step1();  // WRONG!
     return 0;     return 0;
   }   }
 </code> </code>
-This guarantees that the sequence could be stopped by the main program due to some external event such as a signal.+This guarantees that the sequence could be aborted, resumed or restarted due to exception sequences.
 ===== Define Preconditions ===== ===== Define Preconditions =====
 You may want to start a sequence or step only if a certain precondition is met. Override the function //checkPreCondition()//, e.g.: You may want to start a sequence or step only if a certain precondition is met. Override the function //checkPreCondition()//, e.g.:
Line 85: 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();  // this will start the step or sequence     return start();  // this will start the step or sequence
   }   }
eeros_architecture/sequencer/define_sequence.1601445999.txt.gz · Last modified: 2020/09/30 08:06 by ursgraf