A method for an AI vehicle to change lanes in a virtual scenario

By building multi-lane and setting collision boxes and front-facing triggers in virtual scenes, AI vehicles automatically detect traffic flow and change lanes, solving the problem of AI vehicles having little participation and mechanical behavior in the prior art, improving the authenticity and safety of simulated driving.

CN116631260BActive Publication Date: 2025-07-25DUOLUN INTERNET TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310614108.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2025-07-25
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

In the existing three-dimensional virtual driving simulation software, AI vehicles participate less and behave mechanically, and cannot automatically detect traffic flow conditions, resulting in unreal simulation driving experience and restricting students' driving skills practice.

Method used

Build multi-lane roads in a virtual scene, set up collision boxes and front triggers of AI vehicles, automatically judge and perform lane change behavior by detecting the forward vehicle speed and traffic conditions, and use steering angle to control AI vehicles to select the optimal path between multiple lanes.

Benefits of technology

It improves the authenticity of simulated driving. AI vehicles can automatically detect traffic flow conditions and choose to follow the car or change lanes at the right time, which improves the safety and authenticity of driving exercises and simulates more complex road scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116631260B_ABST
    Figure CN116631260B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for an AI vehicle to change lanes in a virtual scenario, mainly including lane setting in a virtual three-dimensional scenario, virtual three-dimensional scenario setting, lane change judgment, and steering angle calculation; during driving, when the front trigger of the AI vehicle touches the collision box of the front AI vehicle, the real-time vehicle speeds of the AI vehicle and the front AI vehicle are obtained; when the vehicle speed of the front AI vehicle is less than T times the vehicle speed of the AI vehicle, a lane change decision-making mechanism is started, and when the lane changeable conditions are met, the steering angle of the AI vehicle is calculated, and the AI vehicle is controlled to steer to complete the lane change. The present invention can simulate more AI vehicles, automatically detect the traffic conditions in the front, left, and right, and opportunistically select following or lane change behaviors, improving the real experience of simulated driving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to a method for an AI vehicle to change lanes in a virtual scenario, and belongs to the field of three-dimensional simulation and emulation of vehicle driving. Background Art

[0002] In the field of three-dimensional virtual scenario simulation, the cooperation between three-dimensional simulation software for vehicle driving and vehicle simulators has become a popular way to train people's driving skills and cultivate good driving habits. Through training, trainees can master more driving techniques more quickly and proficiently, and have more learning fun and be safer. However, there are also many prominent deficiencies in such simulation software. For example, in the simulated three-dimensional scenario, usually there is only the main vehicle of the simulator controlled by the trainee (also called the controlled vehicle), and the participation of other vehicles (i.e., AI vehicles) is very small. Even in the simulated scenario with traffic flow participation, the behavior of AI vehicles is relatively mechanical and cannot automatically detect the surrounding traffic flow conditions to implement automatic lane-changing behavior, resulting in a mechanical simulation process and making it difficult to reproduce a traffic flow close to the real situation, which limits the practice of more safe driving techniques for trainees. Summary of the Invention

[0003] In order to solve the shortcomings of few AI vehicles and mechanical behavior in the simulated driving simulation software, the present invention provides a method for an AI vehicle to change lanes in a virtual scenario, which can simulate more AI vehicles, automatically detect the traffic flow conditions in front and on the left and right, and select the opportunity to follow or change lanes, so as to enhance the real experience of simulated driving.

[0004] A method for an AI vehicle to change lanes in a virtual scenario disclosed by the present invention mainly includes:

[0005] In a virtual three-dimensional scenario, a road with at least two lanes in the same direction is constructed. A path point is set every N meters at the middle position of the lane, and the path point is a trajectory point that an AI vehicle needs to follow when driving; the trajectory points are connected end to end and cross-connected in the driving direction of the road to obtain a line for vehicle driving;

[0006] A collision box that is equal in length, width, and height to the AI vehicle itself is set for the AI vehicle to be detected by other AI vehicles, and a front trigger for detecting the vehicle in front is set in front of the head of the AI vehicle; the length of the front trigger is related to the real-time vehicle speed of the AI vehicle;

