CN114047754A - Unity 3D-based virtual classroom fire evacuation drilling method - Google Patents
Unity 3D-based virtual classroom fire evacuation drilling method Download PDFInfo
- Publication number
- CN114047754A CN114047754A CN202111294627.9A CN202111294627A CN114047754A CN 114047754 A CN114047754 A CN 114047754A CN 202111294627 A CN202111294627 A CN 202111294627A CN 114047754 A CN114047754 A CN 114047754A
- Authority
- CN
- China
- Prior art keywords
- algorithm
- escape
- distance
- node
- fire
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000005553 drilling Methods 0.000 title claims abstract description 14
- 230000006872 improvement Effects 0.000 claims abstract description 10
- 238000009499 grossing Methods 0.000 claims abstract description 9
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 claims abstract description 7
- 239000002245 particle Substances 0.000 claims abstract description 5
- 239000003086 colorant Substances 0.000 claims description 3
- 238000012545 processing Methods 0.000 abstract description 7
- 238000013473 artificial intelligence Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 12
- 230000008859 change Effects 0.000 description 5
- 230000004888 barrier function Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 239000002775 capsule Substances 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000002411 adverse Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000004660 morphological change Effects 0.000 description 1
- 238000010845 search algorithm Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0231—Control of position or course in two dimensions specially adapted to land vehicles using optical position detecting means
- G05D1/0246—Control of position or course in two dimensions specially adapted to land vehicles using optical position detecting means using a video camera in combination with image processing means
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0214—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory in accordance with safety or protection criteria, e.g. avoiding hazardous areas
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0221—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory involving a learning process
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0223—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory involving speed control of the vehicle
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Aviation & Aerospace Engineering (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Electromagnetism (AREA)
- Alarm Systems (AREA)
Abstract
The invention discloses a Unity 3D-based virtual classroom fire evacuation drilling method, which belongs to the technical field of virtual reality and artificial intelligence, and is characterized in that a 3ds Max software is used for establishing a basic model of a fire scene and a character role, various basic actions are added to the character role of a character, and then the character role is led into Unity3D simulation software, and a particle system carried by Unity3D is used for simulating a real scene during fire catching and water fire extinguishing, so that all escape members can fully realize the real experience of fire evacuation. In order to meet the safe escape of teachers and students to the greatest extent, the shortest escape path is planned by adopting an A-algorithm, the corresponding escape path is subjected to smoothing processing, the corresponding weight proportion is added according to the A-algorithm formula to make improvement, the life value function of character roles is set, and whether the safe escape is realized is judged by observing the residual life value indexes of the escape from a round of fire.
Description
Technical Field
The invention relates to the technical field of virtual reality and artificial intelligence, in particular to a Unity 3D-based virtual classroom fire evacuation drilling method.
Background
At present, due to various limitations of environmental fields and the like, if scenes during fire escape are simulated in real life, the scenes are often uneconomical, a large amount of manpower and material resources are consumed, along with the increasing development of artificial intelligence and virtual reality technology, mainstream simulation software such as Unity3D is used for simulating the scenes, the fire scenes are set to be as complicated as possible, the evacuation capacity of teachers and students is checked, life values are added to all members, and whether the safe escape is achieved is judged by observing the change indexes of the life values when the fire escapes.
At present, an A-star algorithm and a grid map method are combined to plan an escape path of the escape system, so that the path is shortest compared with other algorithms on one hand, and the grid method is convenient for processing escape path nodes on the other hand, but the escape system has the defects of overlarge turning angle, incapability of walking and the like in the escape process. Therefore, a virtual classroom fire evacuation drilling method based on Unity3D is provided.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: how to solve the defects of excessive searching nodes, relatively low escape efficiency and the like caused by excessive turning angle folding times, excessive angles and other adverse factors in the escape process, provides a Unity 3D-based virtual classroom fire evacuation drilling method, adopts an n-order Bezier curve algorithm, continuously improves on the basis of an A-algorithm original formula, strives for estimation cost which is infinitely close to actual cost, and realizes the shortest path (the optimal solution of the escape path).
The invention solves the technical problems through the following technical scheme, and the invention comprises the following steps:
s1: modeling characters and scenes through 3ds Max software and importing the characters and scenes into Unity 3D;
s2: the particle system carried by the Unity3D system is used for simulating two different states during fire fighting and water fire fighting;
s3: carrying out grid division on the scene by adopting a grid map method, and planning escape paths of teachers and students by using an A-star algorithm;
s4: improving the A-algorithm and smoothing the escape path.
Further, in the step S2, the passing area and the non-passing area are distinguished by two different colors.
Further, in the step S3, the original formula of a-algorithm is as follows:
F(n)=G(n)+H(n)
where f (n) is the total estimated cost from the initial state to the target state via the current state n, g (n) is the actual cost from the initial state to the current state n, and h (n) is the estimated cost of the best path from the current state n to the target state.
Further, in step S4, the improvement of the a-algorithm on h (n) in the a-algorithm, i.e. taking the intermediate value between the manhattan distance and the euclidean distance, is divided into the following three cases:
Wherein, D1 and D2 are the transverse distance and the longitudinal distance between the current node and the target node, respectively, and are:
further, in step S4, the heuristic function of the a-algorithm is modified while modifying the a-algorithm, a weighting factor W (W ≧ 1) is added to increase the influence of the distance between the current node and the target node on h (n), where f (n) is:
F(n)=G(n)+W*H(n);
meanwhile, the influence of the restriction distance and the direction on H (n) is balanced by using the direction factor, wherein H (n) is as follows:
H(n)=W1*α+W2*L
wherein, W1 and W2 are the weight of angle and distance respectively, satisfy W1+W2The value ranges of W1 and W2 are 0.35-0.45 and 0.55-0.65 respectively when the value ranges are 1, alpha is an included angle between a connecting line between a current node and an initial node and between the current node and a target node, and L is a distance between the current node and the target node;
the heuristic function of the improved A-x algorithm is as follows:
F(n)=G(n)+W*(W1*α+(1-W1)*L)。
further, in step S4, the escape path is smoothed by using a bezier curve algorithm, so that the broken line is changed into a smooth curve.
Compared with the prior art, the invention has the following advantages: aiming at the problem that a path optimal solution (shortest path) cannot be obtained due to too long or too short distance caused by the fact that one of the original heuristic functions of the A-star algorithm uses the Manhattan distance or the Euclidean distance, the method takes the intermediate value of the two, particularly when the transverse distance and the longitudinal distance are not equal, the same parts on two sides are connected by straight lines and the Euclidean distance is used, wherein the rest part in one large side uses the Manhattan distance to be approximate to the shortest path; in combination with the actual situation of a fire evacuation scene and the dynamic change of the direction distance in the escape process, the total weight is added in the A-star algorithm formula to increase the influence of the distance between the current node and the target node on the heuristic function, and the balance constraint of the distance weight and the direction weight on the influence of the cost function is added, so that the unnecessary node backtracking is reduced, and the search efficiency is improved; the path smoothing processing is carried out on the path by adopting a Bezier curve algorithm, the inflection point in the escape path is optimized by using a recursion principle, different candidate paths are generated each time, the path with smaller curvature radius is selected as an optimal path on the premise of avoiding obstacles, after n-suboptimal circulation, the times of path turning are greatly reduced, excessive unnecessary redundant nodes are eliminated, the path becomes smoother, the evacuation efficiency of the escape personnel is improved, and the safe escape is realized, so that the method is worthy of popularization and use.
Drawings
Fig. 1 is a flowchart of a Unity 3D-based virtual classroom fire evacuation drilling method according to a second embodiment of the present invention;
FIG. 2 is a diagram of a fire scenario after rasterization in accordance with a second embodiment of the present invention;
fig. 3 is a schematic diagram of a routing of the a-algorithm according to the second embodiment of the present invention;
FIG. 4a is a diagram of the algorithm A modified by D according to the second embodiment of the present invention1=D2Schematic diagram of time;
FIG. 4b is a diagram of the algorithm A modified by D according to the second embodiment of the present invention1>D2Schematic diagram of time;
FIG. 4c is a diagram of the algorithm A modified by D according to the second embodiment of the present invention1<D2Schematic diagram of time;
FIG. 5 is a flowchart illustrating a smooth escape path according to a second embodiment of the present invention;
FIG. 6 is a schematic diagram of a smooth escape path according to a second embodiment of the present invention;
FIG. 7 is a view illustrating an escape scene in an initial state according to a second embodiment of the present invention;
FIG. 8 is a view of an escape scene of an escape member in a second embodiment of the present invention when encountering a dynamic open fire;
FIG. 9 is a diagram illustrating an escape scene of an escape member when the escape member arrives at a destination according to a second embodiment of the present invention;
FIG. 10 is a data diagram of a second embodiment of the present invention in which the number of persons escaping is 42;
FIG. 11 is a data diagram of a second embodiment of the present invention in which the number of persons escaping is 34.
Detailed Description
The following examples are given for the detailed implementation and specific operation of the present invention, but the scope of the present invention is not limited to the following examples.
Example one
The embodiment provides a technical scheme: a fire evacuation drilling method in a virtual classroom based on Unity3D comprises the following processes:
basic modeling of characters and scenes is achieved through 3ds Max software and is led into Unity3D, two different states of fire ignition and water fire extinguishing are simulated through a particle system carried by a Unity3D system, the scenes are divided into grids by adopting a grid map method, escape paths of all teachers and students are planned by using an A-star algorithm, character life values are set for solving whether safe escape is achieved, and corresponding judgment is made according to the remaining life value indexes after escape.
The original formula f (n) ═ g (n) + h (n) as an algorithm, where f (n) is the total estimated cost from the initial state to the target state via the current state n, g (n) is the actual cost from the initial state to the current state n, and h (n) is the estimated cost from the current state n to the best path to the target state. In particular, h (n) is an estimation cost with uncertainty, so that h (n) is selected to determine the total cost of the path search, and there are three methods in general: manhattan distance, chebyshev distance, and euclidean distance.
Manhattan distance represents current node coordinates (X)n,Yn) And target node coordinates (X)goal,Ygoal) The direction is limited to the upper, lower, left and right directions by the sum of the absolute value of the difference between the abscissa and the absolute value of the difference between the ordinate, and the formula is as follows:
Manhattan Distance=abs|Xn-Xgoal|+abs|Yn-Ygoal|
euclidean distance represents current node coordinate (X)n,Yn) And target node coordinates (X)goal,Ygoal) The linear distance between the two points is based on the pythagorean theorem, and the formula is as follows:
Euclid Distance=sqrt((Xn-Xgoal)2+(Yn-Ygoal)2)
selecting current node coordinate (X) from Chebyshev distancen,Yn) And target node coordinates (X)goal,Ygoal) The maximum value of the absolute value of the difference between the abscissa and the absolute value of the difference between the ordinate is as follows:
Chebyshev Distance=max{abs|Xn-Xgoal|,abs|Yn-Ygoal|}
it is easy to see from the above formula that the manhattan distance has the problems of too large search cost and low efficiency due to too long path distance, while the euclidean distance is relatively short, but not necessarily the optimal solution (shortest path) of the path, so that the a-x algorithm needs to be primarily improved, mainly aiming at h (n), the principle is as follows:
taking the intermediate value of the Manhattan distance and the Euclidean distance, the method is divided into the following three cases:
wherein D is1、D2The horizontal distance and the vertical distance between the current node and the target node are respectively as follows:
because in the actual escape process, the fire condition is complex and changeable, even the fire encounters open fire to block the way of the fire in the escape process, the only way to do is to wait for rescue until the fire is extinguished by water, the loss of the fire is reduced to the minimum, and the safety of the fire is ensured, although the A algorithm is preliminarily improved before, the factors are not considered, so that the A algorithm heuristic function is further improved, the improvement thought is not adjusted, a weight factor W (W is more than or equal to 1) is added, the influence of the distance between the current node and the target node on H (n) is increased, and F (n) is changed into:
F(n)=G(n)+W*H(n)
meanwhile, the influence of the restriction distance and the direction on H (n) is balanced by using a direction factor, so that unnecessary node backtracking is reduced, the search process is accelerated, and loss can be stopped in time when a dynamic barrier is encountered, wherein H (n) is changed into:
H(n)=W1*α+W2*L
wherein, W1 and W2 are the weight of angle and distance respectively, satisfy W1+W 21, the value ranges of W1 and W2 are 0.35 to 0.45 and 0.55 to 0.65, respectively, α is an included angle between a connecting line between the current node and the initial node and between the current node and the target node, and L is a distance between the current node and the target node, in summary, the algorithm heuristic function a is:
F(n)=G(n)+W*(W1*α+(1-W1)*L)
through a series of improvements on an A-x algorithm heuristic function, the shortest escape path can be met to the greatest extent, however, as the algorithm is performed in a grid map and appears in a node form, once the algorithm is connected, the general broken lines are more, so that the posture of a person cannot be flexibly adjusted in the walking process, the person is not beneficial to safe escape, the escape path needs to be subjected to smoothing processing, the broken lines are changed into smooth curves, a Bessel curve algorithm is usually adopted, and the two points are determined according to the following formula: the data points and the control points are mainly used for adjusting the control points to enable the smooth curve to generate morphological changes, a recursion inference method is adopted, and the law is as follows:
first order curve formula: b (t) ═ 1-t) P0+tP1The parameter t is equal to [0, 1 ]]Which usually represents time when two points are connected in a straight line, there is no control point, only P0、P1Two data points.
Second order curve formula: b (t) ═ (1-t)2P0+2t(1-t)P1+t2P2,t∈[0,1]Where the parameter t generally denotes time, P0、P2As data points, P1Are control points.
Third order curve formula: b (t) ═ (1-t)3P0+3t(1-t)2P1+3t2(1-t)P2+t3P3,t∈[0,1]Where the parameter t generally denotes time, P0、P3As data points, P1、P2Are control points.
……
By analogy, an n-order curve formula is obtained:t∈[0,1]where the parameter t generally denotes time, P0、PnAs data points, P1、P2…Pn-1Are control points.
In the a algorithm system, an escape member can usually avoid a static obstacle, but often does not work for a dynamic obstacle, and then the collision is avoided by using an upper collision detection technology, which usually adopts a bounding box collision detection algorithm, and bounding boxes are divided into the following categories: a sphere surrounding box, a capsule body surrounding box and a cuboid surrounding box. Wherein the first two categories belong to sphere bounding boxes, and are provided with two capsule bodies or the central coordinates A (X) of the spheresa,Ya,Za)、B(Xb,Yb,Zb) Radius is R respectivelya、RbAnd judging whether collision occurs according to whether the straight line distance between the centers of the two is equal to the sum of the radii of the two, if so, the following formula is satisfied:
(Xa-Xb)2+(Ya-Yb)2+(Za-Zb)2=Ra+Rb
explaining that collision will occur between the two, the rectangular parallelepiped bounding box adopts the boundary principle, which follows the following formula:
Xmin≤X≤Xmax;Ymin≤Y≤Ymax;Zmin≤Z≤Zmax
Xmin、Ymin、Zmin、Xmax、Ymax、Zmaxthe minimum value and the maximum value of the other cuboid bounding box in the direction X, Y, Z respectively, and if the above formula is satisfied, collision occurs.
Example two
As shown in fig. 1, in this example, a campus scene and a character role model are first created in 3ds Max modeling software and are imported into Unity3D, then a flame and water column model is created by using a particle system carried by Unity3D, a fire scene is rasterized, a passing area and a non-passing area are distinguished by two different colors, an escape path is planned for an a algorithm, and then not only is the a algorithm continuously improved, but also the path is smoothed, and finally, the effect of safe escape is achieved.
Taking a fire evacuation scene of a certain school teaching building as an example for detailed description, with reference to fig. 1, the specific process is as follows:
the method comprises the following steps: as shown in fig. 2, the whole scene is divided into square grids by using a grid map method, in order to simplify the search area, the search area is regarded as a two-dimensional array, each item of the array represents a grid, the position coordinates and the rotation angle of the array are set as the origin for facilitating subsequent operations, the area size of the whole grid is almost equal to the area size of the ground plane component model, the passable area and the obstacle are respectively represented by gray and black, and the radius size of each square grid meets the condition that the black area just covers the obstacle as much as possible.
Step two: the escape route is planned by using an A route algorithm, the escape route is used as a heuristic search algorithm, the problem of the shortest route in the field of a static road network can be solved, for the convenience of description, a qualified center is taken as a node, A and B are respectively taken as an initial node and a target node of a search route, and a certain number of obstacles exist in a search range, and the specific implementation process is as follows:
1) starting from node a, it is stored in an "open list" of squares, in which all nodes waiting to be checked are stored.
2) Find all the squares around node a that can reach the target node B, put them in the "open list" and set their "parent" to a.
3) And deleting the node A from the 'open list', transferring the node A to a 'closed list', wherein all nodes stored in the 'closed list' do not need to be checked again.
4) G (n), h (n) of the nodes around the node a are calculated, f (n) of the nodes is obtained from f (n) ═ g (n) + h (n), and then the smallest node C of f (n) is found by comparison.
5) The previous node C is removed from the "open list" and placed in the "closed list".
6) Check if all the squares (except for the obstacles and the "closed list") adjacent to node C are in the "open list", if not, add them to the "open list" and set their "parent" to the previous node C.
7) And similarly, calculating F (n) of all grids around the node C, finding out the node with the minimum F (n), setting the node with the minimum F (n) as D, and putting the node into a closed list. And the process is circulated until the target node B appears in the 'open list', the shortest path is found, and finally the starting node A is indexed through the 'father node'.
Through the above operations, an effect graph as shown in fig. 3 is obtained, where the upper left corner of each square grid is the value of f (n), the lower left corner is the value of g (n), and the lower right corner is the value of h (n), and a pointer is provided to point to the respective parent node, and finally all the grids with dots in the graph are chained together to represent the shortest path planned by the a algorithm.
If the algorithm A is applied to a fire escape scene, it is far from sufficient to satisfy the initial formula, because the fire scene is complex, and even a fire suddenly breaks out in the escape course to block the way, which is not beneficial to safe escape, so it needs to make an improvement on the algorithm A, the cost value of G (n) is fixed by the algorithm A heuristic function formula F (n) (G (n) + H (n)), and H (n) is an estimated cost from the current node to the target node, and has uncertainty, so the point of gravity makes a corresponding improvement on H (n). As shown in fig. 4, first, regarding the problem that the shortest path cannot be satisfied due to too long or too short search distance when h (n) is used alone, a middle value between the two is not taken, a part of the larger side of the transverse distance or the longitudinal distance, which is equal to the smaller side, is cut out and connected by a straight line, the euclidean distance is used, and the remaining part of the transverse distance or the longitudinal distance is used by the manhattan distance, which is often approximate to the shortest path, and the following distance formula is attached:
Manhattan Distance=abs|Xn-Xgoal|+abs|Yn-Ygoal|
Euclid Distance=sqrt((Xn-Xgoal)2+(Yn-Ygoal)2)
Chebyshev Distance=max{abs|Xn-Xgoal|,abs|Yn-Ygoal|}
the above formula is commonly used for three distance expressions for the valuation function H (n): the manhattan distance, the euclidean distance and the chebyshev distance, when improved, the following formula is obtained according to three different conditions:
Wherein D is1=|Xn-Xgoal|、D2=|Yn-Ygoal|。
Secondly, adding weight W (W is more than or equal to 1), increasing the influence of the distance between the current node and the target node on H (n), realizing that the current node preferentially runs to the destination in the escape process, if an open fire blocks the exit, actively waiting for rescue and trying to keep away from the open fire area until the open fire is extinguished, and then escaping to the destination again, provided that the destination is located at the destinationIn the safe passable area, the included angle alpha of the speed direction of the person during escape and the distance L between the current node and the target node are constantly changed, and in order to balance the influence of the two on H (n), the weights of the two are respectively W1、W2Satisfy W1+W2At this time, the a-algorithm heuristic function becomes:
F(n)=G(n)+W*H(n);H(n)=W1*α+W2*L;
F(n)=G(n)+W*(W1*α+(1-W1)*L)
after the A-x algorithm heuristic function is improved, particularly under the condition that dynamic obstacles are relatively more, unnecessary node backtracking can be reduced, and part of search nodes with larger deviation are removed, so that the search process is accelerated, the search accuracy is improved, and the safe escape of all members is facilitated. However, it is not difficult to observe the escape route, there are many folding points of the route, the turning angle of the person is too large, especially the person can't change the direction while turning, influence its escape efficiency, is unfavorable for safe escape, usually use Bezier curve method to make the smooth processing to the escape route, the method has operability and ability to describe the picture, its principle is to optimize in the folding point, will produce different candidate routes each time, and can choose the route with smaller radius of curvature as the optimal route on the premise of avoiding obstacles, after n is optimized and circulated, has reduced the number of times of route turning greatly, has rejected too many unnecessary redundant nodes, make the route become more smooth, raise the evacuation efficiency of the evacuee, according to the process that fig. 5 and fig. 6 obtain, its implementation steps are as follows:
1) get PiAs intermediate position points, connecting front and rear adjacent position points Pi-1、Pi+1And observing whether the intersection is intersected with the barrier, if so, keeping the original path, and otherwise, canceling the intermediate position point.
2) Selecting edge Pi-1PiAnd edge PiPi+1The middle-short side is taken as the tangent of the arc, and a perpendicular line is taken perpendicular to the side, and the cross angle is Pi-1PiPi+1Angle bisector of (A) toi。
3) Judging whether the circular arcs intersect at the edge P or noti-1PiAnd edge PiPi+1The intersection point A of the longer and middle sidesiIf present, by arc Pi+1AiInstead of fold line Pi-1PiPi+1Until all nodes are traversed, performing the same operation on all nodes; otherwise, continuing to select the next adjacent node on the shorter edge, and repeating the operation of the step (2).
The algorithm adopts recursive reasoning, and the rule is as follows:
first order curve formula: b (t) ═ 1-t) P0+tP1Wherein the parameter t is ∈ [0, 1 ]]Which usually represents time when two points are connected in a straight line, there is no control point, only P0、P1Two data points.
Second order curve formula: b (t) ═ (1-t)2P0+2t(1-t)P1+t2P2,t∈[0,1]Where the parameter t generally denotes time, P0、P2As data points, P1Are control points.
Third order curve formula: b (t) ═ (1-t)3P0+3t(1-t)2P1+3t2(1-t)P2+t3P3,t∈[0,1]Where the parameter t generally denotes time, P0、P3As data points, P1、P2Are control points.
……
By analogy, an n-order curve formula is obtained:t∈[0,1]where the parameter t generally refers to time, P0、PnAs data points, P1、P2…Pn-1Are control points.
Next, simulation experiment is carried out, escape is divided into 3 stages, as shown in fig. 7, 8 and 9, in order to find the rule, two groups of different escape people are set, one group is 42 people, the other group is 34 people, 3 groups are set in the same group of experiment, the conditions of each group are different, the conditions of each group are respectively that no treatment is carried out, only path smoothing treatment is carried out but A algorithm improvement is not carried out, smoothing treatment and A algorithm improvement are carried out, the total time spent by all people for escaping is calculated by using a timer function, in order to visually know the safe escape conditions of all escape members under different conditions, Sliders are added to represent the life values (the initial value is 100) of all the escape members, in the escape process, when dynamic open fire occurs, the life values are stopped, and the speed of the life values is reduced at 6 points per second until the fire is extinguished by water, and finally the escape destination is reached, and counting the remaining life values at this time, and the specific result is shown in fig. 10 and fig. 11, it is not difficult to find through the result that only in the case that the weight improvement of the a-x algorithm and the path smoothing processing are both satisfied, although the escape time is slightly increased by several seconds, the remaining life values of the escape members are the most, which indicates that the escape mode is the safest, because after the path is smoothed, the person has a target direction during the fire escape, can flexibly change the direction during the turning, can timely get away from the open fire area when encountering a dynamic open fire, ensures the safety of the person, and once being extinguished, the person can immediately run to the destination.
To sum up, in the virtual classroom fire evacuation practicing method based on Unity3D of the above embodiment, to solve the problem that a path optimal solution (shortest path) cannot be obtained due to too long or too short distance caused by using manhattan distance or euclidean distance in one of the original heuristic functions of the a-algorithm, the middle values of the two are taken, especially when the transverse distance and the longitudinal distance are not equal, the same parts on the two sides are connected by straight lines and euclidean distance is used, wherein the rest part in the large one side is approximated to the shortest path by using manhattan distance; in combination with the actual situation of a fire evacuation scene and the dynamic change of the direction distance in the escape process, the total weight is added in the A-star algorithm formula to increase the influence of the distance between the current node and the target node on the heuristic function, and the balance constraint of the distance weight and the direction weight on the influence of the cost function is added, so that the unnecessary node backtracking is reduced, and the search efficiency is improved; the path smoothing processing is carried out on the path by adopting a Bezier curve algorithm, the inflection point in the escape path is optimized by using a recursion principle, different candidate paths are generated each time, the path with smaller curvature radius is selected as an optimal path on the premise of avoiding obstacles, after n-suboptimal circulation, the times of path turning are greatly reduced, excessive unnecessary redundant nodes are eliminated, the path becomes smoother, the evacuation efficiency of the escape personnel is improved, and the safe escape is realized, so that the method is worthy of popularization and use.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (6)
1. A Unity 3D-based virtual classroom fire evacuation drilling method is characterized by comprising the following steps:
s1: modeling characters and scenes through 3ds Max software and importing the characters and scenes into Unity 3D;
s2: the particle system carried by the Unity3D system is used for simulating two different states during fire fighting and water fire fighting;
s3: carrying out grid division on the scene by adopting a grid map method, and planning escape paths of teachers and students by using an A-star algorithm;
s4: improving the A-algorithm and smoothing the escape path.
2. The Unity 3D-based virtual classroom fire evacuation drilling method as recited in claim 1, wherein: in the step S2, the passing area and the non-passing area are distinguished by two different colors.
3. The Unity 3D-based virtual classroom fire evacuation drilling method as recited in claim 1, wherein: in step S3, the original formula of a-algorithm is as follows:
F(n)=G(n)+H(n)
where f (n) is the total estimated cost from the initial state to the target state via the current state n, g (n) is the actual cost from the initial state to the current state n, and h (n) is the estimated cost of the best path from the current state n to the target state.
4. The Unity 3D-based virtual classroom fire evacuation drilling method as recited in claim 3, wherein: in step S4, the improvement of the a algorithm is performed on h (n) in the a algorithm, that is, the intermediate values of the manhattan distance and the euclidean distance are taken as follows:
Wherein, D1 and D2 are the transverse distance and the longitudinal distance between the current node and the target node, respectively, and are:
5. the Unity 3D-based virtual classroom fire evacuation drilling method as recited in claim 4, wherein: in step S4, the heuristic function of the a-algorithm is modified when the a-algorithm is modified, a weighting factor W (W ≧ 1) is added to increase the influence of the distance between the current node and the target node on h (n), where f (n) is:
F(n)=G(n)+W*H(n);
meanwhile, the influence of the restriction distance and the direction on H (n) is balanced by using the direction factor, wherein H (n) is as follows:
H(n)=W1*α+W2*L
wherein, W1 and W2 are the weight of angle and distance respectively, satisfy W1+W2The value ranges of W1 and W2 are 0.35-0.45 and 0.55-0.65 respectively when the value ranges are 1, alpha is an included angle between a connecting line between a current node and an initial node and between the current node and a target node, and L is a distance between the current node and the target node;
the heuristic function of the improved A-x algorithm is as follows:
F(n)=G(n)+W*(W1*α+(1-W1)*L)。
6. the Unity 3D-based virtual classroom fire evacuation drilling method as recited in claim 5, wherein: in step S4, the escape route is smoothed by using a bezier curve algorithm, and the broken line is changed into a smooth curve.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111294627.9A CN114047754A (en) | 2021-11-03 | 2021-11-03 | Unity 3D-based virtual classroom fire evacuation drilling method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111294627.9A CN114047754A (en) | 2021-11-03 | 2021-11-03 | Unity 3D-based virtual classroom fire evacuation drilling method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114047754A true CN114047754A (en) | 2022-02-15 |
Family
ID=80207153
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111294627.9A Withdrawn CN114047754A (en) | 2021-11-03 | 2021-11-03 | Unity 3D-based virtual classroom fire evacuation drilling method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114047754A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115077513A (en) * | 2022-05-31 | 2022-09-20 | 北京科技大学 | Mixed reality method for escape and risk avoidance of personnel in underground space structure dangerous accidents |
CN115775055A (en) * | 2023-02-10 | 2023-03-10 | 西南交通大学 | Method, device, equipment and medium for predicting personnel evacuation time of multi-story building |
-
2021
- 2021-11-03 CN CN202111294627.9A patent/CN114047754A/en not_active Withdrawn
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115077513A (en) * | 2022-05-31 | 2022-09-20 | 北京科技大学 | Mixed reality method for escape and risk avoidance of personnel in underground space structure dangerous accidents |
CN115077513B (en) * | 2022-05-31 | 2024-08-27 | 北京科技大学 | Mixed reality method for escape and danger avoidance of personnel in dangerous accident of underground space structure |
CN115775055A (en) * | 2023-02-10 | 2023-03-10 | 西南交通大学 | Method, device, equipment and medium for predicting personnel evacuation time of multi-story building |
CN115775055B (en) * | 2023-02-10 | 2023-04-28 | 西南交通大学 | Method, device, equipment and medium for predicting personnel evacuation time of multi-storey building |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Wang et al. | A multilayer path planner for a USV under complex marine environments | |
Hao et al. | Dynamic path planning of a three-dimensional underwater AUV based on an adaptive genetic algorithm | |
CN114047754A (en) | Unity 3D-based virtual classroom fire evacuation drilling method | |
Zheng et al. | Evolutionary route planner for unmanned air vehicles | |
Zhu et al. | Task assignment and path planning of a multi-AUV system based on a Glasius bio-inspired self-organising map algorithm | |
CN107228673A (en) | Route planner and device | |
CN111639809A (en) | Multi-agent evacuation simulation method and system based on leaders and panic emotions | |
CN104331917B (en) | A kind of panic crowd's escape analogy method | |
WO2020181934A1 (en) | Method and device for determining position of target object on the basis of particle swarm algorithm | |
Liu et al. | Intelligent optimization method for the evacuation routes of dense crowds on cruise ships | |
CN105701314A (en) | Complex crowd evacuation behavior simulation method based on self-adaption intelligent agent model | |
Ouelmokhtar et al. | Energy-based USV maritime monitoring using multi-objective evolutionary algorithms | |
CN113253738A (en) | Multi-robot cooperation trapping method and device, electronic equipment and storage medium | |
Xie et al. | 2.5 D navigation graph and improved a-star algorithm for path planning in ship inside virtual environment | |
CN109740192B (en) | Crowd evacuation simulation method and system based on Arnold emotion model | |
CN117371760B (en) | Layered passenger ship personnel emergency evacuation method considering deadline and congestion relief | |
Zhang et al. | Global path planning for mobile robot based on A∗ algorithm and genetic algorithm | |
Zhang et al. | An improved particle swarm optimization based on age factor for multi-AUV cooperative planning | |
Hohmann et al. | Three-dimensional urban path planning for aerial vehicles regarding many objectives | |
Li et al. | Ship Formation Algorithm Based on the Leader–Follower Method | |
Makarov et al. | Voronoi-based Path Planning based on Visibility and Kill/Death RatioTactical Component. | |
CN110155328B (en) | Method for carrying out medical material distribution by unmanned aerial vehicle aiming at earthquake disaster area mobile clinic | |
Jeon et al. | Aerial chasing of a dynamic target in complex environments | |
Lv et al. | A deep safe reinforcement learning approach for mapless navigation | |
CN116086458A (en) | Path planning method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20220215 |
|
WW01 | Invention patent application withdrawn after publication |