Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The callback function registered in start is called periodically until the timer is stopped, according to period, offset and the usage of simulated time. The following figures illustrate the role of the timer in combination with the LCC as central timing instance.

Real-time (TimerFD)

Real-time refers to the actual current time of the system, given by the system's current timestamp. To make sure that timestamps across different devices are comparable, NTP is used for clock synchronization on these devices. In a real-time scenario, all participants begin their computation (after being started either manually or by the LCC) at unix time 1 + period * n, where n is the smallest n such that the overall term is greater than or equal to the point in time when the timer was started. This assures synchronized periodic behavior for the registered components (using callbacks) across all devices. Real-time is useful whenever the system is used for real driving scenarios, e.g. when the actual physical vehicles are used.

The following drawing shows which role the LCC plays in the real-time timing case.

This timer's constructor also takes an optional parameter to re-define the stop-signal to another value than max. uint64_t. Do not change this value unless you know what you are doing and only if you want your timer not to react to a global stop signal within the system, but a custom one. (If you just want to ignore the stop signal, define your own, potentially empty, stop callback function and pass that when starting the timer)

"Real" time (SimpleTimer)

This timer is not intended to be used for actual real-time purposes. It can be used instead for GUI tools etc. to achieve periodic threaded callback of a function in periods which are multiples of 50 milliseconds. Apart from that, it works like the timer above (TimerFD).

This timer can be killed easier - while a TimerFD timer might take up to period_nanoseconds nanoseconds to be killed, the SimpleTimer is killed or destructed within ~50 milliseconds and thus does not block e.g. the UI for too long.

Simulated time

Simulated time refers to a fictional measure of time, that is not related to the unix time of the physical devices on which the different tasks operate. Instead, the current time is determined by a central timing instance, in this case by the LCC. Simulated time can be used to speed up or slow down the simulation of a scenario, which might help to detect errors, to improve the timing of the individual components or to test faster how the system operates on the long run.

...