Best Practices for Clock Synchronization in ADAS and AV Development

October 18, 2023
1 min read

Clock synchronization plays a crucial role in the development of advanced driver-assistance systems (ADAS) and autonomous vehicles (AVs). First, ADAS and AVs need to manage time accurately to be able to function safely. Second, during virtual testing, the practices used for clock synchronization can have a strong influence on development speed and costs. The decision of how to approach clock synchronization and which tools to build or adopt is thus an important one for every ADAS and AV team. 

In this blog post, we will discuss the challenges clock synchronization presents for ADAS and AV simulation. We will then describe our recommended best practices for managing clock synchronization to support ADAS and AV teams and accelerate their development and testing.

What Is Clock Synchronization?

An ADAS or AV is often implemented as a distributed software system—a collection of distinct components that need to communicate with each other and collaborate to achieve various tasks. These different components often source time from different clocks. Clock synchronization helps align all components with a common understanding of time. In a distributed ADAS or AV stack architecture, a perception module and a planning module need to have an accurate, common understanding of time to accurately predict the motion and intention of actors in the perceived scene.

Why Clock Synchronization Matters

There are three aspects that make clock synchronization crucial to ADAS and AV development.

Correctness

Clock synchronization ensures every component of the ADAS or AV has the same understanding of time, allowing the system to make the right decisions and achieve correct results in virtual testing. Inconsistent clock synchronization can cause system integration errors, as one minor instance of incorrect timekeeping can destabilize the entire system, even if each individual component reasons about its own time correctly. 

For example, collision avoidance and emergency braking systems need to process data quickly and accurately to meet safety-critical requirements. When each system component has the same understanding of time, all components are synchronized correctly and work in harmony, delivering the safety-critical functionality as intended.

Determinism

Determinism is essential to achieve reliable ADAS and AV behavior. Determinism means that, given a particular sequence of inputs, a system will always produce the same sequence of outputs. Simulators need to yield deterministic results to ensure reliable ADAS and AV testing. Without proper clock synchronization, differences in timestamps and operating system scheduling can prevent tasks from being executed with consistent and known timing. In other words, proper clock synchronization is necessary to achieve deterministic simulation results.

Scalability

Clock synchronization is also necessary for scaling ADAS and AV testing (i.e., running millions of simulation tests across an organization at varying levels of fidelity). Running simulations faster than real time, especially for smaller subsystem tests, helps ADAS and AV teams achieve high coverage while sacrificing less engineering time and saving computing costs. Running simulations slower than real time allows teams to integrate high-fidelity vehicle dynamics and sensor models and test behaviors that are otherwise only possible to create through real-world test methods. Without proper clock synchronization, running simulations faster or slower than in real time is not possible, slowing down development and ultimately leading to higher costs or even unsafe ADAS or AV stack behavior.

Why Clock Synchronization is Difficult

Despite being crucial for successful ADAS and AV development teams, clock synchronization can be one of the most challenging tasks those teams need to master.

  • Downstream errors: Managing and querying time is a fundamental, commonly used feature for a wide range of functionalities. Unfortunately, making changes to time management can cause issues downstream across a wide range of features.
  • Debugging: Debugging issues related to time mismanagement can be difficult, as errors are non-deterministic and can be mistaken for numerical precision errors. Only the most robust and comprehensive test infrastructure would be able to root cause time management errors correctly.
  • Cross-team collaboration: Within an organization, different teams develop different components of an ADAS or AV system. Coordinating and communicating best practices around time management across an organization’s many independent engineering teams can be challenging.
  • Increasing complexity: ADAS and AV teams often face the problem of implementing clock synchronization too late during the development process. Teams should aim to implement clock synchronization as early as possible during ADAS and AV development. The later teams introduce proper clock synchronization, the more they will struggle with bugs and regressions due to incorrect and non-deterministic simulation results, which get harder to fix with increasing system complexity.

Clock Synchronization Best Practices

We recommend that ADAS and AV teams adopt the following best practices for successful clock synchronization in their development process.

  • An easy-to-use and lightweight standard for defining and sharing timestamps: This standard should be implemented across an ADAS or AV program’s various engineering teams and define how to represent and handle time in the system’s different components.
  • A centralized library for managing time: To successfully approach clock synchronization, we recommend that teams abstract away the clock source to a centralized, common library focused on managing, querying, and reporting clock time in the system implementation. All components across the system should be able to query from this library. This makes it easy for teams to switch the clock source whenever they launch a new subsystem in the stack. It also protects against inadvertently depending on wall clock time (i.e., elapsed real time), for example, when brief busy-waits occur using wall clock time, which would then increase in a sped-up simulation.
  • A well-defined contract: This contract should allow system components to query time from a centralized time management library.
  • A task scheduling and execution control library: This library should provide a convenient abstraction for dispatching asynchronous, time-sensitive tasks.

Applied’s Approach

To carry out these best practices successfully, Applied works closely with development teams across the industry to:

  • Conduct education and training sessions for engineers, testers, operations, and infrastructure teams to create awareness and a common understanding of how clock synchronization should influence design, implementation, and operation.
  • Support compatibility and integration for a variety of different middleware and frameworks, including proprietary and in-house frameworks.
  • Help identify and prioritize the right software development processes so that ADAS and AV development can progress while new foundations are being laid.

Clock synchronization is an engineering best practice that allows ADAS and AV teams to create meaningful simulation tests, scale development, and build complex, safe systems that can be deployed with confidence. Through our simulation products, Object Sim*, Sensor Sim*, and Log Sim*, we help teams plan for or transition to the right clock synchronization practices for their needs. Contact us to learn more.

*Note: Object Sim was previously known as Simian, Sensor Sim was previously known as Spectral, and Log Sim was previously known as Logstream.