# Real-Time Robotics Framework

### Sidebar

eeros_architecture:safety_system:usage

# Setup a Safety System

Every EEROS system can have exactly one safety system. As a first step you have to define your safety properties as described in Safety Properties. After this you create an instance of these properties and assign it to your safety system as follows

MySafetyProperties safetyProperties;
SafetySystem safetySys(safetyProperties, period);

The executor will later run the safety system as its main task. The safety system will always be the task with the highest run frequency. The parameter period determines this frequency.

// Create and run executor
auto& executor = eeros::Executor::instance();
executor.setMainTask(safetySys);

## Changing the Safety Level

The central attribute of the safety system is its currentLevel. Of course, this level can be queried by everyone but only set by the safety system itself. The only possibility to change the safety level is through the method triggerEvent.
Triggering an event can be done by

• the safety system itself (as a level action or by checking an critical input)
• the control system through a special SignalChecker block
• the sequencer

An event can be triggered by the control system or the sequencer by calling:

safetySys.triggerEvent(safetyProperties.seStartRunning);

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.