Multi-target game test scene generation method for automatic driving field test
By integrating multi-agent collaborative strategies and dynamic optimization logic through the Conditional Guided Diffusion Model (CGDM), the problems of poor background vehicle coordination, insufficient scene consistency, and lack of multi-agent interaction in the generation of closed-site test scenarios for autonomous driving are solved. This enables efficient and flexible scene generation and verification, supporting closed-site simulation and real-vehicle verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TONGJI UNIV
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-12
AI Technical Summary
Existing methods for generating test scenarios in closed-site autonomous driving environments suffer from poor coordination of background vehicles, insufficient scenario consistency, lack of multi-agent interaction, and fixed parameter configurations. This results in test scenarios being disconnected from real-world road behavior, low generation efficiency, and high data dependency.
The Conditional Guided Diffusion Model (CGDM) is adopted to integrate multi-agent collaborative strategies and dynamic optimization logic. Through the whole process design of scene information collection, unified encoding, customized constraints, dynamic loss generation and trajectory decoding, a structured scene conforming to the OpenSCENARIO standard is generated, which supports the generation of dynamic loss functions and multi-agent collaborative trajectory optimization for customized needs.
It achieves completeness and contextual relevance in scene generation, supports closed-site simulation and real-vehicle verification, improves the flexibility and consistency of scene generation, and ensures the matching degree between test scenarios and real road behavior.
Smart Images