[0007] A number of AI vehicles are set at different positions on the road, and parameters of each AI vehicle are set. The parameters include the maximum speed, acceleration, and braking reaction parameters that can be traveled; the actual maximum vehicle speed of each AI vehicle is the smaller value between the maximum speed of the path point and the maximum speed that can be traveled;

[0008] During driving, when the front trigger of the AI vehicle touches the collision box of the front AI vehicle, obtain the real-time vehicle speeds of the AI vehicle and the front AI vehicle; the real-time vehicle speeds fluctuate between 0 and the actual maximum vehicle speed; when the vehicle speed of the front AI vehicle is less than T times the vehicle speed of the AI vehicle, start the lane-changing decision-making mechanism, and calculate the steering angle of the AI vehicle when the lane-changing conditions are met, and control the AI vehicle to steer to complete the lane change.

[0009] As an alternative, the lane-changing conditions include the first lane-changing condition and the second lane-changing condition; the lane-changing decision-making mechanism is: only when both the first lane-changing condition and the second lane-changing condition are met can the lane change be made; where:

[0010] The first lane-changing condition is: first, determine whether there are adjacent drivable lanes on the left and right of the AI vehicle, and then find the path point closest to the previous path point B of the AI vehicle on the adjacent drivable lanes; confirm whether these closest path points are connected to path point B, if connected, the first lane-changing condition is met;

[0011] The second lane-changing condition is: verify whether there are other AI vehicles on the M path points before and after these closest path points. If not, define this path point as the target path point for the AI vehicle to change lanes, and determine that the lane-changing condition is met.

[0012] As an alternative, the steering angle of the AI vehicle is: the angle formed by path point B, the target path point, and the previous path point C in the lane where path point B is located.

[0013] As an alternative, the maximum drivable speed is randomly generated between the minimum possible speed and the maximum possible speed, that is:

[0014] RoadLimV = Rand(minPossibleSpeed, maxPossibleSpeed);

[0015] The actual maximum vehicle speed V0 of the AI vehicle is:

[0016] V0 = Min(MaxV, RoadLimV)

[0017] Where, MaxV is the maximum vehicle speed of the path point, RoadLimV is the maximum drivable speed, minPossibleSpeed is the minimum possible speed, and maxPossibleSpeed is the maximum possible speed.

[0018] As an alternative, the length of the front trigger is the distance D between the AI vehicle and the vehicle ahead detected by the AI vehicle. The distance D is proportional to the real-time speed V of the AI vehicle within the preset speed range, and the distance D is a constant value when the real-time speed V is outside the preset speed range.

[0019] As an alternative, the distance D is: when V > 60, D = 100; when 10 ≤ V ≤ 60, when 2 < V < 10, D = 0.7 * V; when V ≤ 2, D = L / 2 where C is a constant and L is the body length of the AI vehicle.

[0020] As an alternative, calculating the steering angle of the AI vehicle and controlling the steering of the AI vehicle specifically includes:

[0021] When the steering angle angle is less than -5, the vehicle head is biased to the left, the left turn signal is turned on, and it drives towards the target point in the left lane; when the steering angle angle is greater than 5, the vehicle head is biased to the right, the right turn signal is turned on, and it drives towards the target point in the right lane; when -5 < angle < 5, it is defaulted to the straight-ahead state.

[0022] As an alternative, the T times is 1.2 times.

[0023] As an alternative, the width of the front trigger is equal to the body width of the AI vehicle itself, and the height is between the body height of the AI vehicle and 1 / 3 of the body height.

[0024] The present invention has the following beneficial effects:

[0025] (1) In the present invention, the AI vehicle can automatically detect the vehicle ahead and the traffic flow in the adjacent lanes (the detection objects include the conditions of other AI vehicles and the simulator protagonist vehicle), and select the following vehicle or lane-changing behavior opportunistically, making the traffic flow on the entire road section relatively uniform and more in line with the real road traffic conditions.

[0026] (2) In the present invention, the drivable path can be edited by connecting the trajectory points according to the requirements, and the maximum driving speed of the path points in each road can also be edited.

[0027] (3) The present invention can simulate the vehicle behavior on real roads, can simulate more AI vehicles, restore complex road conditions, enhance the real experience of simulated driving, help the drivers using the simulator to better practice driving behaviors, improve the safe driving skills of the drivers learning to drive cars, and prevent and reduce the risk of traffic accidents in real driving. Description of the Drawings

