User Tools

Site Tools


tools:logger_cs:start

This is an old revision of the document!


Logging Signals in the Control System

Usually the control system runs with a rather high frequency, that is, its period is low. If you want to log signals in the control system it is advisable to use a much lower frequency in order not to clog the output stream. This can be accomplished by defining a periodic function with the desired frequency and add it to the executor.

  Lambda l1 ([&] () { });
  Periodic periodic("per1", 1, l1);
  periodic.monitors.push_back([&](PeriodicCounter &pc, Logger &log){
    log.info() << controlSystem.myBlock.getOut().getSignal();
  });
 
  // and further down the code
  executor.add(periodic);

The lambda function is necessary so that the periodic knows what to do, though it actually does nothing, as the function is empty.
For more complete examples see examples/controlsystem/BlockTest2 and examples/controlsystem/BlockTest3.

tools/logger_cs/start.1493041384.txt.gz · Last modified: 2017/04/24 15:43 by graf