eeros_architecture:sequencer:subsequence
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eeros_architecture:sequencer:subsequence [2015/10/30 09:59] – [Simple Example] graf | eeros_architecture:sequencer:subsequence [2015/10/31 09:05] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 35: | Line 35: | ||
void run() { | void run() { | ||
robot.moveXY(10, | robot.moveXY(10, | ||
- | | + | |
robot.moveXY(-10, | robot.moveXY(-10, | ||
- | | + | |
robot.moveXY(0, | robot.moveXY(0, | ||
} | } | ||
Line 43: | Line 43: | ||
private: | private: | ||
Robot& robot; | Robot& robot; | ||
- | SequenceB | + | SequenceB |
}; | }; | ||
</ | </ | ||
- | In our main program we declare a sequencer for the main sequence. The same sequencer will also handle the subsequence. Sequence A and B do not run concurrently. The following figure shows the flow of action. | + | In our main program we declare a sequencer for the main sequence. The same sequencer will also handle the subsequence. Sequence A and B do not run concurrently. |
- | {{: | + | <code cpp> |
+ | int main() { | ||
+ | Sequencer sequencer; | ||
+ | SequenceA seqA(" | ||
+ | sequencerA.start(& | ||
+ | sequencerA.join(); | ||
+ | }; | ||
+ | </ | ||
+ | The following figure shows the flow of action. | ||
+ | {{ : | ||
===== Nonblocking Call of a Subsequence ===== | ===== Nonblocking Call of a Subsequence ===== | ||
Line 62: | Line 71: | ||
void run() { | void run() { | ||
robot.moveZ(5); | robot.moveZ(5); | ||
- | sleep(); | + | sleep(3); |
yield(); | yield(); | ||
robot.moveZ(0); | robot.moveZ(0); | ||
Line 83: | Line 92: | ||
void run() { | void run() { | ||
robot.moveXY(10, | robot.moveXY(10, | ||
- | | + | |
- | robot.moveXY(-10, | + | robot.moveXY(-10, |
- | | + | |
robot.moveXY(0, | robot.moveXY(0, | ||
} | } | ||
Line 91: | Line 100: | ||
private: | private: | ||
Robot& robot; | Robot& robot; | ||
- | Sequencer& | + | Sequencer& |
}; | }; | ||
</ | </ | ||
Line 106: | Line 115: | ||
</ | </ | ||
+ | In the second step of the sequence A the sequence is started in its own thread. After this both run concurrently. The forth step of sequence A then waits for the sequence B to finish. | ||
The following figure shows the flow of action. | The following figure shows the flow of action. | ||
+ | {{ : |
eeros_architecture/sequencer/subsequence.1446195584.txt.gz · Last modified: 2015/10/30 09:59 by graf