Pedestrian simulation method based on SUMO
Through the integration of SUMO and Unity, combined with the A* algorithm and dynamic obstacle module, the existing pedestrian simulation tools are solved, and the accuracy and reliability of existing pedestrian simulation tools are insufficient in three-dimensional environments are realized, efficient simulation of complex urban traffic scenarios is improved. The authenticity and accuracy of pedestrian behavior simulations.
Patent Information
- Application Number
- CN202411445353.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-14
AI Technical Summary
Existing pedestrian simulation tools are insufficient in accuracy and reliability when simulating pedestrian behavior, and cannot handle complex urban traffic scenarios, especially in three-dimensional environments, and are difficult to perform precise simulation.
Using the pedestrian simulation method based on SUMO, through the integration of Unity and SUMO, the A* algorithm is used to find pedestrian paths in three-dimensional scenes, and a dynamic obstacle module is introduced, so that pedestrians can perceive and avoid obstacles in real time, supporting the creation of complex urban traffic. Scenarios, including multiple intersections and multi-level overpasses, improve simulation accuracy and reliability.
It realizes the interaction between pedestrian behavior and other traffic participants in a three-dimensional environment, provides more realistic simulation effects, supports the verification of complex urban traffic scenarios, and improves simulation accuracy and reliability.
Smart Images

