A positioning method, device and computer readable storage medium
Through the particle fusion positioning method, combined with WiFi fingerprint and PDR positioning, particle swarms are generated and weights are determined, which solves the problem of low indoor positioning accuracy and achieves high-precision and stable indoor positioning.
Patent Information
- Application Number
- CN202110633425.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-07
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-06-07
AI Technical Summary
The existing indoor positioning method has the problem of low positioning accuracy, especially the WiFi-based positioning method causes instantaneous drift due to signal instability, while the pedestrian dead reckoning (PDR) method causes positioning due to the accumulation of step size and azimuth angle estimation errors. Error increases.
By obtaining the location fingerprint of the WiFi base station, the predicted distribution area of the terminal to be located is determined, and a particle swarm is generated during PDR positioning. The weight of the particles is determined based on the position, fingerprint and distribution area of the particles in the particle swarm, and the target position is finally determined to achieve Particle fusion positioning.
Effectively eliminates the cumulative error of PDR positioning, improves the accuracy of particle fusion positioning, improves positioning stability and robustness, and is suitable for conventional WiFi environments without additional infrastructure support.
Smart Images

Figure CN115515064B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of positioning technology, and in particular to a positioning method, device and computer-readable storage medium. Background Art
[0002] With the development of mobile communication technology, location-based services (LBS) have generated a series of industrial chains and created huge commercial value. In related technologies, WiFi-based positioning methods and pedestrian dead reckoning (PDR) methods are often used to locate indoor electronic devices.
[0003] Among them, the WiFi-based positioning method is limited by the instability of WiFi signals, which will cause instantaneous drift of WiFi positioning results. For the PDR positioning method, since there may be errors in the step length and azimuth estimation during the PDR positioning process, and the errors will continue to accumulate with the increase of pedestrian movement steps and the passage of time, it will eventually lead to a large positioning error.
[0004] It can be seen from the above that the indoor positioning method in the related art has the defect of low positioning accuracy. Summary of the invention
[0005] The present invention provides a positioning method, a device and a computer-readable storage medium, which can solve the problem of low positioning accuracy existing in the indoor positioning method in the related art.
[0006] To solve the above technical problems, the present invention is achieved as follows:
[0007] In a first aspect, the present invention provides a positioning method, comprising:
[0008] Obtaining a location fingerprint of a WiFi base station, and determining a predicted distribution area of a terminal to be located according to the location fingerprint;
[0009] In a case where it is determined based on pedestrian dead reckoning PDR positioning that the terminal to be positioned has a stepping behavior, generating a particle swarm according to a calculation result of the terminal to be positioned by the PDR positioning and the predicted distribution area, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position;
[0010] Determine the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area;
[0011] The target position of the terminal to be located is determined according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
[0012] In a second aspect, the present invention further provides a positioning device, comprising:
[0013] An acquisition module is used to acquire a location fingerprint of a WiFi base station and determine a predicted distribution area of a terminal to be located according to the location fingerprint;
[0014] A generating module, configured to generate a particle swarm according to a calculation result of the terminal to be located by the PDR positioning and the predicted distribution area, when it is determined that the terminal to be located has a stepping behavior based on the PDR positioning, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position;
[0015] A first determination module, used to determine the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area;
[0016] The second determination module is used to determine the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
[0017] In a third aspect, the present invention further provides a positioning device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps in the positioning method described in the first aspect.
[0018] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the positioning method described in the first aspect are implemented.
[0019] In an embodiment of the present invention, the location fingerprint of the WiFi base station is obtained, and the predicted distribution area of the terminal to be located is determined based on the location fingerprint; when the terminal to be located is determined to have a walking behavior based on pedestrian dead reckoning PDR positioning, a particle swarm is generated based on the calculation result of the PDR positioning on the terminal to be located and the predicted distribution area, wherein the particle swarm includes multiple particles, and each particle corresponds to a position; the weight of each particle in the particle swarm is determined according to the position of the particle in the particle swarm, the location fingerprint and the predicted distribution area; the target position of the terminal to be located is determined according to the weight of all particles in the particle swarm and the position of all particles in the particle swarm. In this way, PDR positioning, WiFi ranging and WiFi fingerprint positioning can be fused, and in the particle fusion positioning process, the position of the particle is combined with the possible distribution area of the terminal to be located, which can eliminate the cumulative error of PDR positioning and greatly improve the accuracy of particle fusion positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of a positioning method provided by an embodiment of the present invention;
[0021] Figure 2a Schematic diagram of the positions of the initial particle deployment elliptical area and the predicted distribution area in an embodiment of the present invention;
[0022] Figure 2b Schematic diagram of the positions of the particle initial deployment elliptical area, the particle initial circular area and the predicted distribution area in an embodiment of the present invention;
[0023] Figure 3 is a structural diagram of a positioning device provided by an embodiment of the present invention;
[0024] Figure 4 It is a structural diagram of a positioning device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] 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 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.
[0026] With the development of mobile communication technology, location-based services (LBS) have generated a series of industrial chains and created huge commercial value. At present, LBS-based applications basically use the global positioning system (GPS) function on smartphones for positioning. However, in indoor environments, since GPS signals are blocked by buildings, users cannot obtain ideal positioning effects. How to obtain the user's precise location in indoor environments has become the key to improving user experience.
[0027] Current indoor positioning technologies mainly include infrared, ultrasonic, Bluetooth, WiFi, etc. Among them, infrared, ultrasonic, and Bluetooth positioning require the support of additional hardware devices, which greatly affects their versatility. In recent years, with the popularization of WiFi networks, WiFi-based positioning technology has a lower implementation cost and has become the mainstream technology for indoor positioning. However, due to the instability of WiFi signals, this will cause instantaneous drift of WiFi positioning results. With the development of smart mobile terminals, the types of built-in sensors on terminals are becoming increasingly rich, and PDR positioning technology based on inertial sensor devices such as accelerometers, magnetometers, and gyroscopes has gradually attracted people's attention. Compared with traditional indoor positioning methods, PDR positioning technology only uses the inertial sensors built into the mobile smart terminal itself to locate the target, without the need for additional support, the positioning process will not be affected by the external environment or human factors, and the positioning cost is low. However, since there may be errors in the step length (hereinafter referred to as "step length") and azimuth estimation during the PDR positioning process, and the errors will continue to accumulate with the increase in the number of pedestrian steps and the passage of time, it will eventually lead to a large positioning error.
[0028] In the related art, in order to realize the fusion of the above-mentioned WiFi positioning technology and PDR positioning technology to avoid the cumulative error of PDR positioning and solve the defects of traditional WiFi indoor positioning technology, the following two fusion positioning methods are proposed:
[0029] 1. Fusion positioning method based on Kalman filtering: Kalman filtering models the pedestrian motion based on PDR as a linear system state equation, and uses WiFi positioning or other positioning methods as observation values to continuously correct the user's predicted position.
[0030] 2. Fusion positioning method based on particle filtering: Particle filtering simulates indoor moving targets by finding a group of randomly moving particles propagating in the indoor space, and estimates the position of the mobile terminal by replacing the integral operation with the sample mean.
[0031] However, the above two fusion positioning methods have their own defects:
[0032] For the fusion positioning method based on Kalman filtering: Since Kalman filtering requires the user's positioning error to obey the Gaussian distribution, and is affected by the path constraints of the indoor environment and the randomness of the user's movement, the indoor environment in the actual application scenario is difficult to satisfy the Gaussian distribution, which affects the model fitting in the fusion positioning method based on Kalman filtering and reduces the positioning accuracy.
[0033] For the fusion positioning method based on particle filtering: the particle filter needs to first perform random sampling of particles in the area based on the Monte Carlo method. Since the effective area cannot be determined in the relevant technology, the efficiency of this random sampling is not high; in addition, in the existing particle filter resampling process, the number of particles with large weights is usually copied, while the number of particles with low weights is reduced, which will lead to a lack of particle diversity, resulting in a large proportion of subsequent particles dying, and other problems, and will also reduce the positioning accuracy.
[0034] As can be seen from the above, the fusion positioning methods in the related technologies only fuse the positioning results based on position calculation, the degree of fusion is not high, and the positioning accuracy is relatively low.
[0035] In the positioning method provided by the present application, the positioning results of PDR are uniformly estimated with multiple features such as WiFi-based distance estimation and WiFi-based fingerprint positioning as particle weights to achieve more accurate particle sampling and particle positioning results. Moreover, the positioning method provided by the present application only needs to be implemented in a conventional WiFi environment without the need for additional infrastructure support, and has the advantages of high positioning accuracy and a wide range of adaptability.
[0036] See also Figure 1 , is a flow chart of a positioning method adopted in an embodiment of the present application, such as Figure 1 As shown, the positioning method may include the following steps:
[0037] Step 101: Obtain a location fingerprint of a WiFi base station, and determine a predicted distribution area of a terminal to be located according to the location fingerprint.
[0038] In a specific implementation, the above-mentioned predicted distribution area can be understood as: an area where the terminal to be located may be distributed. In practical applications, the predicted distribution area can be determined by the following process:
[0039] The WiFi fingerprint positioning method is used to determine the predicted position of the terminal to be positioned, and the predicted distribution area can be an area in the indoor reachable area whose distance from the predicted position is less than a preset distance.
[0040] Among them, the above-mentioned indoor accessible area can be understood as: an area located indoors that can be reached by users and determined by path analysis and other methods. For example, the indoor accessible area does not include areas where indoor walls, columns, etc. are located, and areas surrounded by screens.
[0041] In addition, the number of the above-mentioned WiFi base stations can be 1 or at least two. On the basis that the number of the above-mentioned WiFi base stations is N, and N is greater than 1, the above-mentioned acquisition of the location fingerprint of the WiFi base station can be referred to as "fingerprint", and the specific acquisition of the location fingerprint of the WiFi base station can be explained as: acquiring the location fingerprints of N base stations respectively. In practical applications, the WiFi fingerprint positioning algorithm can be executed based on the location fingerprints of the N base stations to obtain the WiFi positioning position of the terminal to be located, that is, the predicted position of the terminal to be located.
[0042] Step 102: when it is determined based on PDR positioning that the terminal to be located has a walking behavior, a particle swarm is generated according to the calculation result of the PDR positioning on the terminal to be located and the predicted distribution area, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position.
[0043] In practical applications, the above determination that the terminal to be located has a stepping behavior based on PDR positioning can be understood as: determining that the terminal to be located has a stepping behavior based on at least one of the parameters such as acceleration, step length, and direction angle of the terminal to be located determined by the PDR positioning method. For example: if it is determined based on the PDR positioning method that the terminal to be located first accelerates and then decelerates, it can be determined that the terminal to be located has a stepping behavior.
[0044] The generation of a particle swarm based on the calculation result of the terminal to be located by the PDR positioning and the predicted distribution area can be understood as: the first possible distribution area of the terminal to be located (i.e., the predicted distribution area) is predicted by the WiFi fingerprint positioning method, and the second possible distribution area of the terminal to be located is obtained by the PDR positioning method, then the particles in the generated particle swarm are located in the first possible distribution area and the second possible distribution area. In this way, the possible distribution area of the terminal to be located is obtained by fusing the WiFi fingerprint positioning method and the PDR positioning method, and the possible distribution area of the terminal to be located is used as a limited area, and a particle swarm is generated only in the limited area. The positioning result of the PDR can be fused with multiple features such as fingerprint positioning based on WiFi to generate a particle swarm based on the fused result. Compared with the random sampling of particles in the area based on the Monte Carlo method in the related art, it has higher particle sampling efficiency and more accurate particle positioning results.
[0045] Step 103: Determine the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area.
[0046] In practical applications, the weight of a particle can represent the probability of occurrence of the particle. In this step, the probability of occurrence of a particle is associated with the position of the particle, the position fingerprint and the predicted distribution area, so that the probability of occurrence of the particle can be integrated with the results of PDR positioning, WiFi fingerprint positioning and WiFi distance estimation, thereby making the determined particle weight more accurate.
[0047] Step 104: Determine the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
[0048] In practical applications, the above-mentioned determination of the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm can be understood as: performing weighted summation on the positions of all particles in the particle swarm to obtain the target position of the terminal to be located.
[0049] Of course, in addition to the above-mentioned weighted summation, other calculation methods can also be used to combine the weights and positions of all particles in the above-mentioned particle swarm. For example, all particles in the particle swarm are first optimized, and the target position of the terminal to be located is determined according to the weights and positions of the optimized particles. The specific calculation process for determining the target position of the terminal to be located is not specifically limited here.
[0050] As an optional implementation manner, the step of generating a particle swarm according to the calculation result of the PDR positioning on the terminal to be located and the predicted distribution area includes:
[0051] Determine the center point of the ellipse according to the relative position relationship between the target position of the terminal to be located at a historical moment and the predicted distribution area at a current moment;
[0052] Generate an elliptical area for initial deployment of particles according to the movement direction and movement step length of the terminal to be located at the current moment, wherein the center point of the ellipse is the center point of the elliptical area for initial deployment of particles;
[0053] When the movement direction of the terminal to be located at a historical moment is different from the movement direction at a current moment, and the particle initial deployment elliptical area does not include a turning area, generating a particle initial circular area in a target turning area, wherein the target turning area is located in a first direction of the center point of the ellipse, and the first direction is the movement direction of the terminal to be located at a historical moment;
[0054] The particle group is generated according to the particles located in the particle initial deployment elliptical area and the particle initial circular area.
[0055] It should be noted that in actual applications, the positioning of the terminal to be positioned is updated, for example, the target position of the terminal to be positioned is determined every 0.1 seconds. At this time, the target position at the above historical moment can be understood as the target position of the terminal to be positioned determined at the historical moment closest to the current moment. Of course, when starting to position the terminal to be positioned, the target position of the terminal to be positioned can directly take the positioning result of the WiFi fingerprint positioning of the terminal to be positioned.
[0056] The above-mentioned determination of the center point of the ellipse based on the relative position relationship between the target position of the terminal to be located at the historical moment and the predicted distribution area at the current moment can be understood as follows: assuming that the current moment is t, and the historical moment is t-1, at this time, if the target position of the terminal to be located at the moment t-1 If it is within the predicted distribution area, the center point of the ellipse is determined to be equal to Otherwise, the center point of the ellipse may be determined as the center point of the predicted distribution area.
[0057] The above-mentioned generation of the particle initial deployment ellipse area according to the movement direction and movement step length of the terminal to be located at the current moment can be understood as: determining the four vertices of the particle initial deployment ellipse area according to the movement direction and movement step length of the terminal to be located at the current moment:
[0058]
[0059] Among them, α t represents the moving direction of the terminal to be located at time t, l t represents the movement step length of the terminal to be located at time t; x t,c Indicates the center point of the ellipse; is vector multiplication, Represents x t,c Along the angle Direction t The distance between the two sides is , b is the width of the indoor path; Represents x t,c Along the angle Moving in the opposite direction t distance.
[0060] It should be noted that the parameters in the above calculation formula can be adjusted accordingly according to actual needs and application scenarios. For example, in areas where the WiFi signal is weak, in view of the large error in the possible distribution position of the terminal to be located by adding a constant to each of the above four vertices to expand the particle initial deployment elliptical area determined according to the position fingerprint, a displacement amount can be added to the four vertices of the particle initial deployment elliptical area to expand the area of the particle initial deployment elliptical area.
[0061] In addition, the movement direction of the terminal to be located at the historical moment is different from the movement direction at the current moment, and the particle initial deployment elliptical area does not include the turning area. It can be understood that: due to factors such as inaccurate step length estimation, when the terminal to be located has actually reached the turning area, the target position of the terminal to be located lags behind the position change of the terminal to be located. At this time, by generating a particle initial circular area in the target turning area, the particle group is generated according to the particles located in the particle initial deployment elliptical area and the particle initial circular area, so that the particles in the particle group can cover the target turning area, that is, the particles in the particle group include particles that match the actual position of the terminal to be located.
[0062] In practical applications, an initial particle swarm can be generated in advance, and the movement direction and step length of each particle in the initial particle swarm can be calculated, so as to determine the position of the particle at time t according to the movement direction, step length and position of the particle at time t-1, and judge whether the position of the particle at time t is within the particle initial deployment elliptical area and the particle initial circular area. If so, the particle is added to the particle swarm; if not, the movement direction of the particle is updated, and the position of the particle is recalculated according to the updated movement direction until the position of the particle at time t is within the particle initial deployment elliptical area and the particle initial circular area. In this way, the particles in the particle swarm can satisfy the positioning constraints of the particle initial deployment elliptical area and the particle initial circular area, thereby realizing particle filtering.
[0063] In this implementation, the predicted distribution area, the target position of the terminal to be located at the previous moment, the movement direction of the terminal to be located at the previous moment, and the movement direction and step length of the terminal to be located at the current moment are comprehensively considered to finally determine the area where the particles may be distributed. In this way, the inaccurate step length estimation problem in PDR positioning is corrected according to the difference between the previous and subsequent movements of the terminal to be located, thereby improving the accuracy of particle filtering.
[0064] As an optional implementation manner, the step of determining the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area includes:
[0065] Determining the distance constraint probability of each particle in the particle swarm according to the position of the particle in the particle swarm and the position fingerprint;
[0066] Determining the position constraint probability of each particle in the particle swarm according to the position of the particles in the particle swarm and the predicted distribution area;
[0067] The weight of the third target particle is determined according to the product of the distance constraint probability and the position constraint probability corresponding to the third target particle, wherein the third target particle is a particle in the particle group.
[0068] On the first aspect, the distance constraint probability of each particle in the particle swarm is determined respectively according to the position of the particle in the particle swarm and the position fingerprint. It can be understood that: the distance constraint probability of the particle is negatively correlated with the difference between the first distance and the second distance, wherein the first distance represents the distance between the terminal to be located and the WiFi base station determined based on WiFi fingerprint positioning, and the second distance represents the distance between the particle and the WiFi base station.
[0069] Furthermore, the step of determining the distance constraint probability of each particle in the particle swarm according to the position of the particle in the particle swarm and the position fingerprint comprises:
[0070] According to the location fingerprint, estimating a first distance between the terminal to be located and the WiFi base station;
[0071] Determine a second distance between each particle in the particle swarm and the WiFi base station according to the position of the particles in the particle swarm and the position of the WiFi base station;
[0072] According to the first distance, the second distance and the WiFi ranging error, the probability that each particle in the particle swarm is subject to the distance constraint of the WiFi base station is determined respectively.
[0073] In practical applications, the changes in WiFi signals in different areas present different characteristics. Considering the characteristics of WiFi signals being easily blocked, when the terminal to be located obtains a strong WiFi reception signal in an indoor environment, it is highly likely that there is line-of-sight communication between the terminal to be located and the WiFi base station. At this time, the indoor signal propagation model can be used to estimate the distance between the terminal to be located and the WiFi base station. In other words, the first distance between the terminal to be located and the WiFi base station can be estimated based on the location fingerprint of the WiFi base station. The closer the second distance between a particle in the particle swarm and the WiFi base station is to the above-mentioned first distance, the greater the probability that the particle can reflect the target location of the terminal to be located.
[0074] On the second aspect, the position constraint probability of each particle in the particle swarm is determined based on the position of the particles in the particle swarm and the predicted distribution area, which can be understood as follows: the weight of the target particle in the particle swarm is negatively correlated with the difference between the third position and the fourth position, wherein the third position represents the possible distribution position of the terminal to be located estimated by WiFi fingerprint positioning, and the fourth position represents the position of the target particle in PDR positioning. Moreover, the closer the position of a particle in the particle swarm is to the possible distribution position of the terminal to be located estimated by WiFi fingerprint positioning, the greater the probability that the particle can reflect the target position of the terminal to be located.
[0075] The third target particle can be any particle in the particle group, and the weight of the third target particle is determined according to the product of the distance constraint probability and the position constraint probability corresponding to the third target particle, wherein the third target particle is a particle in the particle group, which means that the weight of the particle is positively correlated with its distance constraint probability and position constraint probability, respectively. In this way, the weight value of the particle in the particle group that can reflect the target position of the terminal to be located can be increased in a targeted manner.
[0076] As an optional implementation manner, before the step of determining the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm, the method further includes:
[0077] Based on a particle resampling mechanism of a real number genetic algorithm, the particles in the particle group are optimized;
[0078] The step of determining the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm comprises:
[0079] The target position of the terminal to be located is determined according to the weights of all particles in the particle swarm after the optimization process and the positions of all particles in the particle swarm after the optimization process.
[0080] In a specific implementation, the above real number genetic algorithm has the same meaning as the real number type genetic algorithm in the prior art, which will not be described in detail here.
[0081] Compared with the particle resampling method in the prior art, the particle swarm is optimized by removing low-weight particle nodes and duplicating and adding high-weight particle points, which will result in poor particle diversity in the particle swarm. In this embodiment, a real number genetic algorithm is used to mutate particles in the particle swarm, so as to add the mutated particles to the particle swarm, or replace particles with lower weights in the particle swarm, so as to enrich the diversity of particles in the particle swarm, thereby making the target position of the terminal to be located determined according to the diversified particle swarm more accurate.
[0082] In a specific implementation, particles with larger weights in a particle group may be mutated first, so that when the weight of the mutated particle is larger, the mutated particle is added to the particle group, or a particle with lower weight in the particle group is replaced.
[0083] Optionally, the step of optimizing the particles in the particle swarm based on the particle resampling mechanism of the real number genetic algorithm comprises:
[0084] Generate an intermediate particle group in an empty set state;
[0085] Normalizing the weights of all particles in the particle swarm, and using the weights of the normalized particles as fitness values of the particles;
[0086] Based on the fitness values of all particles in the particle swarm, a roulette wheel selection method is used to select a first particle and a second particle from the particle swarm;
[0087] Based on the crossover probability, performing a real number-based crossover process on the first particle and the second particle to obtain a third particle and a fourth particle;
[0088] Based on the mutation probability, performing mutation processing on the third particle and the fourth particle to obtain a first target particle and a second target particle;
[0089] Adding the first target particle and the second target particle to the intermediate particle group, and determining the fitness value of each particle in the intermediate particle group;
[0090] The particles in the particle group whose fitness value is less than the preset fitness value are replaced by the particles in the particle group whose fitness value is greater than the preset fitness value, so as to optimize the particle group.
[0091] In a specific implementation, in the above roulette wheel selection method, for particles with larger fitness values, the probability of being selected is greater, so that particles with larger weight values can be preferentially selected to participate in particle evolution.
[0092] The above crossover probability is used to determine whether the first particle and the second particle are to undergo a crossover operation; the above mutation probability is used to indicate the number of particles that are allowed to mutate. It is determined experimentally that the value of the above crossover probability is usually between 0.9 and 0.95, and the value of the above mutation probability is usually between 0.005 and 0.1. As for the specific calculation process, the above-mentioned process of performing a real number-based crossover process on the first particle and the second particle based on the crossover probability to obtain the third particle and the fourth particle, and performing a mutation process on the third particle and the fourth particle based on the mutation probability to obtain the first target particle and the second target particle is similar to the process of performing a crossover operation and a mutation operation on two individuals in the prior art, and will not be repeated here.
[0093] In addition, the above process of determining the fitness value of each particle in the intermediate particle group is the same as the process of determining the weight of each particle in the particle group in the previous embodiment, and will not be repeated here.
[0094] Moreover, the preset adaptation value can be set manually according to actual needs, for example, set to the average value of the weights of all particles in the particle swarm, or set to A times the average value of the weights of all particles in the particle swarm, where A can be a constant greater than 1.
[0095] In this embodiment, through the roulette sampling method, particles with large weight values are selected as much as possible to participate in particle evolution, and the diversity of particles in the intermediate particle group is enriched by mutating the particles. Correspondingly, particles with higher weights in the intermediate particle group are used to replace particles with lower weights in the particle group, which can also enrich the diversity of particles in the particle group. In other words, compared with the traditional particle resampling method, which removes low-weight particle nodes and copies and adds high-weight particle points, the embodiment of the present application can ensure the diversity of particles in the particle group, thereby having a better positioning effect.
[0096] In practical applications, the judgment of stepping behavior is the key to judging whether the terminal to be located has moved. In the related art, a single threshold judgment is used to judge whether the terminal to be located has stepped. The single threshold judgment is easy to cause a false step judgment result, which will affect the accuracy of PDR positioning. The embodiment of the present application can adopt the following implementation method to improve the accuracy of the stepping behavior judgment result.
[0097] As an optional implementation manner, in the case where it is determined based on PDR positioning that the terminal to be located has a stepping behavior, before the step of generating a particle swarm according to the calculation result of the PDR positioning for the terminal to be located and the predicted distribution area, the method further includes:
[0098] Based on the rotation matrix, converting the first acceleration corresponding to the terminal to be located into a second acceleration in the earth coordinate system;
[0099] Eliminating the acceleration along the gravity direction in the second acceleration to obtain a third acceleration;
[0100] Obtaining an average value of the third acceleration within a preset historical time length, and determining a positive zero-crossing peak value and a negative zero-crossing valley value of the third acceleration based on the average value;
[0101] When the positive zero-crossing peak value is greater than or equal to the positive zero-crossing detection threshold value, and the negative zero-crossing valley value is less than or equal to the negative zero-crossing detection threshold value, it is determined that the terminal to be located has a stepping behavior.
[0102] In practice, the above rotation matrix can be understood as: a conversion matrix for converting the static coordinate system (SCS) of the terminal to be located into the earth coordinate system (ECS), where the first coordinate system represents the coordinate system on the terminal to be located. In practical applications, the rotation matrix from SCS to ECS can be established using Euler angles.
[0103] After constructing the above rotation matrix, the rotation matrix can be used to convert the acceleration in the coordinate system of the terminal to be located into the second acceleration in the earth coordinate system.
[0104] In addition, by eliminating the acceleration in the direction of gravity in the second acceleration so that the retained third acceleration is the acceleration in the direction of the ground plane, it is possible to avoid the acceleration in the direction of gravity interfering with the judgment of the stepping behavior.
[0105] In implementation, the above-mentioned positive zero-crossing peak value can be understood as the acceleration in the forward direction. If the positive zero-crossing peak value is greater than zero, it indicates that the terminal to be located has an acceleration behavior; and the above-mentioned negative zero-crossing valley value can be understood as the acceleration in the backward direction, or the deceleration in the forward direction. If the negative zero-crossing valley value is greater than zero, it indicates that the terminal to be located has a deceleration behavior.
[0106] In actual applications, the positive zero-crossing detection threshold value can be a constant greater than zero, and the negative zero-crossing detection threshold value can be a constant less than zero. In implementation, the values of the positive zero-crossing detection threshold value and the negative zero-crossing detection threshold value can be adjusted according to the actual application scenario. For example, if the user's walking speed or step length is greater, the value of the positive zero-crossing detection threshold value can be greater, and the value of the negative zero-crossing detection threshold value can be smaller. The values of the positive zero-crossing detection threshold value and the negative zero-crossing detection threshold value are not specifically limited here.
[0107] In this implementation, the positive zero-crossing peak value is compared with the positive zero-crossing detection threshold value, and the negative zero-crossing valley value is compared with the negative zero-crossing detection threshold value, so that when the size relationship between the two satisfies the preset size relationship, it is judged that the terminal to be located has taken a step, thereby realizing a dual threshold judgment on the stepping behavior, and also realizing improving the accuracy of the stepping behavior judgment result.
[0108] For the sake of convenience, the following embodiments use a specific calculation formula as an example to illustrate the positioning method provided in the embodiments of the present application. However, it should be noted that in practical applications, the values of the parameters in the following formulas and the types of parameters can be adjusted accordingly according to actual needs, and the positioning method provided in the embodiments of the present application is not specifically limited here:
[0109] The positioning method provided in the embodiment of the present application can also be referred to as a PDR and WiFi fusion positioning method based on constrained particle filtering. The method can be roughly divided into the following six major steps:
[0110] Step 1: Based on WiFi ranging and the location fingerprint of the WiFi base station, the WiFi positioning position of the terminal to be positioned and the predicted distribution area of the terminal to be positioned are obtained;
[0111] Step 2: judging whether the terminal to be located has a stepping action at time t based on a stepping judgment method based on double thresholds;
[0112] Step 3: Based on the predicted distribution area and the step length, direction angle and other parameters of the terminal to be located obtained by PDR positioning, a particle swarm is generated using an elliptical area constraint method;
[0113] Step 4: determining the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area;
[0114] Step 5: Based on the resampling evolution operation of the real number genetic algorithm, the particles in the particle swarm are optimized and the optimized particle swarm is output;
[0115] Step 6: Determine the target position of the terminal to be located according to the weights of all particles in the optimized particle swarm and the positions of all particles in the optimized particle swarm.
[0116] For the above step 1, the calculation process includes the following small steps:
[0117] Step 11), set the positioning time t=1, and start the positioning process.
[0118] Here, t can be understood as the current moment. This step indicates that the moment when the positioning process is started is the initial moment. At this time, the value of t is 1, and as time goes by, the value of t will gradually increase. For example, the value of t increases by 1 for each unit time interval.
[0119] Step 12) Obtain the location fingerprints of the M WiFi base stations sensed at time t And apply the WiFi fingerprint positioning algorithm to get the WiFi positioning location
[0120] in, represents the sampling value of the location fingerprint of the mth WiFi base station; m can be an integer between 1 and M; and M is a positive integer greater than 1; f wifi (R t ) indicates that the t Perform WiFi positioning calculation to obtain the positioning result of the terminal to be positioned at time t
[0121] Step 13), determine whether t is equal to 1.
[0122] In this step, if t = 1, let the target position at time t be satisfy If t is greater than 1, execute step 4).
[0123] in, represents the target position of the terminal to be located at time t; Indicates the target position of the terminal to be located at time t-1.
[0124] Step 14), As the center of the circle, with a preset distance Δ wifi As the radius, generate a circular area Optional area for WiFi positioning.
[0125] In this step, the above Indicates As the center of the circle, and with Δ wifi The area of the circle with radius .
[0126] Step 15) Locate the optional area Remove the unreachable area An constraint of indoor positioning and record the predicted distribution area of the terminal to be positioned as
[0127] The above-mentioned unreachable area has the same meaning as the unreachable area in the previous embodiment, and the above-mentioned predicted distribution area It has the same meaning as the predicted distribution area in the previous embodiment and will not be repeated here.
[0128] This step is used to determine the possible distribution area of the terminal to be located at time t
[0129] For the above step 2, the calculation process includes the following small steps:
[0130] Step 21), using the Euler angle v euler =[ψ t ,θ t ,φ t ] Construct the rotation matrix from the mobile smart terminal coordinate system (SCS) to the earth coordinate system (ECS) Mainly include:
[0131]
[0132]
[0133]
[0134]
[0135] Among them, the above Euler angle v euler has the same meaning as the Euler angle in the prior art, and ψ t ,θ t and φ t They represent the precession angle, nutation angle and rotation angle respectively, which will not be described here; Represents the rotation matrix along the z-axis; Represents the rotation matrix along the x-axis; represents the rotation matrix along the y-axis direction; and the rotation matrix equal The product of .
[0136] Step 22), based on The first acceleration in the coordinate system of the terminal to be positioned Through the rotation matrix The second acceleration converted to the geodetic coordinate system The conversion calculation formula can be:
[0137]
[0138] Step 23), eliminate The gravitational acceleration component g[0, 0, 1] T , to get the third acceleration a l (t):
[0139]
[0140] in, It represents the components of the third acceleration of the terminal to be located at time t on the x, y, and z axes.
[0141] Step 24), based on Historical data, let the window length be n sd , use this length window to perform sliding average filtering and denoising on the current component to obtain In this window length n sd The average value of historical data within
[0142]
[0143] Step 25), based on the above Perform zero-crossing detection to extract the positive zero-crossing peak value of the terminal to be located at time t and negative crossing zero valley
[0144] Step 26), determine whether the positive zero-crossing peak meets And whether the negative crossing zero valley value satisfies
[0145] in, is the positive zero crossing detection threshold; is the negative zero crossing detection threshold.
[0146] In this step, Know If all of the above judgment conditions are met, it can be determined that the terminal to be located has taken a step at time t; otherwise, it is determined that the terminal to be located has not taken a step at time t.
[0147] It should be noted that, through the above second step, the stepping decision method based on double thresholds is implemented to determine whether the terminal to be located has a stepping behavior at time t. If not, it is determined The value of t is increased by 1, that is, t is updated to t+1, and the process returns to step 12 to calculate whether the terminal to be located has a stepping action at the next time node (t+1); if so, the step length SL of the stepping action is output. t , the SL t It can be obtained by the following calculation formula:
[0148]
[0149] Wherein, K is a constant value.
[0150] For the above step 3, the calculation process includes the following small steps:
[0151] Step 31), according to the geomagnetic data at time t and the angular velocity of the gyroscope at time t Calculate the direction angle α at time t when the terminal to be located takes a step t , which is calculated as:
[0152]
[0153] in, Respectively represent m t Component projection on the x, y, z axes, Respectively represent gyro t Component projection on the x, y, and z axes, F sam is the sampling frequency.
[0154] In implementation, the geomagnetic data m t It can be determined based on the detection result of the magnetometer on the terminal to be positioned, and the gyroscope angular velocity value gyro t It can be determined based on the detection result of the gyroscope on the terminal to be positioned.
[0155] Step 32) Obtain the target location of the terminal to be located at time t-1 And judge Is it located in the area If yes, set the center point of the ellipse Otherwise, set x t,c For Region The center point of .
[0156] Step 33), obtain the movement direction α of the terminal to be located at time t t , movement step length l t , and based on α t and l t , generate the initial particle deployment ellipse G t , G t The four vertices are:
[0157]
[0158] in, is vector multiplication, Represents x t,c Along the angle Direction t The distance, b is the width of the path, Represents x t,c Along the angle Moving in the opposite direction t distance.
[0159] For example: Figure 2a As shown, the G t The region where the particles are initially deployed may be the elliptical region 201, Yes Figure 2a The predicted distribution area 202 shown in FIG. 2 takes the WiFi positioning position X of the terminal to be positioned at time t as the center.
[0160] Step 34), obtain the movement direction α of the terminal to be located at time t-1 t-1 , if we judge α t-1 With α t No, same direction, and ellipse G t If the turning position is not included in the x, then the step length estimation is inaccurate, resulting in the terminal to be located actually reaching the turning point, while the calculated target position of the terminal to be located lags behind the position change of the terminal to be located. t,c Along α t-1 The direction selects the nearest target turning point and generates the particle initial circle G at the target turning point. o , where G o The center of is the center position of the turn, and the radius is the width of the path.
[0161] For example: Figure 2b As shown, the initial particle circle G o The region may be the particle initial circle region 203 .
[0162] In this step, when the PDR positioning calculation result is inaccurate, causing the actual position of the terminal to be positioned to not match the target position, an initial particle circle G is generated at the target turning point. o , so that the particle initial circle G o The particles generated within can correctly reflect the actual position of the terminal to be located.
[0163] Step 35), input the number of particles P = |p|, and set the intermediate variable i = 1.
[0164] Wherein, P represents a particle group, and the particle group includes p particles, wherein p is an integer greater than 1.
[0165] In this step, by setting the intermediate variable i=1, it means taking the first particle in the particle group P as the starting point, and iteratively calculating the position of each particle in the particle group P.
[0166] Step 36), for the i-th particle in the particle group P, according to the change amplitude δ of the particle movement direction hd , calculate the direction of motion of particle i for:
[0167]
[0168] Among them, F normrand (1) represents a Gaussian random number with a mean of 1.
[0169] Step 37), for the i-th particle, according to the particle step change amplitude δ sl , calculate the step length of the i-th particle for:
[0170]
[0171] Among them, l t Represents the movement step length of the terminal to be located at time t.
[0172] Step 38), calculate the coordinates of the i-th particle for:
[0173]
[0174] Step 39), determine the coordinates Is it in G t or G o If yes, execute step 310); otherwise, return to step 36).
[0175] In this step, if the coordinates Not in G t or G o , it means the calculated Not available, so discard the And return to step 36) to recalculate the position of the i-th particle until the coordinates In G t or G o middle.
[0176] Correspondingly, if the coordinates In G t or G o , it means the calculated Available, at this time, the coordinate dimension of the i-th particle can be determined
[0177] Step 310), add 1 to the value of i, and determine whether i>p is satisfied. If so, execute step 311); otherwise, return to step 36).
[0178] In this step, if i>p, it means that the positions of all particles in the particle group P have been calculated, thus ending the particle position calculation process. If i≤p, return to step 36) to calculate the position of the next particle i+1 in the particle group.
[0179] Step 311), output the positions of P particles that satisfy the ellipse constraint
[0180] It should be noted that through the third step above, the predicted distribution area is achieved And the step change parameter δ of the terminal to be located at time t sl , direction change parameter δ hd , step length SL t and direction angle α t , using the elliptical region constraint method to generate P particles
[0181] For the above step 4, the calculation process includes the following small steps:
[0182] Step 41) Obtain the fingerprints of M WiFi base stations collected by the terminal to be located at time t
[0183] Step 42), estimate the first distance d between the terminal to be located and the mth WiFi base station at time t m :
[0184]
[0185] Where r0 is the free space loss, γ is the path loss coefficient, α and β are environmental variables, and m can be any integer between 1 and M.
[0186] Step 43), according to the particle position Calculate the second distance between the i-th particle and the m-th WiFi base station at time t in, is the location of the mth WiFi base station.
[0187] Step 44), according to With dm, calculate the probability that the i-th particle is subject to the distance constraint of the m-th WiFi base station at time t
[0188]
[0189] Among them, σ d is the variance of WiFi ranging error.
[0190] Step 45), calculate the probability that the i-th particle is subject to the distance constraint of all WiFi base stations at time t
[0191]
[0192] in, It means taking m from 1 to M in sequence and calculating to The product of .
[0193] It should be noted that, through the above steps 41) to 45), each particle is Based on particle position The fingerprints of M WiFi base stations in the network at time t Use the probability generation method of WiFi ranging to generate the distance constraint probability of the i-th particle at time t
[0194] Step 46), for each particle Based on particle position and the WiFi location at time t Generate the position constraint probability of the i-th particle at time t
[0195]
[0196] Among them, σ i is the variance of the position change of the ith particle.
[0197] In practice, the above σ i The value of can be obtained by statistically analyzing the position change parameters of all particles.
[0198] Step 47), each particle The distance constraint probability With position constraint probability Multiply them together to get the weight p of each particle i at time t t,i :
[0199]
[0200] Step 48), calculate each particle The normalized weight of
[0201]
[0202] It should be noted that, through the fourth step above, the indoor signal propagation model can be used to estimate the distance between the terminal device and the WiFi base station, and a probability generation method based on ranging is proposed to calculate the distance constraint probability of the particle, and determine the weight of each particle in the particle group P based on the distance constraint probability and the position constraint probability.
[0203] For the above step 5, the calculation process includes the following small steps:
[0204] Step 51), set the genetic evolution generation s=1.
[0205] Here, s can be understood as the current number of iterations. This step indicates the start of propagation. At this time, the value of s is 1, and as the number of iterations increases, the value of s will gradually increase. For example, the value of s increases by 1 each time an iteration is completed.
[0206] Step 52), the particle group As the initial population P0 of the genetic algorithm, there are p particles in the initial population P0, and the particle coordinates are used as the individual codes of the genetic operation.
[0207] Step 53), define the normalized weight of each particle in the initial population P0 as the fitness value of the particle.
[0208] Step 54), set the empty population P′=Φ.
[0209] In this step, P′=Φ means that P′ is set to empty.
[0210] Step 55), set the intermediate variable q=1.
[0211] In this step, q can represent the number of genetic variation processing times. Each time a genetic variation processing is completed, the value of q increases by 1 until q≥p / 2, which means that the genetic variation processing of each particle in the initial population P0 has been completed.
[0212] Step 56), using the roulette method, select the first particle g1 and the second particle g2 from the population P0 according to the fitness value.
[0213] This step is the same as the specific process of selecting the first particle and the second particle from the particle group based on the fitness values of all particles in the particle group by using the roulette wheel selection method in the previous embodiment, which will not be elaborated here.
[0214] Step 57), g1 and g2 with crossover probability p c Perform a crossover operation based on real numbers to obtain the third particle g′ 2q-1 and the fourth particle g′ 2q , the specific crossover process is:
[0215]
[0216] Among them, w1 and w2 are weight coefficients, and w1+w2=1.
[0217] Step 58), respectively for the third particle g' 2q-1 and the fourth particle g′ 2q With mutation probability p m Perform mutation operation to obtain the first target particle g″ 2q-1 and the second target particle g″ 2q , the specific mutation method is:
[0218]
[0219] where θ 2q-1 , δ 2q-1 is the particle g′ 2q-1 The random perturbation angle and amplitude, θ 2q , δ 2q is the particle g′ 2q The random perturbation angle and amplitude.
[0220] This step is the same as the specific process of performing mutation processing on the third particle and the fourth particle based on the mutation probability to obtain the first target particle and the second target particle in the previous embodiment, which will not be elaborated here.
[0221] Step 59), the particle g″ 2q-1 and g″ 2q Place it in the population P′, that is, update P′ to P′U{g″ 2q-1 , g″ 2q}.
[0222] Step 510), determine whether q≥p / 2 is satisfied, if so, execute step 511); otherwise, update q to q+1 and go to step 56).
[0223] This step indicates that the genetic mutation process is an iterative process, and the final P′ is output only after all particles in the particle group have undergone genetic mutation.
[0224] Step 511), calculate the distance constraint probability of each particle i∈p′ in the population P′ With position constraint probability
[0225] In this step, the distance constraint probability of each particle i∈P′ in the above-mentioned population P′ is calculated With position constraint probability The process is the same as the calculation of the distance constraint probability of each particle in the population P in step 4. and position constraint probability The process is the same and will not be repeated here.
[0226] Step 512), calculate the weight p' of each particle i∈P' in the population P' t,i :
[0227]
[0228] Step 513), calculate the normalized weighted probability of each particle i∈P′ in the population P′
[0229]
[0230] This step also includes: taking the normalized weight probability as the fitness value of each particle i∈P′ in the population P′.
[0231] Step 514), replace the low-weight probability particles in population P0 with the high-weight probability particles in population P'.
[0232] Step 515), re-normalize and calculate the weight of each particle in the population P0, and use the normalized weight as the fitness value of each particle.
[0233] Step 516), determine whether s≥S max If yes, output the population P0 as the final particle population P; otherwise, update s to s+1 and go to step 54).
[0234] Among them, S max is the maximum running generation of the genetic algorithm, and its value can be reasonably set according to actual needs.
[0235] In practical applications, before the iteration converges, the more iterations there are, the better the performance of the particles in P0 will be. Therefore, in this step, when s<S max Before that, go to step 54= to iteratively optimize P0 again.
[0236] It should be noted that the above step 5 is used to transform the particle swarm As the initial population P0 of the genetic algorithm, a resampling evolution operation based on the real number genetic algorithm is performed to optimize the particles in the population P0, and the optimized particle population P is output.
[0237] Finally, in step 6 above, the position of each particle in the optimized particle swarm P can be realized by the following formula: and the normalized weighted probability Get the target location of the terminal to be located
[0238]
[0239] It should be noted that, as time goes by, the above steps 1 to 6 may be repeatedly performed, which will not be described in detail here.
[0240] As can be seen from the above, the positioning method provided by the embodiment of the present invention first performs distance estimation based on the WiFi propagation model, obtains the possible position and predicted distribution area of the terminal to be located according to the WiFi fingerprint positioning, and determines the feasible area of the terminal to be located through the path constraint. Then, in order to avoid the occurrence of false steps during the PDR positioning process, a step judgment method based on double thresholds is designed. The stepping behavior is judged by the double threshold step judgment method. When it is judged that the terminal to be located has a stepping behavior, an initial particle generation method based on an elliptical area is designed in combination with the predicted distribution area of the terminal to be located, as well as the indoor motion path constraint and the motion direction constraint of the PDR. This method can effectively improve the efficiency of deploying particles in the Monte Carlo method in traditional particle filtering, and can solve the problem of inaccurate step length estimation in PDR positioning based on the difference between the two movements of the terminal to be located.
[0241] In addition, in the distance estimation scheme based on the WiFi propagation model, a probability generation method based on WiFi ranging is also designed to calculate the distance constraint probability of the particle. According to the particle position obtained by PDR positioning and the positioning position obtained by WiFi fingerprint positioning, the position constraint probability of the particle is calculated. The distance constraint probability and the position constraint probability are aggregated to calculate the weight of each particle in the particle swarm. Finally, in order to avoid the particle shortage caused by traditional particle resampling, a particle resampling mechanism based on real genetic algorithm is designed to enhance the diversity of particles and provide support for continuously ensuring positioning accuracy.
[0242] Therefore, the positioning method provided by the embodiment of the present invention has the following beneficial effects:
[0243] 1. High positioning accuracy. In the particle fusion positioning process, the feasible area of the particles is fully considered, and the deployment of particles is limited by the elliptical area generation method, thereby eliminating the cumulative error of PDR and greatly improving the accuracy of particle fusion positioning.
[0244] 2. Good positioning stability. The fusion positioning process of the present invention fully integrates the advantages of PDR positioning, WiFi ranging and WiFi fingerprint positioning, thereby solving the defects of traditional single positioning technology, avoiding positioning drift, and effectively improving positioning stability.
[0245] 3. High robustness. This positioning method can be implemented in a conventional WiFi environment without the need for additional infrastructure support. By judging the change in the direction of movement between two movements, it can be applied to indoor fusion positioning scenarios with different speeds and paces, and has good universality.
[0246] See also Figure 3 , is a structural diagram of a positioning device provided in an embodiment of the present application, such as Figure 3 As shown, the positioning device 300 may include:
[0247] The acquisition module 301 is used to acquire the location fingerprint of the WiFi base station and determine the predicted distribution area of the terminal to be located according to the location fingerprint;
[0248] A generating module 302 is used to generate a particle swarm according to a calculation result of the terminal to be located by the PDR positioning and the predicted distribution area, when it is determined that the terminal to be located has a stepping behavior based on the PDR positioning, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position;
[0249] A first determination module 303 is used to determine the weight of each particle in the particle swarm according to the position of the particle in the particle swarm, the position fingerprint and the predicted distribution area;
[0250] The second determination module 304 is used to determine the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
[0251] Optionally, the generating module 302 includes:
[0252] A first determining unit, configured to determine the center point of the ellipse according to a relative position relationship between a target position of the terminal to be located at a historical moment and the predicted distribution area at a current moment;
[0253] A first generating unit is used to generate an elliptical area for initial deployment of particles according to a movement direction and a movement step length of the terminal to be located at a current moment, wherein the center point of the ellipse is the center point of the elliptical area for initial deployment of particles;
[0254] A second generating unit is configured to generate a particle initial circular area in a target turning area when the movement direction of the terminal to be located at a historical moment is different from the movement direction at a current moment and the particle initial deployment elliptical area does not include a turning area, wherein the target turning area is located in a first direction of a center point of the ellipse, and the first direction is the movement direction of the terminal to be located at a historical moment;
[0255] The third generating unit is used to generate the particle group according to the particles located in the particle initial deployment elliptical area and the particle initial circular area.
[0256] Optionally, the first determining module 303 includes:
[0257] A second determining unit, configured to determine the distance constraint probability of each particle in the particle swarm according to the position of the particle in the particle swarm and the position fingerprint;
[0258] A third determining unit, configured to determine a position constraint probability of each particle in the particle swarm according to the position of the particle in the particle swarm and the predicted distribution area;
[0259] The fourth determining unit is used to determine the weight of the third target particle according to the product of the distance constraint probability and the position constraint probability corresponding to the third target particle, wherein the third target particle is a particle in the particle group.
[0260] Optionally, the second determining unit includes:
[0261] an estimating subunit, configured to estimate a first distance between the terminal to be located and the WiFi base station according to the location fingerprint;
[0262] A first determining subunit, configured to determine a second distance between each particle in the particle swarm and the WiFi base station according to the position of the particle in the particle swarm and the position of the WiFi base station;
[0263] The second determining subunit is used to determine the probability that each particle in the particle swarm is subject to the distance constraint of the WiFi base station according to the first distance, the second distance and the WiFi ranging error.
[0264] Optionally, the positioning device 300 further includes:
[0265] An optimization module, used for optimizing particles in the particle swarm based on a particle resampling mechanism of a real number genetic algorithm;
[0266] The second determining module 304 is specifically configured to:
[0267] The target position of the terminal to be located is determined according to the weights of all particles in the particle swarm after the optimization process and the positions of all particles in the particle swarm after the optimization process.
[0268] Optionally, the optimization module includes:
[0269] A fourth generating unit, used for generating an intermediate particle group in an empty set state;
[0270] A normalization processing unit, used for normalizing the weights of all particles in the particle swarm, and using the weights of the particles after the normalization processing as the fitness values of the particles;
[0271] A selection unit, configured to select a first particle and a second particle from the particle group by using a roulette wheel selection method based on fitness values of all particles in the particle group;
[0272] a crossover processing unit, configured to perform a real number-based crossover processing on the first particle and the second particle based on a crossover probability to obtain a third particle and a fourth particle;
[0273] a mutation processing unit, configured to perform mutation processing on the third particle and the fourth particle based on a mutation probability to obtain a first target particle and a second target particle;
[0274] a fifth determining unit, configured to add the first target particle and the second target particle to the intermediate particle group, and determine a fitness value of each particle in the intermediate particle group;
[0275] A replacement unit is used to replace particles in the particle group whose fitness value is less than the preset fitness value with particles in the intermediate particle group whose fitness value is greater than the preset fitness value, so as to optimize the particle group.
[0276] Optionally, the positioning device 300 further includes:
[0277] A conversion module, used for converting a first acceleration corresponding to the terminal to be located into a second acceleration in a geodetic coordinate system based on a rotation matrix;
[0278] an elimination module, configured to eliminate the acceleration in the direction of gravity in the second acceleration to obtain a third acceleration;
[0279] a third determination module, configured to obtain an average value of the third acceleration within a preset historical time length, and determine a positive zero-crossing peak value and a negative zero-crossing valley value of the third acceleration based on the average value;
[0280] The fourth determination module is used to determine that the terminal to be located has taken a step when the positive zero-crossing peak value is greater than or equal to the positive zero-crossing detection threshold value and the negative zero-crossing valley value is less than or equal to the negative zero-crossing detection threshold value.
[0281] The positioning device 300 provided in the embodiment of the present application can perform the following operations: Figure 1 The various steps in the method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.
[0282] See also Figure 4 The embodiment of the present invention further provides a positioning device, the positioning device 400 includes a processor 401, a memory 402, a program or instruction stored in the memory 402 and executable on the processor 401, and the program or instruction is executed by the processor 401 to achieve the following Figure 1 The various processes of the positioning method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0283] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which implements the above-mentioned Figure 1 The various processes of the positioning method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0284] The computer-readable storage medium is, for example, a ROM, RAM, a magnetic disk or an optical disk.
[0285] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0286] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0287] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A positioning method, characterized in that: include: Obtaining a location fingerprint of a WiFi base station, and determining a predicted distribution area of a terminal to be located according to the location fingerprint; In a case where it is determined based on pedestrian dead reckoning PDR positioning that the terminal to be positioned has a stepping behavior, generating a particle swarm according to a calculation result of the terminal to be positioned by the PDR positioning and the predicted distribution area, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position; According to the location fingerprint, estimating a first distance between the terminal to be located and the WiFi base station; Determine a second distance between each particle in the particle swarm and the WiFi base station according to the position of the particles in the particle swarm and the position of the WiFi base station; Determine, according to the first distance, the second distance and the WiFi ranging error, the probability that each particle in the particle swarm is subject to the distance constraint of the WiFi base station; Determining the position constraint probability of each particle in the particle swarm according to the position of the particles in the particle swarm and the predicted distribution area; Determine the weight of the third target particle according to the product of the distance constraint probability and the position constraint probability corresponding to the third target particle, wherein the third target particle is a particle in the particle group; The target position of the terminal to be located is determined according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
2. The method according to claim 1, characterized in that The step of generating a particle swarm according to the calculation result of the terminal to be located by the PDR positioning and the predicted distribution area comprises: Determine the center point of the ellipse according to the relative position relationship between the target position of the terminal to be located at a historical moment and the predicted distribution area at a current moment; Generate an elliptical area for initial deployment of particles according to the movement direction and movement step length of the terminal to be located at the current moment, wherein the center point of the ellipse is the center point of the elliptical area for initial deployment of particles; When the movement direction of the terminal to be located at a historical moment is different from the movement direction at a current moment, and the particle initial deployment elliptical area does not include a turning area, generating a particle initial circular area in a target turning area, wherein the target turning area is located in a first direction of the center point of the ellipse, and the first direction is the movement direction of the terminal to be located at a historical moment; The particle group is generated according to the particles located in the particle initial deployment elliptical area and the particle initial circular area.
3. The method according to claim 1, characterized in that Before the step of determining the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm, the method further includes: Based on a particle resampling mechanism of a real number genetic algorithm, the particles in the particle group are optimized; The step of determining the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm comprises: The target position of the terminal to be located is determined according to the weights of all particles in the particle swarm after the optimization process and the positions of all particles in the particle swarm after the optimization process.
4. The method according to claim 3, characterized in that The step of optimizing the particles in the particle swarm based on the particle resampling mechanism of the real number genetic algorithm comprises: Generate an intermediate particle group in an empty set state; Normalizing the weights of all particles in the particle swarm, and using the weights of the normalized particles as fitness values of the particles; Based on the fitness values of all particles in the particle swarm, a roulette wheel selection method is used to select a first particle and a second particle from the particle swarm; Based on the crossover probability, performing a real number-based crossover process on the first particle and the second particle to obtain a third particle and a fourth particle; Based on the mutation probability, performing mutation processing on the third particle and the fourth particle to obtain a first target particle and a second target particle; Adding the first target particle and the second target particle to the intermediate particle group, and determining the fitness value of each particle in the intermediate particle group; The particles in the particle group whose fitness value is less than the preset fitness value are replaced by the particles in the particle group whose fitness value is greater than the preset fitness value, so as to optimize the particle group.
5. The method according to claim 1, characterized in that Before the step of generating a particle swarm based on the calculation result of the PDR positioning on the terminal to be located and the predicted distribution area when it is determined that the terminal to be located has a stepping behavior based on the PDR positioning, the method further includes: Based on the rotation matrix, converting the first acceleration corresponding to the terminal to be located into a second acceleration in the earth coordinate system; Eliminating the acceleration along the gravity direction in the second acceleration to obtain a third acceleration; Obtaining an average value of the third acceleration within a preset historical time length, and determining a positive zero-crossing peak value and a negative zero-crossing valley value of the third acceleration based on the average value; When the positive zero-crossing peak value is greater than or equal to the positive zero-crossing detection threshold value, and the negative zero-crossing valley value is less than or equal to the negative zero-crossing detection threshold value, it is determined that the terminal to be located has a stepping behavior.
6. A positioning device, characterized in that: The device comprises: An acquisition module is used to acquire a location fingerprint of a WiFi base station and determine a predicted distribution area of a terminal to be located according to the location fingerprint; A generating module, configured to generate a particle swarm according to a calculation result of the terminal to be located by the PDR positioning and the predicted distribution area, when it is determined that the terminal to be located has a stepping behavior based on the PDR positioning, wherein the particle swarm includes a plurality of particles, and each particle corresponds to a position; The first determination module is used to: According to the location fingerprint, estimating a first distance between the terminal to be located and the WiFi base station; Determine a second distance between each particle in the particle swarm and the WiFi base station according to the position of the particles in the particle swarm and the position of the WiFi base station; Determine, according to the first distance, the second distance and the WiFi ranging error, the probability that each particle in the particle swarm is subject to the distance constraint of the WiFi base station; Determining the position constraint probability of each particle in the particle swarm according to the position of the particles in the particle swarm and the predicted distribution area; Determine the weight of the third target particle according to the product of the distance constraint probability and the position constraint probability corresponding to the third target particle, wherein the third target particle is a particle in the particle group; The device also includes: The second determination module is used to determine the target position of the terminal to be located according to the weights of all particles in the particle swarm and the positions of all particles in the particle swarm.
7. A positioning device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the positioning method according to any one of claims 1 to 5 when executed by the processor.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the positioning method according to any one of claims 1 to 5 are implemented.
