Optimizing Real-Time Performances for Timed-Loop Racing under F1TENTH

Nitish Gupta, Kurt M. Wilson, Zhishan GuoarXiv 2022 · DOI · arXiv

Abstract

High-speed autonomous racing requires rapid control decisions, yet sophisticated algorithms like Model Predictive Contouring Control (MPCC) often impose significant computational burdens on embedded hardware. This paper presents a multi-threaded ROS2 framework designed to parallelize optimization solvers, effectively reducing command latency and jitter on the F1TENTH racing platform. By implementing a thread-pooling strategy with stale result protection, the proposed system achieves more consistent real-time performance, enabling more stable high-speed navigation.

Introduction

In autonomous racing, the latency of the control loop is a critical factor for vehicle stability and performance. Vehicles frequently employ Model Predictive Control (MPC) to solve complex optimization problems at each time step. However, on resource-constrained embedded systems such as the Nvidia Jetson Xavier AGX, the computation time for these solvers often exceeds the sensor data arrival rate. This "publish latency" results in the vehicle operating on stale information, which can lead to instability or collisions at high speeds. This research addresses these challenges by optimizing the mpcController node through a multi-threaded architecture.

System Architecture and Methods

The proposed solution utilizes a multi-threaded ROS2 framework to parallelize the execution of the MPC solver. The architecture integrates various sensor inputs—Lidar, IMU, and Odometry—into a pipeline for mapping, localization, and state estimation, which then feeds into the Model Predictive Control module.

System architecture of the autonomous racing platform, showing the flow from sensors to control.

The core of the optimization lies in several key strategies:

  • Thread Pooling: A pool of worker threads allows the system to initiate new optimization tasks based on the latest state while previous calculations are still in progress.
  • MIN_GAP Strategy: To avoid CPU saturation from redundant data, a 10ms minimum gap is enforced between consecutive optimization triggers. This recognizes that solving for vehicle states only 1ms apart provides diminishing returns.
  • Stale Result Protection: A synchronization mechanism using last_output_time ensures that if an older thread finishes after a newer one due to OS scheduling, its stale command is discarded.
  • Real-Time Tuning: Worker threads are pinned to specific CPU cores with high priority to minimize OS-level interference and ensure predictable performance.

Experimental Evaluation

The system was evaluated on an Nvidia Jetson AGX Xavier running ROS2 Humble on a real-time Linux kernel. The experiments focused on the publishing interval of control commands under varying thread counts.

Box plot showing the reduction in publish interval and jitter as the number of threads increases.

The results demonstrate a clear improvement in performance as more threads are added:

  • Single Thread: The maximum control publish interval reached approximately 50ms, which is often too slow for high-speed racing.
  • Two Threads: The absolute maximum interval dropped to 30ms.
  • Three Threads: The system was able to maintain a publishing rate very close to the 10ms target, significantly decreasing the variance (jitter) of the publishing interval.

Discussion and Key Insights

The study highlights that effective parallelization in real-time robotics requires more than just adding threads; it requires intelligent task management. The MIN_GAP strategy ensures that computational resources are spent on meaningfully different vehicle states. Furthermore, the implementation of timestamp checks is vital for safety in asynchronous environments, preventing "time-traveling" commands where older results might overwrite newer ones. Reducing jitter is shown to be as crucial as reducing average latency for maintaining vehicle stability.

Conclusion and Future Work

While multi-threading significantly enhances real-time performance, it increases CPU utilization, necessitating careful management to avoid starving other critical processes like Lidar processing or localization. Future work will explore offloading expensive matrix calculations to the Jetson's onboard GPU and validating the system in head-to-head racing scenarios to assess its robustness against the unpredictability of other vehicles.

Summary updated

BibTeX
@misc{gupta2022optimizing,
  author = {Nitish Gupta and Kurt M. Wilson and Zhishan Guo},
  title = {{Optimizing Real-Time Performances for Timed-Loop Racing under F1TENTH}},
  year = {2022},
  eprint = {2212.04549},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.04549},
}
Figure