User Tools

Site Tools


eeros_architecture:control_system:executor

This is an old revision of the document!


Executor

The executor is responsible to run various different time domains in separated threads of execution. The execution periods of different time domains are generally in a harmonic relationship to each other.

Harmonic Tasks

As the following figure shows each harmonic is run by its own thread of execution.  In this example we have the safety system as the main task. It has the fastest execution period together with the time domain 1. The time domain 2 runs with the same period but only after time domain 1 has finished. Time domain 3 has a harmonic relationship to the main task of 2.

Initialize the Executor

First you have to define the executor.

  eeros::Executor &executor = eeros::Executor::instance(); 

Next we have to define the main task. In general the main task will be the safety system. To make matters simple we omit the definition of the safety system. Please check for this in safetysystem.

  SafetySystem ss(properties, 0.001); // runs every millisecond
  executor.setMainTask(ss); 

Now we create time domains and add it to the executor.

  eeros::control::TimeDomain td1("td1", 0.001, true);
  executor.add(td1); 

This creates a time domain which should run in real-time with a period of 1 millisecond. Obviously the time domain has no blocks yet and therefore doesn't do any meaningful work yet.

You could also create a periodic task as a separate object and assign it a time domain as follows.

  eeros::control::TimeDomain td1("td1", 0.001, true);
  eeros::task::Periodic per1("per1", 0.001, td1);
  executor.add(per1); 

Finally you have to start the executor with:

  executor.run(); 

This call does not complete until you stop the main task with a special signal.

eeros_architecture/control_system/executor.1478331471.txt.gz · Last modified: 2016/11/05 08:37 (external edit)