User Tools

Site Tools


getting_started:tutorials:controlsystem

Control System with One Time Domain

A simple control system consists of a single time domain which has to be run periodically by the excutor. Write your main program as follows. First you have to define the executor and set ist own speed. The executor runs its own periodic task, the main task.

  eeros::Executor &executor = eeros::Executor::instance(); 
  executor.setPeriod(0.001); // runs every millisecond

Next we have to define this 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;
  executor.setMainTask(ss); 

Now we create a time domain 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. We could add a second time domain which runs just …

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

  eeros::control::TimeDomain td3("td3", 0.004, true);
  eeros::task::Periodic per3("per3", 0.004, td3);
  executor.add(per3); 
getting_started/tutorials/controlsystem.txt · Last modified: 2016/10/23 10:28 by graf