Clocks in Parrot Sphinx#

A particular care has been taken to fake the clocks seen by the simulated firmware. The goal pursued is to make sure the firmware runs at the same pace as the simulated world, including physics, sensors, motors, etc. Two clocks are simulated:

  • the monotonic clock

  • the Real-Time Clock (RTC)

They tick when the “world” gets updated. If for any reason an update step takes longer than before, the interval between two consecutive ticks will also be longer. In other words, with respect to the simulation computation load, the simulated clocks can be quite irregular and slower than the system clock of the workstation.

During a simulation, an estimated real-time factor can be observed through the dashboard, like in the graph below. The more the factor is close to 100%, the more the simulation is running in real-time.

_images/real_time_graph.png

sphinx offers some command line options to modify the behavior of the simulated clocks.

  • --rt-percent=<percents> provides a target in term of real-time factor. The default value is 100. It can be useful to slow down the simulation to make an observation with more accuracy. Note that this parameter can also be written using the Web dashboard or sphinx-cli. See HERE.

  • --time=<rtc|epoch> tells Parrot Sphinx to start the simulated RTC clock at an arbitrary time expressed in seconds since the Epoch if the value is a number. If the value is rtc, which is the default mode, the simulated RTC clock is exactly the same as the host’s. As a consequence, in this mode the monotonic clock and the RTC clock are NOT running at the same speed. This mode is recommended when the simulated drone communicates with external devices (like smartphones or Web servers).