You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Synchronization across all participants in the RTI DDS network is very important for all tasks that are performed on a regular basis and require up-to-date information from other participants in the network to perform these tasks properly. A simple example for such tasks is caused by the mutual dependency between LLCs and HLCs: LLCs require regularly updated commands from the HLCs to maneuver crash-free and as desired according to e.g. their planned trajectory, whereas the HLCs need up-to-date vehicle states from the LLCs to calculate commands that accommodate the current state of the overall system. Synchronization allows to coordinate different tasks across the network and gives some guarantees about the shared information.



CPM Timer

The timer class can be used to call tasks periodically, based either on the system clock or the simulated time which is controlled by the LCC. It can wait for a central start signal and can be stopped when a stop signal is sent (both by the LCC). Thus, timers on multiple systems can be started at the same time, and then work simultaneously if their period is set accordingly as well.

Several parameters must be set to use to cpm timer:

  • node_id (String): The unique ID identifying the timer in the network, so that the LCC can tell different timer signals apart
  • period_nanoseconds (uint64_t): The callback function of the timer is called every period_nanoseconds nanoseconds
  • offset_nanoseconds (uint64_t): Initial offset - 1 in real-time case (offset from unix timestamp 0), first callback time in simulated time case
  • wait_for_start (bool): If false, real-time timing is started without waiting for the LCC - this parameter is ignored by the timer that uses simulated time, as there it is required to listen to a central timing instance
  • simulated_time_allowed (bool): Specify whether the task can be performed using simulated instead of real-time
  • simulated_time (bool): Indicates if simulated or real time should be used

The callback function is registered within the start(...) function. The timer can be started synchronously, blocking / using the current thread until it was stopped, or asynchronously in a new thread, using start_async(...). It can either be stopped manually using stop(), which is especially useful if the LCC is not used for real-time timing purposes, or it can be stopped with an LCC command.

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.

















  • No labels