[0028] Figure 1 Shown is the schematic diagram of the layout of the road lane line points in the embodiment.

[0029] Figure 2 Shown is a schematic diagram of the collision box of the AI vehicle in the embodiment.

[0030] Figure 3 Shown is a schematic diagram of the front trigger of the AI vehicle in the embodiment.

[0031] Figure 4 Shown is a schematic diagram of the driving distribution of the AI vehicle in the embodiment.

[0032] Figure 5 Shown is a schematic diagram of the traffic flow distribution of AI vehicles driving on the road in the prior art.

[0033] Figure 6 Shown is a schematic diagram of the traffic flow distribution of AI vehicles driving on the road after adopting the present invention. Detailed implementation manners

[0034] In order to more clearly explain the technical features and advantages of the present invention, the technical solutions of the present invention will be described and demonstrated below in conjunction with specific embodiments and drawings.

[0035] An embodiment discloses a method for an AI vehicle to change lanes in a virtual scene, which mainly includes the following parts:

[0036] Lane setting: In a virtual three-dimensional scene, a road with three lanes in the same direction is constructed. The lane numbers are marked as 1, 2, and 3 from right to left, as Figure 1 shown. The driving direction of each lane is indicated by a white arrow. A path point (abbreviated as "point") is set in the middle of the road every N meters in the middle of each lane. This path point is the trajectory point that the protagonist vehicle and the AI vehicle need to follow when driving. The maximum speed (abbreviated as "path point maximum speed") MaxV that the AI vehicle can travel at each path point is 60 km / h, which also limits that the actual maximum vehicle speed V0 of the AI vehicle in this section shall not be greater than the path point maximum speed MaxV. It should be noted that in the three-dimensional scene, the path point maximum speeds in each road can be the same or different, and can be specifically set according to requirements. For the convenience of understanding, the path point maximum speeds in the three lanes in this embodiment are equal. Among them:

[0037]

[0038] According to the "69 line" standard of the road lane demarcation line (9 represents that the length of the dotted line in the demarcation line is 9 meters, and 6 represents that the distance between two dotted lines in the demarcation line is 6 meters, that is, draw 9 meters and leave 6 meters empty), K = (9 + 6) / 2 = 7.5 meters, N = 60 / 7.5 = 8. Therefore, the distance between adjacent path points in each lane is 8 meters.

[0039] Connect the head and tail and cross-connect each trajectory point in the driving direction of the lane, as Figure 1As shown by the arrow connections, the lines after the trajectory points are connected are all the drivable lines of the AI vehicle.

[0040] AI vehicle settings: As Figure 2 shown, each AI vehicle on the road is equipped with a collision box (i.e., CarBodyCollider) that is equal in length, width, and height to itself. As Figure 3 shown, a front trigger (i.e., CarHeadTrigger) for detecting vehicles ahead is provided in front of the head of the AI vehicle. The CarBodyCollider is used to be detected by the CarHeadTrigger of other vehicles. The width of the CarHeadTrigger is equal to the body width, and the height can be set to any size from 1 / 3 of the body height to the body height, for example, 1 / 2 of the body height. The length of the CarHeadTrigger is related to the real-time vehicle speed of the AI vehicle.

[0041] Current scene settings: The maximum drivable speed, acceleration, and braking reaction parameters of each AI vehicle can be preset according to different vehicle types. Among them, the maximum drivable speed value is usually randomly generated between the minimum possible speed (i.e., minPossibleSpeed) and the maximum possible speed (i.e., maxPossibleSpeed), representing the maximum speed of the AI vehicle after entering the scene.

[0042] The actual maximum vehicle speed V0 of the AI vehicle is the smaller value between the maximum speed of the path point and the maximum drivable speed. Therefore, the actual maximum vehicle speed V0 of the AI vehicle should be:

[0043] V0 = Min(MaxV, RoadLimV)

[0044] where MaxV is the maximum vehicle speed of the path point, and RoadLimV is the maximum drivable speed of the AI vehicle.

