getting_started:tutorials:stoppingsystem
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
getting_started:tutorials:stoppingsystem [2016/11/07 09:07] – graf | getting_started:tutorials:stoppingsystem [2017/09/24 16:39] (current) – removed graf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Shutting down a System ====== | ||
- | How does a robot control system properly shut down? In general it does never stop. Pressing an emergency button might switch to a emergency safety level. However, in a system under development it is often desirable to end an application. That usually means to switch to a specific safety level where the necessary steps for a well controlled stopping of the application takes place. Only after this happened the executor stops running and returns control to the main program, which then stops as well. \\ | ||
- | The following example shows how this can be accomplished. The code can be found in [[getting_started: | ||
- | <code cpp> | ||
- | #include " | ||
- | #include < | ||
- | void signalHandler(int signum) { | ||
- | SafetySystem:: | ||
- | } | ||
- | |||
- | int main() { | ||
- | signal(SIGHUP, | ||
- | signal(SIGINT, | ||
- | signal(SIGQUIT, | ||
- | signal(SIGKILL, | ||
- | signal(SIGTERM, | ||
- | signal(SIGPWR, | ||
- | |||
- | ... | ||
- | | ||
- | // Create and initialize safety system | ||
- | double period = 1; | ||
- | MySafetyProperties ssProperties; | ||
- | SafetySystem safetySys(ssProperties, | ||
- | |||
- | ... | ||
- | } | ||
- | </ | ||
- | |||
- | The '' | ||
- | <code cpp> | ||
- | exitFunction = [& | ||
- | privateContext-> | ||
- | }; | ||
- | </ | ||
- | In the example this function triggers a safety event '' | ||
- | |||
- | After pressing '' | ||
- | 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> | ||
- | slOff.setLevelAction([& | ||
- | </ | ||
- | This will cause the executor to stop running and return control to the main programm which in turns will exit. |
getting_started/tutorials/stoppingsystem.1478506042.txt.gz · Last modified: 2016/11/07 09:07 by graf