User Tools

Site Tools


getting_started:tutorials:controlsystem

This is an old revision of the document!


Create a Control System

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

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

Next we have to define the periodic task which should be run by the executor as its main task. In general this will be the safety system. To make matters simple we define a periodic task which does nothing and assign it to the main task.

  eeros::Executor &executor = eeros::Executor::instance(); 
  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.1477035949.txt.gz · Last modified: 2016/10/21 09:45 (external edit)