getting_started:practical_problems:abort
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
getting_started:practical_problems:abort [2017/09/25 07:38] – graf | getting_started:practical_problems:abort [2017/11/05 13:32] – [Define Signal Handler when using ROS] graf | ||
---|---|---|---|
Line 7: | Line 7: | ||
void signalHandler(int signum) { | void signalHandler(int signum) { | ||
- | SafetySystem:: | + | |
} | } | ||
int main() { | int main() { | ||
- | signal(SIGHUP, | ||
signal(SIGINT, | signal(SIGINT, | ||
- | signal(SIGQUIT, | ||
- | signal(SIGKILL, | ||
- | signal(SIGTERM, | ||
- | signal(SIGPWR, | ||
... | ... | ||
Line 40: | Line 35: | ||
The system will stay in the level as long as the shutting down will take. This could include a whole sequence of steps such as applying brakes or driving to a safe position. As soon as this point is reached another safety event, '' | The system will stay in the level as long as the shutting down will take. This could include a whole sequence of steps such as applying brakes or driving to a safe position. As soon as this point is reached another safety event, '' | ||
<code cpp> | <code cpp> | ||
- | slOff.setLevelAction([& | + | slOff.setLevelAction([& |
+ | | ||
+ | Sequencer:: | ||
+ | }); | ||
+ | </ | ||
+ | This will cause the executor to stop running and return control to the main programm. Further, any running sequences will terminate and the main program will exit. | ||
+ | |||
+ | ===== Define Signal Handler when using ROS ===== | ||
+ | If you use ROS you have to keep in mind to register the signal handler only after the | ||
+ | <code cpp> | ||
+ | #include " | ||
+ | #include < | ||
+ | |||
+ | void signalHandler(int signum) { | ||
+ | SafetySystem:: | ||
+ | } | ||
+ | |||
+ | int main() { | ||
+ | signal(SIGINT, | ||
+ | |||
+ | ... | ||
+ | |||
+ | // Create and initialize safety system | ||
+ | double period = 1; | ||
+ | MySafetyProperties ssProperties; | ||
+ | SafetySystem safetySys(ssProperties, | ||
+ | |||
+ | ... | ||
+ | } | ||
</ | </ | ||
- | This will cause the executor to stop running and return control to the main programm which in turns will exit. |
getting_started/practical_problems/abort.txt · Last modified: 2024/02/16 08:16 by ursgraf