Publisher scheduler: PublishingInterval of messages is not correctly enforced
Description
The publishingInterval period of messages is enforced by counting the number of call to the Publisher real time API heart beat function. But the Publisher scheduler module uses sleep and a counter incremented after each sleep to indicate tick values. Since a tick shall be provided on a regular basis with the declared time resolution, this mechanism does not guarantee the time elapsed between to ticks on which PublishingInterval is evaluated.
Fixes
- Provide parameter to configure the time resolution expected (or provided if using hardware IRQ to call the heart beat function)
- If IRQ simulated: simulate IRQ by measuring time elapsed between 2 loops iterations with a sleep of the time resolution configured. Call as many times as necessary the heart beat function if several ticks should have occurred between those 2 iterations
Using this mechanism enforces to be as precise as possible with the time resolution (without IRQ) and avoid the publishing interval to accumulate delay since we measure the time elapsed on each iteration. But since the sleep mechanism enforces only a minimum time of sleep, a spurious delay for publishing data is still possible. IRQ or equivalent are still necessary if we really want to enforce the tick is provided on a precise and regular basis.