Figure CN119312574A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data simulation, and in particular relates to a pedestrian simulation method based on SUMO. Background Art
[0002] With the continuous advancement of urbanization, urban traffic is facing more and more complex challenges. As an important participant in urban traffic, pedestrians' behavior has a significant impact on traffic flow, traffic safety and urban planning. Therefore, pedestrian simulation has become an important part of urban planning, traffic management and intelligent transportation system research.
[0003] In the prior art, for example, the technical solution disclosed in publication number CN113742925 is a method for simulating pedestrian flow at a signal-controlled intersection. By using cellular automation technology and combining the herd mentality of pedestrians when crossing the street, pedestrian flow at a signal-controlled intersection is simulated when pedestrians pass through a crosswalk. Under different pedestrian densities, the patent uses pedestrian flow simulation methods in dense state and non-dense state respectively.
[0004] Existing technologies: Although pedestrian simulation has broad application prospects in the above fields, existing pedestrian simulation technologies still have many deficiencies in practical applications. For example, many existing pedestrian simulation tools are mainly based on two-dimensional scenes and lack support for complex three-dimensional scenes, making it difficult to perform accurate pedestrian simulation in a three-dimensional environment. In addition, existing tools perform poorly when dealing with complex traffic scenes and dynamic environmental changes, and simulation accuracy, real-time performance, and reliability need to be improved. Summary of the invention
[0005] The purpose of the present invention is to provide a pedestrian simulation method based on SUMO to solve the problems in the prior art mentioned in the background technology, that is, the existing pedestrian simulation tools have insufficient accuracy and reliability in simulating pedestrian behavior, cannot handle complex urban traffic scenes, and lack support for three-dimensional environments.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: A pedestrian simulation method based on SUMO, comprising the following steps: Step S1, Unity pedestrian data format conversion; Step S101, inputting the starting point and multiple end points of the pedestrian path in the Unity scene to indicate the pedestrian's movement direction; Step S102, using the A* algorithm to find the name of each sidewalk that the pedestrian passes by in the three-dimensional scene according to the starting point and the end point; Step S103, determine whether the pedestrian can reach the end point, if not, then end; if the number of nodes in the path is greater than 0, then the pedestrian can reach the end point, then proceed to step S104; Step S104, traverse each end point corresponding to the current pedestrian starting point; Step S105, assigning values to pedestrian data; Step S106, generating a pedestrian path file; Step S2, SUMO is integrated with Unity; Step S3, updating the three-dimensional pedestrian position.
[0007] According to the above technical solution, in step S102, the A* algorithm steps are specifically as follows: Step S1021, first construct startNode=Node(StartRoadID) and endNode=Node(EndeNode) with the names of the starting and ending sidewalks; Step S1022, define the openList set and the closeList set, add the starting point startNode to the openList, and set its total cost nodeTotalCost to 0; Step S1023, while loop determines whether the openList set is empty, if it is empty, then enter the backtracking step, if not empty, then enter step S1024; Step S1024, select the node currentNode with the smallest nodeTotalCost+estimatedCost from the untraversed openList; Step S1025, move currentNode to closeList; Step S1026, determine whether currentNode is the end point, if yes, add it to the closeList set and go to backtracking step A2; otherwise, obtain all neighbor nodes of currentNode; Step S1027, for each node neighborNode in all neighbor nodes neighbors, if neighborNode is in closeList, it means that it has been traversed and skipped; if not, go to step S1028; Step S1028, calculating the total cost totalCost from the starting point to the neighborNode; Step S1029, calculate the estimated cost neighborNodeEstCost from neighborNode to the target node; and set nodeTotalCost of neighborNode to totalCost, estimatedCost to totalCost+neighborNodeEstCost, and set currentNode to its parent node; Step S10210, determine whether neighborNode is in openList. If neighborNode is in openList, it means that the node has been traversed, so skip and do not do any processing; if neighborNode is not in openList, add it to openList; and return to step S1027. When the length of openList is 0, end the loop.
[0008] According to the above technical solution, the backtracking step includes the following steps: Step A1, determine whether the currentNode is the end point, if it is, then end directly; if not, go to step A2; Step A2, return to search the previous node; Step A3: Generate the optimal path.
[0009] According to the above technical solution, the integration of SUMO and Unity specifically includes the following steps: Step S201, data initialization; Step S202, calling the command console, inputting the SUMO-GUI.exe file path, simulation step length and XML file, and starting the SUMO program through Untiy; Step S203, determine whether the SUMO connection status is disconnected, if yes, reconnect, if not, proceed to step S204; Step S204, receiving the pedestrian position and speed data returned by SUMO and storing them in Unity; Step S205: Unity updates the pedestrian's position, speed, direction, and behavior data based on the SUMO data.
[0010] According to the above technical solution, in step S201, data initialization includes initializing the simulation step, data update step, SUMO file location, startup port, pedestrian path, pedestrian type, pedestrian speed, and pedestrian flow XML.
[0011] According to the above technical solution, in step S203, whether the SUMO connection state is disconnected is determined by looping every 2 seconds according to the connection state of SUMOClient to determine whether the connection with SUMO is disconnected. If ConnectState is equal to Success, it indicates that it is in a connected state; otherwise, it indicates a disconnected state. If it is disconnected, try to reconnect to SUMO. If it is not disconnected, execute step S204.
[0012] According to the above technical solution, in step S3, the three-dimensional pedestrian position update includes the following steps: Step S301, obtaining the returned pedestrian two-dimensional position data according to the SUMO data interface; Step S302, obtaining the three-dimensional space point corresponding to the two-dimensional point; Step S303, determining whether the pedestrian's current position POS is the same as the pedestrian's last position, if they are the same, it means that the pedestrian's position remains unchanged, otherwise, executing step S304; Step S304, determine whether the current point is under the elevated road, if yes, update the Y value of the three-dimensional space point to the previous Y value, if not, proceed to step S305; Step S305, updating the character's motion state according to the difference between the pedestrian's last position and the current position; Step S306, record and update the pedestrian's last position as the current position POS, and wait for new position information.
[0013] According to the above technical solution, in step S302, the three-dimensional space point corresponding to the two-dimensional point is obtained by converting the two-dimensional data pos(x,y) into three-dimensional space data pos(x,0,y), and emitting a ray from directly above and directly below the position of pos in the three-dimensional space. The ray hits the sidewalk to generate a three-dimensional space point recorded as POS(x,y',y). The POS position is the three-dimensional space position of the pedestrian.
[0014] According to the above technical solution, in step S304, it is determined whether the current point is under the elevated road: if the difference between the pedestrian's last three-dimensional spatial position and the Y value of the current position POS is greater than 1m, it means that the pedestrian is walking under the elevated road, and the Y value of the current three-dimensional spatial point POS is updated to the Y value of the pedestrian's last position, and step S305 is executed.
[0015] According to the above technical solution, the character action is updated in step S305 as follows: if the Euclidean distance between the pedestrian's last position and the current position is greater than 3m, it means that the pedestrian is moving at a fast speed, and a running state animation is played; if the distance difference is equal to 0, it means that the pedestrian's position remains unchanged, and a waiting animation is played.
[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention utilizes the powerful traffic simulation capability of SUMO and can simultaneously simulate the interaction of multiple modes of transportation such as vehicles and pedestrians. By integrating the pedestrian behavior model and the traffic flow model, the interaction between pedestrians and other traffic participants is realistically simulated. Introducing a dynamic obstacle module during the simulation process enables pedestrians to perceive and avoid these obstacles in real time, such as temporarily parked vehicles or construction areas, thereby providing a more realistic simulation effect, supporting the creation of complex urban traffic scenes in SUMO, including multiple intersections, multi-level overpasses, dense traffic flows, and traffic signal changes, to verify the accuracy and reliability of the pedestrian simulation model, and creating a detailed three-dimensional urban scene in Unity, including elements such as buildings, roads, overpasses, and sidewalks, to build a realistic urban environment and make the simulation closer to the actual situation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of the steps for generating pedestrian data XML of the present invention; Figure 2 This is a flow chart of the path-finding algorithm of the present invention; Figure 3 This is the flow chart of the integration of SUMO and Unity in the present invention; Figure 4 This is a flow chart of pedestrian position update according to the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] Embodiment 1 like Figures 1 to 4 As shown, a pedestrian simulation method based on SUMO is characterized by comprising the following steps: Step S1, Unity pedestrian data format conversion; Step S101, inputting the starting point and multiple end points of the pedestrian path in the Unity scene to indicate the pedestrian's movement direction; Step S102, using the A* algorithm to find the name of each sidewalk that the pedestrian passes by in the three-dimensional scene according to the starting point and the end point; Step S103, determine whether the pedestrian can reach the end point, if not, then end; if the number of nodes in the path is greater than 0, then the pedestrian can reach the end point, then proceed to step S104; Step S104, traverse each end point corresponding to the current pedestrian starting point; Step S105, assigning values to pedestrian data; Step S106, generating a pedestrian path file; Step S2, SUMO is integrated with Unity; Step S3, updating the three-dimensional pedestrian position.
[0020] The present invention utilizes the powerful traffic simulation capability of SUMO and can simultaneously simulate the interaction of multiple modes of transportation such as vehicles and pedestrians. By integrating the pedestrian behavior model and the traffic flow model, the interaction between pedestrians and other traffic participants is realistically simulated. Introducing a dynamic obstacle module during the simulation process enables pedestrians to perceive and avoid these obstacles in real time, such as temporarily parked vehicles or construction areas, thereby providing a more realistic simulation effect, supporting the creation of complex urban traffic scenes in SUMO, including multiple intersections, multi-level overpasses, dense traffic flows, and traffic signal changes, to verify the accuracy and reliability of the pedestrian simulation model, and creating a detailed three-dimensional urban scene in Unity, including elements such as buildings, roads, overpasses, and sidewalks, to build a realistic urban environment and make the simulation closer to the actual situation.
[0021] Embodiment 2 This embodiment is a further refinement of the first embodiment.
[0022] like Figure 2 As shown, in step S102, the A* algorithm steps are specifically as follows: Step S1021, first construct startNode=Node(StartRoadID) and endNode=Node(EndeNode) with the names of the starting and ending sidewalks; Step S1022, define the openList set and the closeList set, add the starting point startNode to the openList, and set its total cost nodeTotalCost to 0; Step S1023, determine whether the openList set is empty, if so, enter the backtracking step, if not, enter step S1024; Step S1024, select the node currentNode with the smallest nodeTotalCost+estimatedCost from the untraversed openList; Step S1025, move currentNode to closeList; Step S1026, determine whether currentNode is the end point, if yes, add it to the closeList set and go to backtracking step A2; otherwise, obtain all neighbor nodes of currentNode; Step S1027, for each node neighborNode in all neighbor nodes neighbors, if neighborNode is in closeList, it means that it has been traversed and skipped; if not, go to step S1028; Step S1028, calculating the total cost totalCost from the starting point to the neighborNode; Step S1029, calculate the estimated cost neighborNodeEstCost from neighborNode to the target node; and set nodeTotalCost of neighborNode to totalCost, estimatedCost to totalCost+neighborNodeEstCost, and set currentNode to its parent node; Step S10210, determine whether neighborNode is in openList. If neighborNode is in openList, it means that the node has been traversed, so skip and do not do any processing; if neighborNode is not in openList, add it to openList and return to step S1027; when the length of openList is 0, end the loop.
[0023] The backtracking step includes the following steps: like Figure 2 As shown, step A1 determines whether the currentNode is the end point. If it is, the process ends directly; if not, the process proceeds to step A2; Step A2, return to search the previous node; Step A3: Generate the optimal path.
[0024] like Figure 3 As shown in the figure, the integration of SUMO and Unity includes the following steps: Step S201, data initialization; Step S202, calling the command console, inputting the SUMO-GUI.exe file path, simulation step length and XML file, and starting the SUMO program through Untiy; Step S203, determine whether the SUMO connection status is disconnected, if yes, reconnect, if not, proceed to step S204; Step S204, receiving the pedestrian position and speed data returned by SUMO and storing them in Unity; Step S205: Unity updates the pedestrian's position, speed, direction, and behavior data based on the SUMO data.
[0025] In step S201, data initialization includes initializing simulation step, data update step, SUMO file location, start port, pedestrian path, pedestrian type, pedestrian speed, and pedestrian flow XML.
[0026] In step S203, it is determined whether the SUMO connection state is disconnected: every 2 seconds, it is determined whether the connection with SUMO is disconnected according to the connection state of SUMOClient. If ConnectState is equal to Success, it indicates that it is in a connected state; otherwise, it indicates a disconnected state; if it is disconnected, try to reconnect to SUMO, and if it is not disconnected, execute step S204.
[0027] In step S3, Figure 4 As shown, the three-dimensional pedestrian position update includes the following steps: Step S301, obtaining the returned pedestrian two-dimensional position data according to the SUMO data interface; Step S302, obtaining the three-dimensional space point corresponding to the two-dimensional point; Step S303, determining whether the pedestrian's current position POS is the same as the pedestrian's last position, if they are the same, it means that the pedestrian's position remains unchanged, otherwise, executing step S304; Step S304, determine whether the current point is under the elevated road, if yes, update the Y value of the three-dimensional space point to the previous Y value, if not, proceed to step S305; Step S305, updating the character's motion state according to the difference between the pedestrian's last position and the current position; Step S306, record and update the pedestrian's last position as the current position POS, and wait for new position information.
[0028] In step S302, the three-dimensional space point corresponding to the two-dimensional point is obtained by converting the two-dimensional data pos(x,y) into three-dimensional space data pos(x,0,y), and emitting a ray from directly above and directly below the position of pos in the three-dimensional space. The ray hits the sidewalk to generate a three-dimensional space point recorded as POS(x,y',y). The POS position is the three-dimensional space position of the pedestrian.
[0029] In step S304, it is determined whether the current point is under the elevated road: if the difference between the pedestrian's last three-dimensional spatial position and the Y value of the current position POS is greater than 1m, it means that the pedestrian is walking under the elevated road, and the Y value of the current three-dimensional spatial point POS is updated to the Y value of the pedestrian's last position, and step S305 is executed.
[0030] The specific updating of the character action in step S305 is as follows: if the Euclidean distance between the pedestrian's last position and the current position is greater than 3m, it means that the pedestrian is moving at a fast speed, and the running state animation is played; if the distance difference is equal to 0, it means that the pedestrian's position remains unchanged, and the waiting animation is played.
[0031] In the present invention, SUMO and Unity are integrated: by developing an interface between SUMO and Unity, the simulation data in SUMO can be transmitted to Unity in real time, and the three-dimensional motion trajectory and behavior display of pedestrians are realized in Unity, so that users can directly observe the behavior and path of pedestrians in a three-dimensional environment.
[0032] Embodiment 3 The inventive concept of the present invention is: Unity pedestrian data format conversion: Step A1: Enter the starting point and multiple end points of the pedestrian path in the Unity scene to indicate the pedestrian's movement direction.
[0033] Step A2: Use the A* algorithm to find the name of each sidewalk that the pedestrian passes through in the three-dimensional scene according to the starting point and the end point, and determine the entire path of the pedestrian.
[0034] A* pedestrian path finding algorithm steps: First, construct startNode=Node(StartRoadID) and endNode=Node(EndeNode) with the names of the starting and ending sidewalks; Define openList and closeList, add the starting point startNode to openList, and set its total cost nodeTotalCost to 0.
[0035] Loop through the reachable nodes.
[0036] Step A2.1 When openList is not empty, perform the following steps: Step A2.1.1, select the node currentNode with the smallest nodeTotalCost+estimatedCost from the untraversed openList.
[0037] Step A2.1.2, move currentNode to closeList. If currentNode is the target node, backtrack and return the path. Otherwise, get all neighbor nodes of currentNode.
[0038] Step A2.1.2.1, for each neighbor node neighborNode, if neighborNode is in closeList, skip.
[0039] Step A2.1.2.2, calculate the total cost totalCost from the starting point to neighborNode.
[0040] Step A2.1.2.3, calculate the estimated cost neighborNodeEstCost from neighborNode to the target node, set neighborNode's nodeTotalCost to totalCost, estimatedCost to totalCost + neighborNodeEstCost, and set currentNode to its parent node.
[0041] Step A2.1.2.4, if neighborNode is not in openList, add it to openList.
[0042] Backtracking path: Starting from the target node, trace back to the starting node through the parent node attributes, generate a path and return.
[0043] Step A3: If the end point cannot be reached, then end; if the number of nodes in the path is greater than 0, then the end point can be reached, then proceed to step 4.
[0044] Step A4: For the input pedestrian data and path, assign values to the pedestrian data, and generate the corresponding XML pedestrian routing file according to step 5.
[0045] SUMO integrates with Unity.
[0046] Step B1: Initialize the simulation step, data update step, SUMO file location, startup port, pedestrian path, pedestrian type, pedestrian speed, and pedestrian flow XML.
[0047] Step B2: According to the C# call command console, the SUMO-GUI.exe file path, simulation step size, and XML file are automatically input, and the SUMO program is started through Untiy.
[0048] Step B3: Every 2 seconds, determine whether the connection with SUMO is disconnected according to the connection status of SUMOClient. If ConnectState is equal to Success, it means it is in the connected state; otherwise, it means it is disconnected. If it is disconnected, try to reconnect to SUMO, that is, execute steps B1 and B2; if it is not disconnected, execute step B4.
[0049] Step B4: Receive the pedestrian position and speed data returned by SUMO and store them in Unity.
[0050] Step B5: Unity updates the pedestrian's position, speed, direction, behavior, etc. based on SUMO data.
[0051] 3D pedestrian position update.
[0052] Step C1: According to the SUMO data interface, the returned pedestrian two-dimensional position data is obtained.
[0053] Step C2, convert the two-dimensional data pos(x,y) into three-dimensional space data pos(x,0,y), and emit a ray from 3000m directly above the position of the three-dimensional space pos to directly below. When the ray hits the sidewalk, a three-dimensional space point will be generated, recorded as POS(x,y',y). The POS position is the three-dimensional space position of the pedestrian.
[0054] Step C3: determine whether the pedestrian's current position POS is the same as the pedestrian's previous position. If they are the same, it means that the pedestrian's position remains unchanged. Otherwise, execute step C4.
[0055] Step C4, determine whether the current point is under the elevated road. If the difference between the pedestrian's last three-dimensional spatial position and the Y value of the current position POS is greater than 1m, it means that the pedestrian is walking under the elevated road, and the Y value of the current three-dimensional spatial point POS is updated to the Y value of the pedestrian's last position, and execute step C5.
[0056] Step C5: Update the character action (running, waiting) status according to the difference between the last position and the current position of the pedestrian. The specific method is as follows: if the Euclidean distance between the last position and the current position of the pedestrian is greater than 3m, it means that the pedestrian is moving fast, and the running state animation is played; if the distance difference is 0, it means that the pedestrian's position remains unchanged, and the waiting animation is played.
[0057] Step C6: record and update the pedestrian's last position as the current position POS, and wait for new position information.
[0058] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0059] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A pedestrian simulation method based on SUMO, characterized in that: The following steps are involved: Step S1, Unity pedestrian data format conversion; Step S101, inputting the starting point and multiple end points of the pedestrian path in the Unity scene to indicate the pedestrian's movement direction; Step S102, using the A* algorithm to find the name of each sidewalk that the pedestrian passes by in the three-dimensional scene according to the starting point and the end point; Step S103, determine whether the pedestrian can reach the end point, if not, then end; if the number of nodes in the path is greater than 0, then the pedestrian can reach the end point, then proceed to step S104; Step S104, traverse each end point corresponding to the current pedestrian starting point; Step S105, assigning values to pedestrian data; Step S106, generating a pedestrian path file; Step S2, SUMO and Unity integration; Step S3, updating the three-dimensional pedestrian position.
2. The pedestrian simulation method based on SUMO according to claim 1, characterized in that: In step S102, the A* algorithm steps are specifically as follows: Step S1021, first construct startNode=Node(StartRoadID) and endNode=Node(EndeNode) with the names of the starting and ending sidewalks; Step S1022, define the openList set and the closeList set, add the starting point startNode to the openList, and set its total cost nodeTotalCost to 0; Step S1023, while loop determines whether the openList set is empty, if it is empty, then enter the backtracking step, if not empty, then enter step S1024; Step S1024, select the node currentNode with the smallest nodeTotalCost+estimatedCost from the untraversed openList; Step S1025, move currentNode to closeList; Step S1026, determine whether currentNode is the end point, if yes, add it to the closeList set and go to backtracking step A2; otherwise, obtain all neighbor nodes of currentNode; Step S1027, for each node neighborNode in all neighbor nodes neighbors, if neighborNode is in closeList, it means that it has been traversed and is skipped; If not, proceed to step S1028; Step S1028, calculating the total cost totalCost from the starting point to the neighborNode; Step S1029, calculate the estimated cost neighborNodeEstCost from neighborNode to the target node; and set nodeTotalCost of neighborNode to totalCost, estimatedCost to totalCost+neighborNodeEstCost, and set currentNode to its parent node; Step S10210, determine whether neighborNode is in openList. If neighborNode is in openList, it means that the node has been traversed, so skip and do not do any processing; if neighborNode is not in openList, add it to openList; and return to step S1027. When the length of openList is 0, end the loop.
3. The pedestrian simulation method based on SUMO according to claim 2, characterized in that: The backtracking step includes the following steps: Step A1, determine whether the currentNode is the end point, if it is, then end directly; if not, go to step A2; Step A2, return to search the previous node; Step A3: Generate the optimal path.
4. The pedestrian simulation method based on SUMO according to claim 1, characterized in that: The integration of SUMO and Unity includes the following steps: Step S201, data initialization; Step S202, calling the command console, inputting the SUMO-GUI.exe file path, simulation step length and XML file, and starting the SUMO program through Untiy; Step S203, determine whether the SUMO connection status is disconnected, if yes, reconnect, if not, proceed to step S204; Step S204, receiving the pedestrian position and speed data returned by SUMO and storing them in Unity; Step S205: Unity updates the pedestrian's position, speed, direction, and behavior data based on the SUMO data.
5. The pedestrian simulation method based on SUMO according to claim 4, characterized in that: In step S201, data initialization includes initializing simulation step, data update step, SUMO file location, start port, pedestrian path, pedestrian type, pedestrian speed, and pedestrian flow XML.
6. The pedestrian simulation method based on SUMO according to claim 5, characterized in that: In step S203, the SUMO connection state is judged as follows: every 2 seconds, it is judged whether the connection with SUMO is disconnected according to the connection state of SUMOClient. If ConnectState is equal to Success, it indicates that the connection state is in progress; otherwise, it indicates that the connection state is in disconnection state. If the connection is disconnected, try to reconnect to SUMO. If the connection is not disconnected, execute step S204.
7. The pedestrian simulation method based on SUMO according to claim 1, characterized in that: In step S3, the three-dimensional pedestrian position update includes the following steps: Step S301, obtaining the returned pedestrian two-dimensional position data according to the SUMO data interface; Step S302, obtaining the three-dimensional space point corresponding to the two-dimensional point; Step S303, determining whether the pedestrian's current position POS is the same as the pedestrian's last position, if they are the same, it means that the pedestrian's position remains unchanged, otherwise, executing step S304; Step S304, determine whether the current point is under the elevated road, if yes, update the Y value of the three-dimensional space point to the previous Y value, if not, proceed to step S305; Step S305, updating the character's motion state according to the difference between the pedestrian's last position and the current position; Step S306, record and update the pedestrian's last position as the current position POS, and wait for new position information.
8. The pedestrian simulation method based on SUMO according to claim 7, characterized in that: In step S302, the three-dimensional space point corresponding to the two-dimensional point is obtained by converting the two-dimensional data pos(x,y) into three-dimensional space data pos(x,0,y), and emitting a ray from directly above and directly below the position of pos in the three-dimensional space. The ray hits the sidewalk to generate a three-dimensional space point recorded as POS(x,y',y). The POS position is the three-dimensional space position of the pedestrian.
9. The pedestrian simulation method based on SUMO according to claim 8, characterized in that: In step S304, it is determined whether the current point is under the elevated road: if the difference between the pedestrian's last three-dimensional spatial position and the Y value of the current position POS is greater than 1m, it means that the pedestrian is walking under the elevated road, and the Y value of the current three-dimensional spatial point POS is updated to the Y value of the pedestrian's last position, and step S305 is executed.
10. The pedestrian simulation method based on SUMO according to claim 9, characterized in that: The specific updating of the character action in step S305 is as follows: if the Euclidean distance between the pedestrian's last position and the current position is greater than 3m, it means that the pedestrian is moving at a fast speed, and the running state animation is played; if the distance difference is equal to 0, it means that the pedestrian's position remains unchanged, and the waiting animation is played.