User Tools

Site Tools


getting_started:practical_problems:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:practical_problems:start [2017/09/24 16:37] – [How to Stop a System with CTRL-C] grafgetting_started:practical_problems:start [2018/04/17 14:54] (current) – [Do's] graf
Line 6: Line 6:
   * [[.:rem_unused_blocks]]   * [[.:rem_unused_blocks]]
   * [[.:auto_switch]]   * [[.:auto_switch]]
 +  * [[.:abort]] 
 +  * [[.:realtime]] 
 +  * [[.:monitor]]
 ===== Don'ts ===== ===== Don'ts =====
-[[.:hidden_states|]]+  * [[.:hidden_states]] 
 +  * [[.:seq_endless]]
 ===== Stumbling Blocks ===== ===== Stumbling Blocks =====
   * [[.:faults_cs]]   * [[.:faults_cs]]
   * [[.:add_saf_level]]   * [[.:add_saf_level]]
- +  * [[.:no_log]]
- +
- +
- +
- +
- +
-===== Block with Parameters ===== +
-Situation: inner states of blocks can be changed only through signals or getter / setter methods. How to implement a slowly changing inertia matrix? You do not want to calculate this matrix out of regular signals with full speed. Solution: use slow time domain for this purpose and change ... +
- +
-====== 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:tutorials:safetysystem|]]First of all you have to define a signal handler which handles all kind of signals, among them the ''SIGINT'' signal which is sent by pressing ''Ctrl-C''+
-<code cpp> +
-#include "MySafetyProperties.hpp> +
-#include <signal.h> +
- +
-void signalHandler(int signum) { +
- SafetySystem::exitHandler(); +
-+
- +
-int main() { +
-  signal(SIGHUP, signalHandler); +
-  signal(SIGINT, signalHandler); +
-  signal(SIGQUIT, signalHandler); +
-  signal(SIGKILL, signalHandler); +
-  signal(SIGTERM, signalHandler); +
-  signal(SIGPWR, signalHandler); +
- +
-  ... +
-   +
-  // Create and initialize safety system +
-  double period = 1; +
-  MySafetyProperties ssProperties; +
-  SafetySystem safetySys(ssProperties, period); +
-  +
-  ...  +
-+
-</code> +
- +
-The ''exitHandler'' in the safety system runs a predefined exit function which must be defined in your safety properties. +
-<code cpp> +
-exitFunction = [&](SafetyContext* privateContext) { +
-  privateContext->triggerEvent(seShutDown); +
-}; +
-</code> +
-In the example this function triggers a safety event ''seShutDown''. You have to add this event to all safety levels where you actually want to allow shutting down the machine. +
- +
-After pressing ''Ctrl-C'' the safety system will go into the safety level ''slShuttingDown'', see example in [[getting_started:tutorials:safetysystem|]]. +
-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, ''seSwitchingOff'' is triggered which leads to a safety level change to ''slOff''. The action to be taken in this level is stopping the executor. Therefore, you have to assign a level action in your safety properties as follows: +
-<code cpp> +
-slOff.setLevelAction([&](SafetyContext* privateContext) {Executor::stop();}); +
-</code> +
-This will cause the executor to stop running and return control to the main programm which in turns will exit. +
-===== How to interact between Sequencer and Control System ===== +
-Seq soll signale in CS setzen (const) oder lesen \\ +
  
getting_started/practical_problems/start.1506263849.txt.gz · Last modified: 2017/09/24 16:37 (external edit)