getting_started:tutorials:sequencer4
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started:tutorials:sequencer4 [2018/08/28 10:51] – [Alternative Solution] graf | getting_started:tutorials:sequencer4 [2021/03/31 15:40] (current) – [Monitor Checking two Sequences] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to Organize Sequences and Steps ====== | ||
- | Sometimes its not obvious what sould go into a separate step and what to pack directly into a sequence. Let's study the following example. \\ | ||
- | A robot finished a homing sequence. It should move to a ready position before further action can happen. For this purpose a sequence '' | ||
- | <code cpp> | ||
- | class Readying : public Sequence { | ||
- | public: | ||
- | Readying(std:: | ||
- | int action() { | ||
- | cs.pathPlanner.move(readyPos); | ||
- | } | ||
- | |||
- | bool checkExitCondition() { | ||
- | bool end = cs-> | ||
- | if (end) safetySystem-> | ||
- | return end; | ||
- | } | ||
- | }; | ||
- | </ | ||
- | The sequence consists of a single action - set the final destination of the path planner. It will terminate as soon as the path planner has reached this position. Before returning it will trigger a safety event which causes the safety system to switch to the next level. | + | ====== Sequence with two Monitors ====== |
- | ===== Alternative Solution ===== | + | In the EEROS library you will find a directory with examples. For this example see [[https://github.com/eeros-project/eeros-framework/ |
- | The same goal as above could be achieved as follows: | + | |
- | <code cpp> | + | |
- | class Move : public Step { | + | |
- | Move(std:: | + | |
- | + | ||
- | int action() { | + | |
- | cs.pathPlanner.move(readyPos); | + | |
- | } | + | |
- | + | ||
- | bool checkExitCondition() { | + | |
- | return cs-> | + | |
- | } | + | |
- | } | + | |
- | class Readying : public Sequence { | + | Open a shell in the build directory of your EEROS library and run |
- | public: | + | < |
- | | + | $ ./ |
+ | </ | ||
+ | |||
+ | This example shows a sequence with two associated monitors. The '' | ||
+ | [{{ .:sequencerexample4.png? | ||
+ | \\ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Altering the Monitor Behavior ==== | ||
+ | Change the behavior of '' | ||
+ | If you change the behavior of the timeout monitor to '' | ||
+ | |||
+ | ===== Monitor Checking two Sequences ===== | ||
+ | The next example is [[https:// | ||
+ | Open a shell in the build directory of your EEROS library and run | ||
+ | < | ||
+ | $ ./ | ||
+ | </ | ||
+ | |||
+ | This example shows a sequence with two associated monitors. The '' | ||
+ | [{{ .: | ||
+ | \\ | ||
- | int action() { | ||
- | move(readyPos); | ||
- | if (Sequencer:: | ||
- | } | ||
- | private: | ||
- | Move move; | ||
- | }; | ||
- | </ | ||
- | This time '' | ||
getting_started/tutorials/sequencer4.txt · Last modified: 2021/03/31 15:40 by ursgraf