[0045] The minPossibleSpeed and maxPossibleSpeed of AI vehicles of the same type are often equal, but the maximum drivable speed RoadLimV of different AI vehicles of the same type will fluctuate and be randomly generated between minPossibleSpeed and maxPossibleSpeed, that is:

[0046] RoadLimV = Rand(minPossibleSpeed, maxPossibleSpeed)

[0047] For example,

[0048] V0 = Min(60, Rand(30, 100))

[0049] It is described that the maximum speed MaxV of the path point is set to 60 km / h in this embodiment; minPossibleSpeed is set to 30 km / h in this embodiment; maxPossibleSpeed is set to 100 km / h in this embodiment.

[0050] It can be seen that in the virtual scenario, the maximum speed at which the same AI vehicle can travel is constant. The actual maximum speed is generated between the maximum speed of the path point and the maximum speed at which it can travel. The real-time speed fluctuates between 0 and the actual maximum speed, which is determined by various factors such as the actual maximum speed and the road where this vehicle is located.

[0051] Acceleration is a parameter related to the time it takes for the vehicle to accelerate from a standstill to the actual speed, and is used to simulate how quickly the vehicle starts. The braking reaction parameter is the parameter of the actual time it takes for the vehicle to decelerate from the normal driving speed to a standstill, which represents the braking time of the vehicle and is used to simulate the braking performance of the vehicle.

[0052] In this embodiment, as Figure 4 shown, there is a protagonist vehicle RoleCar controlled by the simulator and three AI vehicles. The labels of the three AI vehicles are AICar_1, AICar_2, and AICar_3 respectively. The initial positions of AICar_1, AICar_2, and AICar_3 are on different lanes or different path points, and they move forward in the direction of the lane. Among them, AICar_1, AICar_2, and AICar_3 are of the same model. The minPossibleSpeed and maxPossibleSpeed of the three vehicles are 30 and 100 (unit: Km / H). When the vehicle is initialized, a random number is generated between 30 and 100, and this number is the maximum speed value at which the vehicle can travel. Further, considering the maximum speed MaxV of the path point, the actual maximum speed of AICar_1, AICar_2, and AICar_3 should be the smaller value between the maximum speed value at which they can travel and MaxV.

[0053] During the forward movement of the AI vehicle, the width and height of the front trigger CarHeadTrigger are both fixed values, and the length is related to the real-time speed. The length of the front trigger is the distance between this AI vehicle and the detected vehicle in front (abbreviation: "distance"). The distance of the vehicle in front detected by the front trigger is mainly determined by the real-time speed and the default length of the vehicle trigger. Generally, the faster the real-time speed, the longer the detected distance, and the slower the speed, the shorter the detected distance.

[0054] Specifically, the distance D is proportional to the real-time speed V within the preset speed range. When the speed exceeds the preset speed, the length is a constant value. For details, please refer to Table 1, where L represents the vehicle body length and C is a constant 5.

[0055] Table 1: Corresponding Relationship Table between Real-time Vehicle Speed V and Distance D

[0056]

[0057] To ensure the authenticity of the simulation, the length, width, and height of the AI vehicle in the three-dimensional scene adopt the same standards as the real vehicle size parameters. For example: length L = 4.8 meters, width W = 1.7 meters, height H = 1.6 meters. According to the vehicle length, the length of CarHeadTrigger in different speed ranges can be calculated, and this length is the detected distance value of the vehicle in front. When the CarHeadTrigger of the own vehicle touches the CarBodyCollider of the vehicle in front, deceleration and lane-changing behaviors will be triggered. As shown in Table 2:

[0058] Table 2: Corresponding Distance Values at Different Real-time Vehicle Speeds when the Vehicle Length is 4.8 Meters

[0059] Real-time vehicle speed (Km / H) Distance D (meters) 2 2.4 10 9.6 40 38.4 100 100 120 100

[0060] Lane-changing Judgment: As Figure 4 shown, when the AI vehicle AICar_1 is moving forward in Lane 2 at a speed of 40 km / h, the length of the CarHeadTrigger of AICar_1 is 38.4 meters. At the moment when the CarHeadTrigger touches the CarBodyCollider of AICar_3, which is 16 meters ahead, the real-time vehicle speeds of AICar_1 and AICar_3 are obtained. When the vehicle speed of AICar_3 is less than 1.2 times the vehicle speed of AICar_1, to avoid hitting AICar_3 in front, AICar_1 activates the lane-changing decision-making mechanism:

