User Tools

Site Tools


tools:logger_cs:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:logger_cs:start [2017/12/21 13:52] graftools:logger_cs:start [2018/05/31 10:32] (current) graf
Line 24: Line 24:
 Now, the logging will be done after the control system task has finished running. Now, the logging will be done after the control system task has finished running.
  
-====== Log in the Same Task ======+===== Log in the Task of the Time Domain =====
 It is also possible to add the logging to the monitors of one of the currently running task of the control system. This could be done as follows: It is also possible to add the logging to the monitors of one of the currently running task of the control system. This could be done as follows:
 <code cpp> <code cpp>
-  TimeDomain td("time domain CS", 0.001, true);  // time domain for the control system running with 1kHz +  double period = 0.001; 
-  Periodic perCS("periodic CS", 0.001, td);      // periodic task running the time domain +  eeros:: control::TimeDomain td("time domain CS", period, true);  // time domain for the control system running with 1kHz 
-  eeros::task::Periodic perLog("periodic log", 1, l1); +  eeros::task::Periodic perCS("periodic CS", period, td);      // periodic task running the time domain 
-  perLog.monitors.push_back([&](PeriodicCounter &pc, Logger &log){+  perCS.monitors.push_back([&](PeriodicCounter &pc, Logger &log){ 
 +    static int ticks = 0; 
 +    if ((++ticks * period) < 1) return; 
 +    ticks = 0;
     log.info() << controlSystem.myBlock.getOut().getSignal();     log.info() << controlSystem.myBlock.getOut().getSignal();
   });   });
   
   // and further down the code   // and further down the code
-  executor.add(perLog);+  executor.add(perCS);
 </code> </code>
 +Please note that you usually want the logging to happen at a much smaller frequency than the time domain. For this, you have to reduce this frequency as shown in the example above.
 +
 +
 +
tools/logger_cs/start.1513860744.txt.gz · Last modified: 2017/12/21 13:52 by graf