Figure CN122021877A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of autonomous driving testing technology, and in particular relates to a method for generating multi-objective game test scenarios for autonomous driving field testing. Background Technology
[0002] While real-world road testing can capture a large number of dynamic interaction scenarios, its uncontrollable nature in complex environments makes it difficult to accurately quantify and verify the functional boundaries of autonomous driving systems. On the other hand, while closed-site testing offers advantages in repeatability and controllability, it often suffers from a disconnect between scenario design and real-world road environments, as well as limited data sources, resulting in test results that fail to effectively reflect the actual performance of the system. Safety verification of autonomous driving systems relies on the controllability and repeatability of closed-site testing, but existing scenario generation methods have core flaws: traditional rule-based methods have fixed parameters and can only cover simple scenarios; search-based methods lack multi-agent collaborative logic, resulting in poor scenario interactivity; traditional generation models are prone to trajectory logic breaks and insufficient environmental adaptability; and existing solutions cannot dynamically adapt generation strategies to customized testing needs, leading to a disconnect between test scenarios and real-world road behavior, making it difficult to accurately verify the decision-making and planning boundaries of autonomous driving systems.
[0003] The existing methods for generating closed test site scenarios for autonomous driving are mainly divided into three categories, and their core logic and limitations are as follows: (1) Traditional closed test site method: Implementation steps: ① Experts define scenario templates based on test requirements; ② Set fixed parameters through parameterization tools; ③ Generate static scenarios and import them into the cloud platform for testing. Core structure: Relies on "scenario template library + parameter configuration module". The template library stores predefined road structures and test subject association rules. (2) Scenario generation method based on search optimization: Implementation steps: ① Define the objective function and determine scenario variables (such as background vehicle entry angle and speed); ② Use heuristic algorithms (such as genetic algorithms and particle swarm optimization) to iteratively search in the high-dimensional variable space to find parameter combinations that satisfy "key scenarios" (such as TTC≤1.5s); ③ Output the searched scenarios and verify them. Core structure: Includes "objective function definition module + optimization algorithm module + scenario verification module", which approximates the boundary of key scenarios through iterative search. (3) Scene generation method based on traditional generative models: Implementation steps: ① Collect historical test data of closed sites (such as the trajectories of the main vehicle and background vehicles, road features); ② Train a generative adversarial network (GAN) or variational autoencoder (VAE) to learn the data distribution; ③ Input random noise to generate new scene trajectories (such as the lane-changing trajectory of the background vehicle). Core structure: Relies on "data preprocessing module + generative model (such as the generator / discriminator of GAN) + trajectory output module", and improves the realism of the scene through adversarial training.
[0004] In summary, the shortcomings of the existing technology are as follows: (1) The most significant drawback is that the background vehicles in the generated simulation scenarios have poor coordination, insufficient scenario consistency, lack of multi-agent interaction, and fixed parameter configuration. Fixed parameter configuration: Rule-based methods rely on predefined templates, and once the parameters are set, they cannot be dynamically adjusted. For example, in the AEB scenario, the background vehicle can only enter at a fixed speed and cannot adjust the entry rhythm in real time according to the speed of the main vehicle, resulting in a lack of scenario flexibility and an inability to cover various test scenarios such as "main vehicle low speed → background vehicle fast entry" and "main vehicle high speed → background vehicle slow entry". Lack of multi-agent interaction: Neither rule-based nor search-based methods have constructed multi-agent interaction logic. For example, in the multi-vehicle lane-changing scenario in a closed field, the background vehicle only performs lane-changing actions independently and does not consider the driving status of neighboring vehicles, which cannot simulate the "interactive avoidance" behavior in real traffic, resulting in a disconnect between the test scenario and the actual application. Poor coordination of background vehicles: Search-based methods only optimize the relationship between a single background vehicle and the main vehicle, ignoring the coordination between multiple background vehicles. For example, in the "multi-vehicle merging" scenario in a closed area, the search algorithm only ensures that a single background vehicle does not collide with the main vehicle, and cannot guarantee the speed matching between multiple background vehicles (such as some background vehicles traveling at high speed and some traveling at low speed, leading to merging congestion). The scenario lacks the coordination of real traffic. Insufficient scenario consistency: Traditional generative models (such as GAN) are prone to "pattern collapse" and "logical breakage" - for example, in the generated background vehicle trajectory, there is a sudden and unreasonable turn during the straight driving phase (poor trajectory consistency), or the background vehicle speed and the curve radius do not match in the curve scenario (poor environmental matching consistency). The scenario lacks physical and logical rationality and cannot be used for effective testing. (2) Secondary disadvantages: low generation efficiency and high data dependence. Search-based methods require thousands of iterations in a high-dimensional variable space (e.g., genetic algorithms require 1000 generations of iterations), and generating a key scene can take several hours, resulting in low efficiency. Methods based on traditional generative models (e.g., VAE) require millions of labeled closed-site data points, which are costly to acquire (e.g., lidar data collection in closed sites requires a lot of manpower and resources), making them difficult to apply on a large scale. Summary of the Invention
[0005] The purpose of this invention is to provide a method for generating multi-objective game test scenarios for autonomous driving field testing, so as to solve the core problems of existing autonomous driving closed field test scenario generation: "poor coordination of background vehicles, insufficient scenario consistency, lack of multi-agent interaction, and fixed parameter configuration".
[0006] A method for generating multi-objective game-theoretic test scenarios for autonomous driving field testing is proposed. Based on a Conditional Guided Diffusion Model (CGDM), it integrates multi-agent collaborative strategies and dynamic optimization logic. Through a complete process design of "scene information acquisition - unified encoding - customized constraints - dynamic loss generation - trajectory decoding - verification output," it ultimately generates structured scenarios conforming to the OpenSCENARIO (xosc) standard. This method can be directly adapted to closed-field simulation testing (such as Carla and Prescan platforms) and real-vehicle verification. The specific implementation process is as follows:
[0007] A method for generating multi-objective game test scenarios for autonomous driving field testing includes:
[0008] Step 1: Collect the initial information set of the current scene, which includes a subset of static elements, a subset of dynamic trajectories, and a subset of interactive semantics.
[0009] Comprehensive collection of heterogeneous scene information from a closed testing site forms a standardized initial information set, providing a complete context for the encoding process. The input content of the multimodal fusion Transformer encoder is divided into two subsets:
[0010] The static feature subset includes road structure (straight length / curve radius, number of lanes, etc.), obstacle facilities (pile coordinates), road curvature distribution, and traffic light status (current signal, remaining countdown).
[0011] Figure 1 In the context of "initial road information of the scene", the information includes: road structure, obstacle facilities, and road curvature distribution.
[0012] Dynamic trajectory subset: historical motion data of intelligent agents (main vehicle, background vehicle and pedestrian), covering time-series information such as timestamp, UTM coordinates (x / y), velocity, heading angle, and acceleration;
[0013] Interaction semantic subset: upcoming interaction actions between agents (cutting in, crossing, avoiding, etc.), action confluence triggering conditions (distance threshold, speed difference), and interaction response mode response results.
[0014] Here, "heterogeneous input information" refers to the parameters in each subset.
[0015] Figure 1 The “scene context” in this context refers to the initial information set.
[0016] Step 2: Obtain the scene feature vector F of the current scene: standardize the initial information set, then encode the static element subset, dynamic trajectory subset and interaction semantic subset, and finally fuse the encoded information into the scene feature vector F.
[0017] like Figure 2As shown, a multimodal fusion Transformer encoder is used to standardize and encode three types of heterogeneous information, generating a 1024-dimensional fixed-dimensional scene feature vector F. The specific process is as follows:
[0018] Vector mapping is performed on a subset of static elements to transform static parameters such as roads and traffic lights into vectors of a unified dimension, i.e., into static vectors.
[0019] A "position encoding + attention mechanism" is used for the dynamic trajectory subset to capture the temporal dimension pattern of the agent's movement, that is, to transform the dynamic trajectory subset into temporal trajectory features;
[0020] Semantic features are extracted from a subset of interactive semantics to extract the association logic of "action type-trigger condition-response mode" in order to obtain interactive semantic features;
[0021] By using a cross-modal attention mechanism, three types of information—static vectors, temporal trajectory features, and interactive semantic features—are integrated to achieve a standardized representation of heterogeneous information and output a scene feature vector F.
[0022] Step 3: Configure the scene generation constraints.
[0023] Users can flexibly configure scenario generation constraints according to their testing needs. The core configurable parameters include:
[0024] Speed constraints: background vehicle speed range, target speed, and speed change rate limits (e.g., maximum acceleration ≤ 2 m / s²). 2 );
[0025] Target point configuration constraints: coordinates of the agent's confluence endpoint, key points along the route, and arrival time threshold;
[0026] The driving style parameters of the background vehicle are defined as follows: three modes: conservative, aggressive, and normal, corresponding to different decision parameters (e.g., conservative mode follows a distance of ≥3m, aggressive mode cuts in speed difference ≤5km / h).
[0027] Additional configuration options include: TTC (Time to Collision) threshold, number of background vehicles, cut-in angle range, initial position, game intensity, etc.
[0028] The game intensity is divided into three levels: Level 1, Level 2, and Level 3. Each level corresponds to a set of TTCs, the number of background vehicles, and driving style parameters. For example, Level 1 has shorter TTCs, more vehicles, and an aggressive driving style.
[0029] Figure 3 In Chinese, "angle range" refers to the range of cutting angles.
[0030] Step 4: Dynamically generate a dynamic loss function tailored to the current scene based on the large language model LLM, such as... Figure 4 As shown, it specifically includes:
[0031] Step 4A: Construct LLM prompts, which include a semantic description of the scene feature vector F, scene generation constraints, and a predefined metric for the loss function.
[0032] Semantic description of scene feature vector F: Closed curve merging scene, 3 background vehicles, main vehicle obstacle avoidance test.
[0033] The predefined metrics for the loss function include three metrics: interactive game theory, trajectory consistency, and customized matching.
[0034] Step 4B: Input the LLM prompts into the large language model LLM to generate a dynamic loss function adapted to the current scene.
[0035] LLM inference process: The first step is to detect the adversarial level of the scene, the second step is to generate the loss weights of various indicators, and the third step is to output the Python code of the dynamic loss function.
[0036] Code verification and optimization: Verify the validity of the code through modular testing, debug error messages, and finally output a usable bootstrap function (dynamic loss function).
[0037] Step 5: Generate the time-series trajectory of the background vehicle.
[0038] The scene consists of static elements (such as road information and traffic facility information) and dynamic information (such as trajectory).
[0039] There is a mapping relationship between action sequences and trajectories. A series of control sequences can be reconstructed into a series of trajectory points. When solving, the sequence is calculated first, and then the trajectory points are reconstructed.
[0040] Based on the scene feature vector F and the dynamic loss function, a basic control sequence is generated and the complete trajectory is reconstructed through a "multi-agent collaborative decoder". The core process is as follows:
[0041] Step 5A: Input the scene feature vector F, dynamic loss function and the noisy trajectory of the background vehicle into the conditional diffusion guided model CGDM to generate the basic control sequence of the background vehicle;
[0042] CGDM noise reduction processing: such as Figure 5 As shown, the input scene feature vector F, dynamic loss function, and noisy trajectory are compressed by a downsampling module with 4 layers of convolution and pooling. The data distribution is optimized by layer normalization, and the dimensions are adjusted by Reshape before being fed into the UNet network. Noise is removed by combining time step noise. Finally, the basic control sequence is output by an upsampling module with 4 layers of transposed convolution.
[0043] Figure 5In this context, "basic control sequence" refers to the restored "recovered trajectory".
[0044] Basic control sequence = (speed adjustment, steering angle, acceleration).
[0045] Step 5B: Input the basic control sequence of the background vehicle into the multi-agent collaborative decoder to generate a time-series trajectory.
[0046] Among them, "time-sequential trajectory" refers to the restored "complete trajectory".
[0047] The multi-agent cooperative decoder includes: an action generator, a cooperative optimizer, and a trajectory integrator connected in sequence.
[0048] Multi-agent collaborative decoder three-level optimization:
[0049] Motion generator: Based on the basic control sequence, outputs the initial motion instructions for the background vehicle;
[0050] Collaborative optimizer: Adjusts the basic control sequence based on the principle of minimizing the dynamic loss function;
[0051] Trajectory integrator: Converts the optimized basic control sequence into a time-series trajectory (existing technology), supplements complete information such as timestamps, positions, and velocities, and ensures trajectory continuity.
[0052] Step 6: Scenario consistency verification and standardized output.
[0053] High-quality scenarios are selected through consistency checks and converted into standardized xosc files. The specific process is as follows:
[0054] Scenario consistency verification:
[0055] Trajectory consistency verification: Bezier curves are used to correct trajectories with sudden speed changes and broken steering logic.
[0056] Environment matching consistency verification: Verify the adaptability of the trajectory to road curvature and traffic light status (e.g., speed and radius matching in a curve scenario); set a consistency score (trajectory consistency 50% + environment matching 50%), and only retain scenarios with a score ≥ 0.8;
[0057] Structured output: The validated scene elements (roads, obstacles, traffic lights), agent historical trajectories (time sequence position, speed, heading angle), and interaction rules (convergence trigger conditions, interaction actions) are structured according to the OpenSCENARIO standard to generate xosc format files, which can be directly imported into simulation platforms such as Carla or closed-site test cloud platforms.
[0058] Compared with the prior art, the advantages of the present invention are:
[0059] 1. Based on CGDM, a full-process end-to-end solution is constructed, which includes "scene information acquisition - unified encoding - customized constraints - dynamic loss generation - trajectory decoding - verification output". Through the multimodal fusion Transformer encoder, three types of heterogeneous information, namely static elements, dynamic trajectories and interactive semantics, are transformed into 1024-dimensional fixed-dimensional scene feature vectors. This overcomes the limitations of traditional rule-based / search-based / traditional generative models, which cannot achieve standardized fusion of heterogeneous information and have a fragmented scene generation process. It ensures the integrity and contextual relevance of scene generation and can directly support the scene requirements of closed site simulation and real vehicle verification.
[0060] 2. A dynamic loss function generation mechanism that supports customized requirements:
[0061] By introducing the Large Language Model (LLM), based on the semantic description of scene feature vectors and user-configured customized constraints (speed range, target point, driving style, TTC threshold, etc.), a guiding condition function (dynamic loss function) adapted to the current scene is dynamically output through the process of "adversarial level detection - loss weight allocation - Python code generation - modular verification". This solves the problem that traditional methods cannot flexibly adjust the generation strategy according to test requirements and the disconnect between the scene and the test goal, and realizes the customized scene generation capability of "requirements are constraints and constraints are generation guidance".
[0062] 3. Multi-agent collaborative trajectory optimization mechanism with embedded interaction rules:
[0063] In the trajectory decoding stage, a "multi-agent collaborative decoder" is set up, embedding "master-background vehicle interaction rules" and "background vehicle-car collaboration rules". Through a three-level optimization process of "action generator outputting basic control sequence - collaborative optimizer adjusting interactive behavior - trajectory integrator supplementing timing information", an agent trajectory with real interaction logic of "avoidance-acceleration-speed matching" is directly generated, solving the core problems of independent actions of multiple agents, lack of collaborative interaction, and disconnection from real traffic behavior in traditional methods.
[0064] 4. A two-dimensional consistency verification and standardized output mechanism to ensure scene quality:
[0065] The design incorporates a dual screening process: "trajectory consistency verification + environment matching consistency verification". Trajectory verification corrects logical breaks such as sudden speed changes and unjustified turns using Bézier curves, while environment matching verification verifies the compatibility of the trajectory with static elements such as road curvature and traffic light status.
[0066] Then, scenarios with a score ≥0.8 are selected by using a consistency score of "50% trajectory + 50% environment".
[0067] Meanwhile, the verified scenarios are organized into structured files according to the OpenSCENARIO (xosc) standard, which is compatible with mainstream simulation platforms such as Carla. This solves the problem of physical and logical contradictions in traditional generated model scenarios and the inability to be directly used for testing, thereby improving the usability and adaptability of the scenarios. Attached Figure Description
[0068] Figure 1 Flowchart of a method for generating controllable multi-objective game test scenarios for autonomous driving field testing;
[0069] Figure 2 This is the encoder schematic diagram;
[0070] Figure 3 Configure user parameters interface;
[0071] Figure 4 This is a schematic diagram of the large language model.
[0072] Figure 5 This is a flowchart of the conditional diffusion model workflow. Detailed Implementation
[0073] The method for generating multi-objective game test scenarios for autonomous driving field testing according to the present invention will be described in more detail below with reference to the schematic diagrams, which illustrate preferred embodiments of the present invention. It should be understood that those skilled in the art can modify the present invention described herein while still achieving the advantageous effects of the present invention. Therefore, the following description should be understood as being of broad knowledge to those skilled in the art and is not intended to limit the present invention.
[0074] Figures 1-5 A method for generating multi-objective game test scenarios for autonomous driving field testing includes:
[0075] Step 1: Collect initial information on multi-dimensional scenarios in the closed test site.
[0076] First, comprehensive information on the test site and the state of the agent is collected to provide a complete context for subsequent scene generation.
[0077] (1) Static environment level:
[0078] The test track's curve radius was recorded as 50m, with a curvature of 0.0017m. -1 There are two merging lanes. The specific coordinates of the cones at the edge of the lanes are (50m, 20m) and (60m, 25m). The traffic lights in the area are currently green, and there are 30 seconds left on the green light countdown.
[0079] (2) Dynamic trajectory level:
[0080] Determine the initial state of the host vehicle (autonomous driving test vehicle):
[0081] The starting position is (10m, 10m), the initial speed is 25km / h, the heading angle is 0° (along the positive direction of the lane), and the initial acceleration is 0.
[0082] Three background vehicles entered the venue from three different entrances:
[0083] The initial position of the background vehicle at entrance 1 is (0m, 30m), and its speed is 28km / h.
[0084] The initial position of the background vehicle at entrance 2 is (0m, 35m), and its speed is 22km / h.
[0085] The initial position of the background vehicle at entrance 3 is (0m, 40m), and its speed is 25km / h.
[0086] Pedestrian's initial position at the traffic light zebra crossing (40m, 50m), speed 10km / h;
[0087] Synchronously record time-series data such as timestamps and UTM coordinates of all vehicles.
[0088] (3) Interactive semantic level:
[0089] The interactive action for this scenario is defined as "the background car merges into the lane where the main car is located". The conditions for triggering this action (merging trigger conditions) are "the straight-line distance between the background car and the main car is ≤20m and the speed difference is 10km / h". The interactive response mode is set as "the background car actively adjusts its speed to match the merging rhythm".
[0090] Step 2: Perform unified dimensional encoding on the scene context.
[0091] The heterogeneous information collected in the first step is standardized by a multimodal fusion Transformer encoder and transformed into a feature vector of uniform dimension.
[0092] First, the static elements (curve radius, number of lanes, cone coordinates, traffic light status) are mapped into 256-dimensional static vectors to capture the fixed features of the site environment.
[0093] Then, a "position encoding + attention mechanism" is used on the data in the dynamic trajectory subset to extract 512-dimensional temporal features, focusing on capturing the movement speed and position change patterns of the main vehicle and the background vehicle;
[0094] Simultaneously, semantic analysis is performed on the interaction semantics (interaction actions, straight-line distance in the confluence triggering conditions, and interaction response patterns) to extract a 256-dimensional correlation logic vector and clarify the interaction rules between agents.
[0095] Finally, through a cross-modal attention mechanism, the static vector, temporal trajectory features, and interactive semantic features are deeply integrated to eliminate the dimensional differences of heterogeneous information and output a scene feature vector F. This vector fully contains all the core information such as the site environment, agent state, and interaction logic.
[0096] Step 3: Configure scenario-based testing requirements.
[0097] Based on the core objective of "verifying the obstacle avoidance function of the main vehicle", the constraints of scene generation are set through a visual configuration interface.
[0098] Regarding speed constraints, the speed range of the background vehicle is limited to 20-30 km / h, and the maximum acceleration is limited to no more than 2 m / s². 2 To avoid scene distortion caused by rapid acceleration;
[0099] Regarding the target point configuration, the merging endpoints of the three background vehicles are set to (80m, 30m), and the key points along the way are (40m, 32m). It is required that the time for all background vehicles and pedestrians to reach the endpoints does not exceed 10 seconds, ensuring that the merging action is completed within the test cycle.
[0100] In terms of driving style, select "Conservative Mode" with the following parameters: following distance between background vehicles ≥ 3m, speed difference ≤ 3km / h, to simulate cautious merging behavior in real traffic.
[0101] Additional TTC (Time to Collision) thresholds of ≥2s are configured to prevent collisions between any two vehicles without triggering the main vehicle's obstacle avoidance mechanism. At the same time, the merging angle (cut-in angle) range is specified as 15-25° to ensure that the merging action conforms to the cut-in angle patterns of real roads.
[0102] Step 4: Generate a dynamic loss function using a large language model.
[0103] The dynamic loss function is used to guide the direction of scene generation.
[0104] First, construct the input prompt for the LLM, which includes:
[0105] The semantic description of the scene feature vector F ("closed curve merging scene, curve radius 50m, 3 background vehicles + 1 main vehicle, must meet conservative driving style"), customized constraints (speed range, driving style parameters, TTC threshold, etc.), and predefined indicators of the loss function - must cover three core indicators: "interactive game (coordination between background vehicles and main vehicle, and between background vehicles)", "trajectory consistency (no sudden speed changes, steering break)" and "customized matching (meets speed / angle constraints)". The formula is as follows:
[0106]
[0107] The specific meanings of each parameter are as follows:
[0108] Total loss value Loss in interactive game Trajectory Consistency Loss Customized matching loss The weighted sum, where weights ω1, ω2, and ω3 correspond to three sub-losses, highlighting the safety-first requirement of conservative driving;
[0109] In the interactive game of loss:
[0110] i is the background car index.
[0111] TTC i,Ego This indicates the collision time between the main vehicle and the i-th background vehicle.
[0112] TTC th The set security threshold;
[0113] i < j represents the pairwise indices of the background vehicles.
[0114] d i,j The actual distance between the i-th and j-th background vehicles.
[0115] d safe The set safety distance;
[0116] λ merge Weights are constrained by the convergence angle.
[0117] θ merge The actual angle between the merging lane for main vehicles and the target lane.
[0118] θ max The set safety angle;
[0119] max(0,·) is a hinge function that only penalizes violations;
[0120] In trajectory consistency loss:
[0121] α, β, and γ are the smoothness constraint weights for velocity, steering angle, and acceleration, respectively.
[0122] t is the trajectory time step index, and T is the total trajectory time steps.
[0123] v(t), δ(t), and a(t) represent the velocity, steering angle, and acceleration of the main vehicle at time t, respectively.
[0124] The second-order difference between velocity and steering angle (v(t+1)-2v(t)+v(t-1), δ(t+1)-2δ(t)+δ(t-1)) reflects the degree of drastic change.
[0125] The first-order difference of acceleration (a(t+1)-a(t)) penalizes rapid acceleration and deceleration;
[0126] In customized matching loss:
[0127] v min v max For the scene speed range, a actual The actual maximum acceleration of the main vehicle.
[0128] R is the radius of the curve.
[0129] The lateral centrifugal acceleration of the main vehicle needs to be... The side-slip safety threshold;
[0130] a cons =10m / s 2 This is a conservative driving threshold.
[0131] The sources of each parameter are as follows:
[0132] Total loss value Loss in interactive game Trajectory Consistency Loss Customized matching loss The weighted sum, with weights ω1, ω2, and ω3 set manually and allocated based on scenario constraints and priority quantification;
[0133] In the interactive game of loss:
[0134] The background vehicle index i and pairwise index constraints i < j are manually set to standardize the summation logic and the safety threshold TTC. th , safe distance d safe Convergence angle constraint weight λ merge Safety angle θ max The design is based on human intervention and is calibrated with reference to the safety standards for merging traffic on closed roads.
[0135] Collision time TTC between the main vehicle and the i-th background vehicle i,Ego The calculation process is as follows:
[0136] The real-time relative distance s between the main vehicle and the i-th background vehicle is collected using real vehicle sensors. rel (unit: m) and relative velocity v rel (Unit: m / s), substitute into the formula Calculated;
[0137] The actual distance d between the i-th and j-th background vehicles i,j The calculation process is as follows:
[0138] Collect the real-time coordinates (x, y) of the two background vehicles.i y i ), (x j ,y j Substitute into the Euclidean distance formula Calculated;
[0139] The actual angle θ between the main vehicle merging lane and the target lane merge The calculation derivation yields the following:
[0140] Collect the main vehicle's driving direction vector tangent direction vector to the centerline of the target lane Substitute into the formula for the angle between vectors Calculated;
[0141] The hinge function max(0,·) is set manually and follows the logic of only punishing violations;
[0142] In trajectory consistency loss:
[0143] The weights α, β, and γ for speed, steering angle, and acceleration smoothness constraints are manually set and allocated differently to meet the requirements for smooth cornering.
[0144] The trajectory time step index t and the total time step T are manually set and configured according to the test trajectory duration. The reasonable range of the main vehicle's speed v(t), steering angle δ(t), and acceleration a(t) at time t is generated by the scene generation diffusion model based on the trained scene generation model.
[0145] The second-order velocity difference v(t+1) - 2v(t) + v(t-1) is derived from the calculation process:
[0146] Take the velocity values (v(t-1), v(t), v(t+1)) for three consecutive time steps, and calculate directly using the second-order difference formula to quantify the drastic change in velocity.
[0147] The second-order difference of the steering angle δ(t+1)-2δ(t)+δ(t-1) is derived from the calculation. The calculation process is consistent with the second-order difference of the velocity. The steering angle values of three consecutive time steps are substituted into the second-order difference formula for calculation.
[0148] The first-order difference of acceleration a(t+1)-a(t) is derived from the calculation process: take the acceleration values (a(t) and a(t+1)) of two adjacent time steps, calculate according to the first-order difference formula, and punish sudden acceleration and deceleration behavior.
[0149] In customized matching loss:
[0150] Scene speed range v min v max The calculation process is as follows:
[0151] Safety constraint formula based on centrifugal acceleration during cornering Substitute the maximum lateral acceleration threshold a y,max =2.5m / s 2 And the curve radius R, the deformation derivation is as follows Take this calculated value as v max v is taken in combination with the traffic efficiency requirements of the scenario. min =k vmax (0 <k<0.5);
[0152] The actual maximum acceleration of the main vehicle a actual The calculation process is as follows:
[0153] Calculate the first-order difference of the main vehicle's velocity sequence v(t) over time steps, and take the maximum value of all instantaneous accelerations as a. actual ;
[0154] The curve radius R is the actual measurement, matching the physical parameters of the target scene;
[0155] Lateral centrifugal acceleration of the main vehicle The calculation process is as follows:
[0156] Take the speed v(t) of the main vehicle at time t and the set curve radius R, and substitute them into the centrifugal acceleration formula to calculate directly;
[0157] Sideslip safety threshold a y,max =2.5m / s 2 Conservative driving threshold a cons =1.0m / s 2 The parameters are set based on experience to ensure they closely match real-world driving dynamics.
[0158] After receiving the prompt, LLM first determines the adversarial level of the scene as "medium" (no extreme collision scenarios are required, and the focus is on verifying conventional obstacle avoidance), and then assigns loss weights to three indicators: interactive game theory accounts for 40%, trajectory consistency accounts for 30%, and customized matching accounts for 30%.
[0159] LLM first performs full-domain analysis and deep semantic mining on the input multi-dimensional scene information to achieve accurate quantitative determination of the scene adversarial level.
[0160] The core parsing objects include: the semantic description of the scene feature vector F (closed curve merging scene, curve radius 50m, 3 background cars + 1 main car, conservative driving style), customized constraints (speed range 20-30km / h, TTC threshold ≥3s, following distance ≥2.5m, merging angle ≤15°) and interactive semantic subset (merging action, trigger condition is "straight distance between background car and main car ≤20m + speed difference ≤10km / h", background car active speed matching response mode).
[0161] Based on the above information and the comprehensive evaluation results across the three dimensions, LLM ultimately outputs the scenario adversarial level, clarifying that the core objective of the scenario is to verify the collaborative merging and obstacle avoidance capabilities of the primary vehicle and the background vehicle, without generating extreme collision scenarios, thus providing a core decision-making basis for subsequent loss weight allocation.
[0162] Based on the definition of "medium level of confrontation", LLM focuses on the core testing requirements of closed curve merging scenarios and carries out dynamic allocation of loss index weights.
[0163] First, establish the weight priority ranking logic: first-level priority is assigned to the interactive game loss. Since the core risk in conservative driving scenarios stems from multi-agent interaction conflicts (collision between the master vehicle and background vehicles, and congestion among three background vehicles), high weighting is required to ensure multi-vehicle collaborative safety; secondary priority is allocated to trajectory consistency loss. Sudden speed changes or steering failures while driving on curves can lead to abnormal centrifugal forces, violating the requirements for conservative driving stability and affecting the physical rationality of the scenario, thus requiring key constraints; a third-level priority is assigned to the customized matching loss. Constraints such as speed range and convergence angle are basic scene settings that must ensure the trajectory does not deviate from the parameter boundaries, but their priority is lower than safety and smoothness.
[0164] Subsequently, LLM invokes the built-in "Scene Type-Weight Mapping Model" (training data covers 10+ types of closed-field test scenarios), and, combined with the characteristics of medium adversarial level, outputs the optimal weight combination: interactive game loss weight ω1 = 0.4, trajectory consistency loss weight ω2 = 0.3, and customized matching loss weight ω3 = 0.3. This weight combination highlights the core safety of conservative driving, ensures the authenticity of driving behavior through trajectory consistency weight, and anchors the scenario parameter boundaries with customized matching weight.
[0165] The corresponding Python-formatted loss function code is then automatically generated.
[0166] After the code is generated, its effectiveness is verified by a modular testing tool to check for syntax errors or logical conflicts (such as whether the speed difference constraint is missing). After debugging and confirming that there are no errors, a dynamic loss function that can be directly used for model training is output.
[0167] Step 5: Generate the basic control sequence and decode it into a complete trajectory.
[0168] Using noisy trajectory, scene feature vector F, and dynamic loss function as input, the "multi-agent cooperative decoder" completes the generation of basic control sequences and trajectory decoding. The core is to realize the cooperative merging trajectory of the background vehicle.
[0169] First, a conditional diffusion guided model is used for denoising: the initial noisy trajectory is input into the conditional diffusion guided model, and the feature dimension is compressed by a downsampling module with 4 layers of convolution and pooling to remove noise interference in the trajectory; the data distribution is optimized by layer normalization to avoid feature offset affecting the generation effect; after reshape adjustment of the dimension, it is fed into the UNet network, and the trajectory is gradually optimized by combining time step noise; finally, the denoised basic control sequence is output by an upsampling module with 4 layers of transposed convolution.
[0170] Then, the third-level collaborative optimization stage begins:
[0171] The motion generator outputs the initial motion commands for the background vehicles based on the control sequence: background vehicle 1 accelerates to 30km / h, background vehicle 2 decelerates to 21km / h, and background vehicle 3 maintains 25km / h.
[0172] The collaborative optimizer embeds multi-agent interaction rules and detects that the speed difference between background car 1 and background car 2 is 9 km / h (far exceeding the constraint of 3 km / h). Based on the principle of minimizing the dynamic loss function (making the value of formula 1 the minimum), the speed of background car 1 is adjusted to 25 km / h and the speed of background car 2 is increased to 24 km / h, so that the speed difference of the three meets the conservative style requirements.
[0173] The trajectory integrator transforms the optimized basic control sequence output by the co-optimizer into a time-series trajectory, supplementing it with data such as timestamps every 0.1s, UTM coordinates, and heading angles to ensure the continuity of the trajectory from the initial position to the confluence endpoint, ultimately obtaining the complete confluence trajectory of the three background vehicles.
[0174] Step 6: Scenario consistency verification and standardized output.
[0175] The time-series trajectories generated in step 5 are quality-verified, and scenarios that meet the requirements are selected and converted into a standardized format to ensure that they can be directly used for simulation testing.
[0176] A scene consists of the trajectories of all traffic participants.
[0177] First, perform a two-dimensional consistency check:
[0178] Trajectory consistency verification: Minor speed fluctuations in the trajectory are smoothed by Bézier curves. After inspection, it is confirmed that the trajectories of all background vehicles have no sudden speed increases or decreases, no unexplained turns, and the trajectory curves are continuous and smooth.
[0179] Environmental matching consistency verification: The calculated steering angle of the background vehicle is approximately 8°, which meets the physical matching requirements of the curve radius of 50m (the steering angle of the curve must be adapted to the radius to avoid excessive centrifugal force). Furthermore, all merging actions of the background vehicles are completed during the green light period of the traffic light, and there are no violations of traffic signals.
[0180] According to the scoring rule of "50% trajectory consistency + 50% environment matching", the overall score of this scenario is 0.95 (0.98 for trajectory consistency and 0.92 for environment matching), which is higher than the qualified threshold of 0.8, and is judged as a valid scenario.
[0181] Finally, the verified scene elements (road structure, cone positions, traffic light status), the historical trajectories (time-sequence position (UTM coordinates), speed, heading angle) of the intelligent agents (main vehicle and background vehicle), and the interaction rules (convergence trigger conditions, interaction actions) are structured according to the OpenSCENARIO standard to generate xosc format files.
[0182] After importing the file into the Carla simulation platform, the three background vehicles merged in coordination along the optimized trajectory (speeds of 25km / h, 24km / h, and 25km / h, with a spacing of ≥2.5m). After the main vehicle detected the merging vehicles, it successfully triggered the obstacle avoidance strategy (deceleration + slight steering) and completed the obstacle avoidance test.
[0183] Standardized output details: The generated scene is clearly structured according to the OpenSCENARIO (xosc) standard. The file contains three core modules: static scene elements (road structure parameters, obstacle coordinates, traffic light timing), agent trajectory data (timestamp, UTM coordinates x / y, velocity, heading angle, acceleration timing sequence), and interaction rule definition (action type, trigger condition threshold, response logic). It can be directly parsed by the Carla simulation platform and mainstream closed-field testing cloud platforms without secondary development and adaptation.
[0184] Core module scalability: The multimodal fusion Transformer encoder supports adding new input subsets (such as weather elements: rainfall intensity, visibility; road surface conditions: friction coefficient), which can be made compatible simply by expanding the vector mapping dimension; the LLM dynamic loss function generation module supports adding new customized parameter types (such as road construction area constraints, pedestrian crossing frequency), which can be achieved by expanding the Prompt template without reconstructing the model architecture.
[0185] Technical solution implementation conditions: The hardware environment required for this invention is a general server (CPU ≥ 16 cores, GPU ≥ 24G video memory), the software depends on the PyTorch deep learning framework, the OpenSCENARIO standard parsing library, and the LLM inference interface (supporting GPT-3.5 / 4 or open source LLaMA series models), the training data only requires 100,000-level closed site basic trajectory data (including static, dynamic, and interactive semantic annotations), and the implementation cost is controllable.
[0186] In summary, this method has the following advantages:
[0187] 1. Heterogeneous information fusion is more efficient, and scene integrity is significantly improved.
[0188] By using a multimodal fusion Transformer encoder, three types of heterogeneous information—static elements, dynamic trajectories, and interactive semantics—are transformed into 1024-dimensional fixed-dimensional feature vectors, overcoming the limitations of traditional methods that fragment heterogeneous information.
[0189] Compared to traditional rule-based methods that can only handle single static parameters and whose generative models struggle to integrate semantic information, this solution achieves full-dimensional coverage of the scene context, improves the completeness of scene elements by 95%, and ensures the relevance of the test scene to the real road environment.
[0190] 2. It has stronger customization and adaptation capabilities and a higher degree of matching with test targets.
[0191] Based on the "LLM dynamic loss function generation mechanism", users can accurately define test requirements by configuring parameters such as speed constraints, driving style, and TTC threshold.
[0192] LLM uses semantic descriptions of scene feature vectors to dynamically generate adapted Python-formatted loss functions, achieving a closed loop of "requirements-constraints-generation" without modifying the underlying template.
[0193] Compared to traditional methods with fixed parameters and limited support for only 2-3 types of scenarios, this invention can cover 10+ types of test scenarios, improving customization adaptability by 90%.
[0194] 3. Multi-agent interaction is more realistic, and scene coordination is greatly optimized.
[0195] The designed "multi-agent collaborative decoder" incorporates the interaction rules between the main vehicle and the background vehicle and the background workshop through three levels of optimization: "action generator - collaborative optimizer - trajectory integrator".
[0196] Compared to search-based methods that only optimize single-vehicle relationships and traditional generative models that lack collaborative logic, this solution can simulate real traffic behavior of "avoidance-acceleration-speed matching". The proportion of background vehicle speed differences ≤3km / h in merging scenarios increases from 40% to 95%, and the coordination of multi-agents is improved by 85%.
[0197] 4. Scenario consistency is more reliable, and test availability is significantly improved.
[0198] The "dual-dimensional consistency verification" mechanism corrects trajectory logic breaks through Bézier curves, verifies the adaptability of the trajectory to road curvature and traffic light status, and retains only scenarios with a score ≥ 0.8.
[0199] Compared to the trajectory inconsistencies caused by "pattern collapse" in traditional generative models, this invention increases the proportion of physically plausible scenarios to 98%, and the output xosc format file can be directly imported into the Carla platform without additional format conversion, thus improving test usability.
[0200] 5. Higher generation efficiency and significantly reduced data dependency.
[0201] The end-to-end process does not require high-dimensional space iterative search (such as 1000 generations of genetic algorithm iteration), the diffusion model has a fast sampling speed, and the generation time of a single scene is shortened from several hours to 5-8 minutes; at the same time, the dependence on labeled data is reduced by "parameter interval constraints", eliminating the need for millions of closed site data, reducing the amount of training data by 70%, and significantly reducing data acquisition costs.
[0202] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the present invention. Any equivalent substitutions or modifications made by those skilled in the art to the technical solutions and content disclosed in the present invention without departing from the scope of the present invention shall be deemed to have remained within the protection scope of the present invention.
Claims
1. A method for generating multi-objective game test scenarios for autonomous driving field testing, characterized in that, Includes the following steps: Step 1: Collect the initial information set of the current scene, which includes a subset of static elements, a subset of dynamic trajectories, and a subset of interactive semantics; Step 2: Obtain the scene feature vector F of the current scene: standardize the initial information set, then encode the static element subset, dynamic trajectory subset and interaction semantic subset, and finally fuse the encoded information into the scene feature vector F; Step 3: Configure the scene generation constraints; Step 4: Dynamically generate a dynamic loss function tailored to the current scene based on the large language model LLM; Step 5: Generate time-series trajectories; Step 6: Scenario consistency verification and standardized output.
2. The method for generating multi-objective game test scenarios for autonomous driving field testing according to claim 1, characterized in that, The scene generation constraints include velocity constraints and target point configuration constraints.
3. The method for generating multi-objective game test scenarios for autonomous driving field testing according to claim 1, characterized in that, Step 4 specifically includes: Step 4A: Construct LLM prompts, which include a semantic description of the scene feature vector F, scene generation constraints, and a predefined metric for the loss function; Step 4B: Input the LLM prompts into the large language model LLM to generate a dynamic loss function adapted to the current scene.
4. The method for generating multi-objective game test scenarios for autonomous driving field testing according to claim 1, characterized in that, Step 5 specifically includes: Step 5A: Input the scene feature vector F, dynamic loss function and the noisy trajectory of the background vehicle into the conditional diffusion guided model CGDM to generate the basic control sequence of the background vehicle; Step 5B: Input the basic control sequence of the background vehicle into the multi-agent collaborative decoder to generate a time-series trajectory.
5. The method for generating multi-objective game test scenarios for autonomous driving field testing according to claim 1, characterized in that, Step 6 includes: trajectory consistency verification and environment matching consistency verification.