Law-aware autonomous driving - SUN, Yang (Institutional Knowledge at Singapore Management University, 2024)
Autonomous driving systems (ADSs) necessitate comprehensive testing prior to deployment in Autonomous Vehicles (AVs). High-fidelity simulators are crucial for this testing, as they can replicate a wide range of scenarios, including those that are difficult or dangerous to recreate in real-world conditions. While previous approaches have demonstrated that test cases can be generated automatically, they often focus on weak oracles (e.g., reaching the destination without collisions) and fail to assess whether the journey was conducted safely and in compliance with some complex property specifications such as traffic laws. In this dissertation, beyond assessing basic properties like energy consumption and proximity to obstacles, we develop a series of approaches that enable us to evaluate whether an ADS conforms to complex property specifications such as traffic laws. Furthermore, we propose systematic approaches to enhance the ADS, ensuring law/regulation conformance. Firstly, we introduce LawBreaker, an automated framework for testing ADSs against real-world traffic laws. Designed to be compatible with various scenario description languages, LawBreaker offers a rich driver-oriented specification language for describing complex property specifications such as traffic laws, and a fuzzing engine that searches for different ways of violating them by maximising specification coverage. Implemented for Apollo+LGSVL with Chinese traffic laws, LawBreaker was able to find 14 violations of these laws. Secondly, we explore methods for creating `natural' scenarios by manipulating the positions of commonly encountered roadside objects without using `unnatural' adversarial patches. These scenarios adhere to regulatory guidelines for object placement on public streets. Our fuzzing algorithm identifies scenarios where repositioned objects cause significant AV misperceptions, such as misinterpreting traffic light colors, leading to traffic law violations. Implemented for Apollo, our approach induced violations of 15 out of 24 traffic laws. Recognizing that state-of-the-art ADSs can violate traffic laws in certain scenarios, we introduce REDriver in our third work. This rule-based method enforces AV adherence to complex property specifications at runtime. REDriver uses LawBreaker's property specification language to monitor the ADS's planned trajectory with quantitative Signal Temporal Logic (STL) semantics and employs a gradient-driven algorithm to adjust the trajectory when a violation is likely to happen. Tested on two versions of Apollo against Chinese traffic laws, REDriver significantly improved conformance with minimal overhead. However, REDriver's repairs are limited in scope, lack transparency, and are intended as a last resort. To address these limitations, our final work proposes FixDrive, a framework that analyzes near-miss records or law violations to generate AV driving strategy repairs, reducing future incidents. These repairs are captured in uDrive, a high-level domain-specific language for specifying driving behaviors based on event triggers. Implemented for Apollo, FixDrive uses a Multi-Modal Large Language Model (MLLM) with zero-shot learning to generate uDrive programs from AV incident recordings. We tested FixDrive on various benchmark scenarios and found that the generated repairs improved the AV's performance in terms of following traffic laws, avoiding collisions, and successfully reaching destinations. Additionally, the cost of repairs—15 minutes of analysis and $0.08 per violation—proved practical and reasonable.