User Tools

Site Tools


eeros_architecture:safety_system:usage

This is an old revision of the document!


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.setPeriod(period);
  executor.setMainTask(safetySys);

Changing the Safety Level

The only possibility to change the safety level is through the method triggerEvent.

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:

safetySys.triggerEvent(swInitDone, privateContext);

The C-style definition in class SafetySystem:

void triggerEvent(uint32_t event);

Watchdog Output

The last thing to do, is to set an watchdog output, which will be toggled on every execution of run(). This can easily be done with:

SystemOutput<bool>* watchdog = hal.getLogicSystemOutput("watchdog");
safetySys.setWatchdogOutput(watchdog);

Setting Up The System

Before the safety system can be started, you have to define the entry level:

safetySys.setEntryLevel(off);

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).

executor.setMainTask(safetySys);
eeros_architecture/safety_system/usage.1478249384.txt.gz · Last modified: 2016/11/04 09:49 by graf