[0061] Lane-changing Condition 1: First, judge whether there are adjacent drivable lanes for the vehicle in Lane 2 where AICar_1 is located, that is, Lane 1 and Lane 3; then find the nearest path points on Lane 1 and Lane 3 corresponding to the previous path point B of AICar_1, which are point A on Lane 1 and point D on Lane 3; finally, according to the previous lane setting content, confirm that both point A and point D are connected to point B on Lane 2, that is, there is a connection point line, meeting Lane-changing Condition 1.

[0062] Lane-changing Condition 2: To verify point A in Lane 1 and point D in Lane 3, check whether there are other AI vehicles among the three points before and after point A in Lane 1 (A1, A2, A3, A4, A5, A6) and the three points before and after point D in Lane 3 (D1, D2, D3, D4, D5, D6): Among them, point A and the three points before and after it are in an idle state. Therefore, Lane 1 belongs to a section where it is safe to change lanes, and point A belongs to the target path point where it is safe to change lanes, that is, meeting Lane-changing Condition 2; there is AICar_2 occupying point D1 in front of point D, not meeting Lane-changing Condition 2.

[0063] The lane point A simultaneously satisfies the lane-changing condition 1 and the lane-changing condition 2 of AICar_1. Therefore, point A can be used as the target path point for AICar_1 to drive into next.

[0064] Steering angle calculation: After obtaining the target path point, the steering angle of the vehicle needs to be calculated next. Construct a triangle ΔABC with points A, B, and C. Given that the coordinates of points A, B, and C are A(ax, ay), B(bx, by), and C(cx, cy) respectively, the lengths of the three sides can be calculated. Among them, BC is denoted as BA is denoted as AC is denoted as The cosine value of the angle ∠ABC is denoted as cosθ. Based on cosθ, the arccosine value arccosθ can be obtained. Then, according to the arccosine arccosθ, its is calculated. Thus, the angle ∠ABC in the triangle ΔABC is calculated. ∠ABC is the steering angle angle of AICar_1. Then, control AICar_1 to turn, turn on the turn signal, and drive towards the target path point A to complete the lane-changing behavior.

[0065] It should be noted that angle can be negative. When it is less than -5 degrees, the front of the vehicle is biased to the left, and when it is greater than 5 degrees, the front of the vehicle is biased to the right.

[0066] When -5 < angle < 5, the deflection angle is too small, and it is defaulted to the straight-ahead state here. Therefore, when angle > 5, it is recorded as a right deflection, and the right turn signal is turned on; when angle < -5, it is a left deflection, and the left turn signal is turned on; otherwise, it is straight ahead, and all turn signals are turned off. When angle > 5, it deflects to the right, controls the target vehicle to turn, and turns on the right turn signal, and drives towards the target path point A to complete the lane-changing behavior. By calculating the angle angle, the angle at which the vehicle changes lanes and drives towards point A is determined, that is, the angle at which the front of the AI vehicle deflects. This angle is related to the lane point spacing and the lane width. Usually, the longer the lane point distance, the smaller the lane spacing, and the smaller the steering angle.

[0067] Combined with Figure 5 As shown, in the prior art, the AI vehicle cannot select the optimal lane to drive into according to the traffic conditions ahead, resulting in traffic congestion on lane 2, but lanes 1 and 3 are relatively idle. After implementing this method, as Figure 6 shown, the AI vehicle can detect the vehicles ahead and the traffic conditions of the adjacent lanes, and opportunistically select the optimal idle lane to drive into. The traffic flow of the entire section is relatively symmetrical and more in line with the actual road traffic flow.

[0068] Finally, it should be noted that the above technical solutions are only one embodiment of the present invention. For those skilled in the art, based on the disclosed application methods and principles of the present invention, it is very easy to make various types of improvements or deformations, not limited to the methods described in the above specific embodiments of the present invention. Therefore, the above-described manner is only preferred and does not have a restrictive meaning.

Claims

