getting_started:tutorials:mockrobot
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started:tutorials:mockrobot [2020/12/03 13:21] – [Sequencer] ursgraf | getting_started:tutorials:mockrobot [2021/03/31 17:45] (current) – [Safety System] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Mock Robot Example ====== | ====== Mock Robot Example ====== | ||
- | This tutorial demonstrates an EEROS application complete with a control system, a safety system, and a sequencer. You can find the code in the directory with the examples. Start the program with | + | This tutorial demonstrates an EEROS application complete with a control system, a safety system, and a sequencer. You can find the code under [[https:// |
+ | |||
+ | Start the program with | ||
<code cpp> | <code cpp> | ||
$ sudo ./ | $ sudo ./ | ||
Line 46: | Line 48: | ||
===== Safety System ===== | ===== Safety System ===== | ||
The safety system has four levels and a couple of safety events to switch between these levels. | The safety system has four levels and a couple of safety events to switch between these levels. | ||
- | [{{ : | + | [{{ : |
The event '' | The event '' | ||
Line 102: | Line 104: | ||
MoveUp(std:: | MoveUp(std:: | ||
int action() { | int action() { | ||
- | | + | |
- | cs.setpointY.setValue(0.3); | + | cs.pp.move(dest); |
+ | return | ||
} | } | ||
- | bool checkExitCondition() {return cs.iX.getOut().getSignal().getValue() >= 5.0;} | + | bool checkExitCondition() {return cs.pp.endReached();} |
MockRobotControlSystem& | MockRobotControlSystem& | ||
}; | }; | ||
Line 113: | Line 116: | ||
MoveDown(std:: | MoveDown(std:: | ||
int action() { | int action() { | ||
- | cs.setpointX.setValue(-0.6); | + | |
- | | + | |
+ | | ||
} | } | ||
- | bool checkExitCondition() {return cs.iX.getOut().getSignal().getValue() <= -5.0;} | + | bool checkExitCondition() {return cs.pp.endReached();} |
- | private: | + | |
MockRobotControlSystem& | MockRobotControlSystem& | ||
}; | }; | ||
Line 133: | Line 136: | ||
moveDown(); | moveDown(); | ||
} | } | ||
+ | return 0; | ||
} | } | ||
- | private: | ||
MoveUp moveUp; | MoveUp moveUp; | ||
MoveDown moveDown; | MoveDown moveDown; |
getting_started/tutorials/mockrobot.1606998067.txt.gz · Last modified: 2020/12/03 13:21 by ursgraf