tools:logger_cs:start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:logger_cs:start [2017/12/21 13:49] – [Headline] graf | tools:logger_cs:start [2018/05/31 10:32] (current) – graf | ||
---|---|---|---|
Line 17: | Line 17: | ||
One must keep in mind that the periodic task which runs the control system and the periodic task which does the logging are actually running in parallel. This might lead to complication as soon as more complex signals are involved. For this reason, it might be preferable to choose the following solution. | One must keep in mind that the periodic task which runs the control system and the periodic task which does the logging are actually running in parallel. This might lead to complication as soon as more complex signals are involved. For this reason, it might be preferable to choose the following solution. | ||
<code cpp> | <code cpp> | ||
- | TimeDomain td(" | + | |
- | Periodic perCS(" | + | |
executor.add(perCS); | executor.add(perCS); | ||
perCS.after.push_back(perLog); | perCS.after.push_back(perLog); | ||
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. | ||
- | ====== Headline ====== | + | ===== Log in the Task of the Time Domain |
- | It is also possible to add the logging to the monitors one of the currently running task of the control system. | + | It is also possible to add the logging to the monitors |
+ | <code cpp> | ||
+ | double period = 0.001; | ||
+ | eeros:: control:: | ||
+ | eeros:: | ||
+ | perCS.monitors.push_back([& | ||
+ | static int ticks = 0; | ||
+ | if ((++ticks * period) < 1) return; | ||
+ | ticks = 0; | ||
+ | log.info() << controlSystem.myBlock.getOut().getSignal(); | ||
+ | }); | ||
+ | |||
+ | // and further down the code | ||
+ | executor.add(perCS); | ||
+ | </ | ||
+ | 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.1513860586.txt.gz · Last modified: 2017/12/21 13:49 by graf