User Tools

Site Tools


eeros_architecture:safety_system:usage

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
eeros_architecture:safety_system:usage [2016/11/04 09:52] – [Watchdog Output] grafeeros_architecture:safety_system:usage [2017/01/28 17:33] (current) – external edit 127.0.0.1
Line 2: Line 2:
 Every EEROS system can have exactly one safety system. As a first step you have to define your safety properties as described in [[eeros_architecture:safety_system:properties|]]. After this you create an instance of these properties and assign it to your safety system as follows  Every EEROS system can have exactly one safety system. As a first step you have to define your safety properties as described in [[eeros_architecture:safety_system:properties|]]. After this you create an instance of these properties and assign it to your safety system as follows 
 <code cpp> <code cpp>
-  MySafetyProperties safetyProperties; +MySafetyProperties safetyProperties; 
-  SafetySystem safetySys(safetyProperties, period);+SafetySystem safetySys(safetyProperties, period);
 </code> </code>
  
Line 9: Line 9:
  
 <code cpp> <code cpp>
-  // Create and run executor +// Create and run executor 
-  auto executor = eeros::Executor::instance(); +autoexecutor = eeros::Executor::instance(); 
-  executor.setPeriod(period); +executor.setMainTask(safetySys);
-  executor.setMainTask(safetySys);+
 </code> </code>
  
Line 24: Line 23:
   * the sequencer    * the sequencer 
  
 +An event can be triggered by the control system or the sequencer by calling:
 +<code cpp>
 +safetySys.triggerEvent(safetyProperties.seStartRunning);
 +</code>
 +Please make sure to declare a safety event public if triggered by the control system or the sequencer. Private event can be triggered solely by the safety system itself. 
  
  
-====== Safety System Usage ====== 
-Since the safety system and the HAL (hardware abstraction layer or hardware access layer) are strongly coupled it makes sense to show the usage of both systems on this page. 
  
  
-Sometimes you need to fire an event e.g. swInitDone: 
-<code c> 
-safetySys.triggerEvent(swInitDone, privateContext); 
-</code> 
  
-The C-style definition in class //SafetySystem//: 
-<code c> 
-void triggerEvent(uint32_t event); 
-</code> 
  
- 
-===== Setting Up The System ===== 
- 
-Before the safety system can be started, you have to define the entry level: 
-<code c> 
-safetySys.setEntryLevel(off); 
-</code> 
- 
-Finally assign the safety system as the main task of the executor, so that the //run()// method will be called periodically (every millisecond, for example).  
-<code c> 
-executor.setMainTask(safetySys); 
-</code>  
eeros_architecture/safety_system/usage.1478249560.txt.gz · Last modified: 2016/11/04 09:52 by graf