Skip to content

Improve Clock Synchronization Between Simulator and Unreal Engine #42

@jonyMarino

Description

@jonyMarino

Overview

The current implementation of the simulation clock in clock.cpp relies on an operating system thread for time progression ([see line 210](

th_ = std::thread(&ScheduledExecutor::ExecutorLoop, this);
)). This approach introduces desynchronization between the simulation clock and Unreal Engine's internal clock, potentially impacting determinism and real-time fidelity in simulations that utilize Unreal Engine assets relying on UE's timing.

Enhancement Details

We propose refactoring the clock mechanism to eliminate the dependency on a separate OS-level thread. Instead, the simulation clock should be driven by Unreal Engine's main tick or another deterministic timing source provided by the engine. This would:

  • Ensure tighter integration and synchronization with Unreal Engine's frame updates.
  • Improve determinism and reproducibility of simulation results.
  • Reduce timing drift during prolonged simulation runs.

A similar solution exists in CARLA, which could serve as a reference or be adapted for ProjectAirSim.

Type of Request

  • Enhancement
  • New Feature
  • Other (please specify)

Justification

Tightly synchronizing the simulation clock with Unreal Engine is essential for scenarios involving Unreal Engine assets that depend on UE's clock. It also enhances determinism in simulations that rely on UE-based features such as collision detection and image acquisition.

We welcome discussion on implementation strategies and are open to contributing to this enhancement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clockenhancementNew feature or requesthelp wantedExtra attention is neededroadmapPart of the official roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions