eeros_architecture:sequencer:step_or_sequence
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | eeros_architecture:sequencer:step_or_sequence [2019/03/14 09:25] – created graf | ||
---|---|---|---|
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. | ||
+ | |||
+ | ===== Alternative Solution ===== | ||
+ | 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 { | ||
+ | public: | ||
+ | Readying(std:: | ||
+ | |||
+ | int action() { | ||
+ | move(readyPos); | ||
+ | if (Sequencer:: | ||
+ | } | ||
+ | private: | ||
+ | Move move; | ||
+ | }; | ||
+ | </ | ||
+ | This time '' | ||
eeros_architecture/sequencer/step_or_sequence.txt · Last modified: 2020/05/22 11:10 by ursgraf