1. A method for an AI vehicle to change lanes in a virtual scenario, characterized in that, Including: In a virtual three-dimensional scene, construct a road with at least two lanes in the same direction. A path point is set every N meters at the middle position of the lanes. The path point is a trajectory point that an AI vehicle needs to follow when driving. Connect the trajectory points end to end and crosswise in the driving direction of the road to obtain a line for vehicle driving. Set a collision box for an AI vehicle that is equal in length, width, and height to itself for being detected by other AI vehicles, and set a front trigger in front of the head of the AI vehicle for detecting the vehicle ahead. The length of the front trigger is related to the real-time vehicle speed of the AI vehicle. Set several AI vehicles at different positions on the road and set the parameters of each AI vehicle. The parameters include the maximum speed, acceleration, and braking reaction parameters that can be traveled. The actual maximum vehicle speed of each AI vehicle is the smaller value between the maximum speed of the path point and the maximum speed that can be traveled. During driving, when the front trigger of the AI vehicle touches the collision box of the vehicle ahead, obtain the real-time vehicle speeds of the AI vehicle and the vehicle ahead. The real-time vehicle speed fluctuates between 0 and the actual maximum vehicle speed. When the vehicle speed of the vehicle ahead is less than T times the vehicle speed of the AI vehicle, start the lane-changing decision-making mechanism, and calculate the steering angle of the AI vehicle when the lane-changing condition is met, and control the AI vehicle to turn to complete the lane change. The lane-changing condition includes a first lane-changing condition and a second lane-changing condition. The lane-changing decision-making mechanism is: only when both the first lane-changing condition and the second lane-changing condition are met can the lane be changed. Among them: The first lane-changing condition is: first judge whether there are adjacent drivable lanes on the left and right of the AI vehicle, and then find the path point closest to the previous path point B of the AI vehicle on the adjacent drivable lanes. Confirm whether these closest path points are connected to path point B. If they are connected, the first lane-changing condition is met. The second lane-changing condition is: verify whether there are other AI vehicles on the M path points before and after these closest path points. If not, define this path point as the target path point where the AI vehicle can change lanes, and determine that the lane-changing condition is met.

2. The method according to claim 1, characterized in that, The steering angle of the AI vehicle is: the included angle formed by path point B, the target path point, and the previous path point C in the lane where path point B is located.

3. The method according to claim 1, wherein The maximum speed at which it can travel is randomly generated between the minimum possible speed and the maximum possible speed, i.e.: ; The actual maximum vehicle speed of the AI vehicle is as follows: ; Among them, is the maximum vehicle speed at the path point, is the maximum travelable speed, minPossibleSpeed is the minimum possible speed, and maxPossibleSpeed is the maximum possible speed.

4. The method according to claim 1, characterized in that, The length of the front trigger is the distance D detected by the AI vehicle from the vehicle ahead. The distance D is proportional to the real-time vehicle speed V of the AI vehicle within the preset vehicle speed range, and the distance D is a constant value when the real-time vehicle speed V is outside the preset vehicle speed range.

5. The method according to claim 4, wherein The distance D is: when V > 60, D = 100; when 10 ≤ V ≤ 60, D = *L; when 2 < V < 10, D = 0.7*V; when V ≤ 2, D = L / 2. Where C is a constant and L is the body length of the AI vehicle.

6. The method according to claim 1, wherein Calculating the steering angle of the AI vehicle and controlling the steering of the AI vehicle specifically includes: When the steering angle angle is less than -5, the vehicle head is deflected to the left, the left turn signal is turned on, and it drives towards the target point in the left lane. When the steering angle angle is greater than 5, the vehicle head is deflected to the right, the right turn signal is turned on, and it drives towards the target point in the right lane. When -5 < angle < 5, it is defaulted to the straight-ahead state.

7. The method according to claim 1, wherein The T times is 1.2 times.

8. The method according to claim 1, wherein The width of the front trigger is equal to the body width of the AI vehicle itself, and the height is between the body height of the AI vehicle and 1 / 3 of the body height.

Citation Information

Patent Citations

  • Processing method and device for driving simulation scene and storage medium

    CN110118661A

  • Automatic generation method and device of test instance, computer equipment and medium

    CN113065257A