Positioning method and device, electronic equipment and storage medium
By introducing fractional-order firefly algorithm and particle filtering technology in indoor positioning, combined with PDR and Bluetooth positioning, the problem of low indoor positioning accuracy is solved, and higher positioning accuracy and stability are achieved.
Patent Information
- Application Number
- CN202311265045.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
The indoor positioning accuracy is not high, especially in environments with strong electromagnetic interference, poor sensor accuracy and cumulative errors lead to inaccurate positioning.
The firefly algorithm based on fractional order is used to update the position of particles in the particle swarm, combined with PDR and Bluetooth positioning technology, the position of the target object is determined through particle filtering method, and the indoor electronic map is used to detect obstacle intersection points and calibrate motion directions.
It improves the accuracy of indoor positioning, reduces the impact of noise and cumulative errors, avoids the algorithm from falling into local optimization, and provides more stable and accurate position estimation.
Smart Images

Figure CN119714251A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of navigation technology, and in particular to a positioning method, device, electronic equipment and storage medium. Background Art
[0002] At present, indoor positioning is mainly achieved by obtaining the current acceleration, direction and altitude through the accelerometer, gyroscope and barometer built into the mobile terminal. However, since the accuracy of the sensors built into the mobile terminal is significantly different from that of the equipment used in the aerospace field, and there are cumulative errors, the positioning accuracy is not high. Summary of the invention
[0003] In order to solve the above problems, the embodiments of the present invention provide a positioning method, an apparatus, an electronic device and a storage medium, so as to at least solve the problem of low indoor positioning accuracy in the related art.
[0004] The technical solution of the present invention is achieved in this way:
[0005] In a first aspect, an embodiment of the present invention provides a positioning method, the method comprising:
[0006] When a valid wave peak is detected, the position of the particles in the particle swarm is updated using a firefly algorithm based on a fractional order; the valid wave peak indicates that the target object has moved; the fractional order indicates the historical position of the particles at different times;
[0007] Determining the weights of particles in the particle swarm after the positions are updated;
[0008] The position of the target object is determined based on the weights of the particles in the particle swarm.
[0009] In the above solution, determining the position of the target object based on the weights of the particles in the particle swarm includes:
[0010] Normalizing the weights of the particles in the particle swarm;
[0011] resampling the particle population;
[0012] Based on the resampled particle swarm, the position of the target object is determined.
[0013] In the above scheme, the updating of the positions of particles in the particle swarm by using the fractional-order firefly algorithm includes:
[0014] Based on the fractional order in the fractional-order-based firefly algorithm, the step factor, the spatial position of the firefly particle with the highest brightness, and the spatial position of each firefly particle at the previous moment, updating the positions of the particles in the particle group;
[0015] Wherein, the step size factor ∈[0, 1).
[0016] In the above solution, the weight of the particle in the particle swarm after the position is updated is determined, including:
[0017] The weights of the particles in the particle swarm are updated according to the PDR coordinates and the Bluetooth positioning coordinates of the target object.
[0018] In the above scheme, the method for determining the weight of the particles in the particle swarm after the updated position further includes:
[0019] According to the coordinates of the obstacle marked in advance in the indoor electronic map, determine whether there is an intersection between the particle after the position update and the obstacle;
[0020] If there is an intersection, the weight of the particle that intersects with the obstacle is set to 0.
[0021] In the above solution, the method further includes:
[0022] When it is detected that the position of the target object is located at a corner mark point on the indoor electronic map, if the gyroscope detection value of the target object is greater than a first threshold, the movement direction of the target object is calibrated according to a preset angle of the corner mark point.
[0023] In the above solution, the method further includes:
[0024] If the number of peaks with a peak value greater than the second threshold detected within the preset time period is equal to 1, it is determined that the generation of the valid peak is detected.
[0025] In a second aspect, an embodiment of the present invention provides a positioning device, the device comprising:
[0026] An updating module is used to update the position of particles in the particle swarm by using a firefly algorithm based on a fractional order when a valid wave peak is detected; the valid wave peak indicates that the target object has moved; the fractional order indicates the historical position of the particle at different times;
[0027] A first determination module, used to determine the weight of the particles in the particle swarm after the position is updated;
[0028] The second determination module is used to determine the position of the target object based on the weights of the particles in the particle swarm.
[0029] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the steps of the positioning method provided in the first aspect of the embodiment of the present invention.
[0030] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, including: the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the positioning method provided in the first aspect of the embodiment of the present invention are implemented.
[0031] In the embodiment of the present application, when a valid peak is detected, the position of the particles in the particle swarm is updated using a firefly algorithm based on a fractional order. The valid peak indicates that the target object has moved, and the fractional order indicates the historical position of the particles at different times. Then, the weights of the particles in the particle swarm after the updated position are determined, and the position of the target object is determined based on the weights of the particles in the particle swarm. Compared with the traditional particle filtering method, this embodiment introduces a fractional order in the firefly optimization algorithm. The fractional order enables the firefly algorithm to consider the position information of the particles at different historical times, rather than just the position information at the current time, which can prevent the algorithm from falling into a local optimum, reduce positioning errors, and obtain a more accurate position estimate. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of an implementation flow of a positioning method provided by an embodiment of the present invention;
[0033] Figure 2 is a schematic diagram of a particle position provided by an embodiment of the present invention;
[0034] Figure 3 It is a schematic diagram of a step counting process provided by an embodiment of the present invention;
[0035] Figure 4 is a schematic diagram of a positioning system framework provided by an embodiment of the present invention;
[0036] Figure 5 It is a flow chart of a particle filter algorithm combining fractional order and firefly optimization provided by an embodiment of the present invention;
[0037] Figure 6 is a schematic diagram of a positioning device provided by an embodiment of the present invention;
[0038] Figure 7 It is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0039] 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.
[0040] People spend more than 80% of their time studying, working and living indoors. With the development of smart terminal technology and mobile computing technology, all aspects of social needs have put forward higher requirements for indoor location-based services. The mainstream indoor positioning methods now mainly include: Bluetooth, wireless network (WIreless Fidelity, WiFi), Zigbee protocol, radio frequency identification (Radio Frequency Identification, RFID) positioning and inertial navigation positioning. However, these independent technologies have their own limitations in terms of accuracy, complexity, coverage and cost.
[0041] Inertial navigation can provide a low-cost solution for indoor positioning problems. Its theoretical basis is Newton's three laws. In the indoor area where it can be located, the accelerometer, gyroscope and barometer of the mobile smart device are used to obtain the current acceleration, direction and altitude, and the technology is used to navigate indoors according to the angle and step length. As the computing and communication capabilities of smartphones are becoming more and more powerful and popular, they can be autonomously positioned without relying on other hardware during navigation, so the price is not high. This solution is especially suitable for use in large shopping malls, hospitals and other large areas where there is a need for navigation.
[0042] However, due to the large difference in the accuracy of sensors and gyroscopes in mobile smart devices and those used in the aerospace field, and the existence of cumulative errors, this technology alone cannot be used for accurate indoor navigation. Especially in areas with strong electromagnetic interference such as factories and laboratories, additional magnetic fields are generated around the devices, which have a great impact on the sensors of mobile smart devices.
[0043] Related technologies also include positioning solutions that use a combination of a pedestrian dead reckoning (PDR) algorithm and a particle filter, but these have the following drawbacks:
[0044] 1. The indoor environment is changeable and complex. The relevant technology does not extract and utilize the indoor map features, which is different from the real indoor scene and cannot be constrained in navigation.
[0045] 2. The movement of pedestrians changes greatly when walking, such as turning, going up and down stairs, etc. The relevant technology cannot distinguish the movement mode of pedestrians and cannot verify when the pedestrians' gait changes, which affects the positioning accuracy.
[0046] 3. The particle filter method in the related technology has the problem of local optimality, which affects the positioning accuracy of the particle filter in the positioning algorithm.
[0047] In view of the shortcomings of the above-mentioned related technologies, an embodiment of the present invention provides a positioning method, which can at least improve the positioning accuracy of the target object indoors. In order to illustrate the technical solution of the present invention, a specific embodiment is used for description below.
[0048] Figure 1 This is a schematic diagram of an implementation flow of a positioning method provided by an embodiment of the present invention, wherein the execution subject of the positioning method may be an electronic device, and the electronic device may be a desktop computer, a laptop computer, or a server, etc. For example, the execution subject is a server, and the server receives sensor data sent by the target object and completes the positioning of the target object according to the sensor data.
[0049] refer to Figure 1 , positioning methods include:
[0050] S101, when a valid wave peak is detected, the positions of particles in the particle swarm are updated using a firefly algorithm based on a fractional order; the valid wave peak represents that the target object has moved, and the fractional order represents the historical positions of the particles at different times.
[0051] First, the target object can be a pedestrian or a movable device. The target object carries various sensors. If the target object is a pedestrian, the smart terminal (such as a mobile phone) carried by the pedestrian includes multiple sensors, such as: accelerometer, gyroscope, Bluetooth sensor and magnetometer.
[0052] The PDR algorithm uses data from multiple sensors such as accelerometers, magnetometers, and gyroscopes to measure and count the number of steps, stride length, and direction of pedestrians, and infer information such as the pedestrian's walking trajectory and location.
[0053] Since there are obvious peaks in spatial acceleration when people walk, the number of steps can be read through peak detection. The principle of peak detection is to detect the number of peaks in the acceleration cycle and record the number of peaks as the number of steps. However, since there are often false peaks (for example, users shake their phones quickly), which will affect the step counting results, it is necessary to detect effective peaks.
[0054] For example, when a peak is detected and the time difference between two peaks is greater than a certain time threshold, and the difference between the peak and the trough is greater than the dynamic threshold, the step number is +1, and it is confirmed as a valid peak.
[0055] Particle filtering refers to the process of finding a set of random samples propagating in the state space to approximate the probability density function, replacing the integral operation with the sample mean, and then obtaining the minimum variance estimate of the system state. These samples are figuratively called "particles", hence the name particle filtering.
[0056] The firefly algorithm is a new type of random optimization natural algorithm proposed based on the unique luminescence characteristics of fireflies. The optimization mechanism of the firefly algorithm utilizes the process of fireflies individuals constantly moving to individuals with better positions. It does not require prior knowledge and the algorithm is highly robust and adaptable.
[0057] This embodiment improves the firefly particle algorithm, combines the fractional order and the firefly optimization algorithm, and obtains a new particle filter positioning method. In the firefly algorithm, the search process uses the last memory. In order to improve the memory ability of the firefly and control the convergence ability, this embodiment adds the long-term memory of the fractional order to the firefly algorithm, and obtains the fractional order firefly algorithm, which simulates the attraction and movement behavior of fireflies and calculates the particle prediction value at time k, which can effectively improve the problem of falling into the local optimum. When applied to the particle filter algorithm, good results can be achieved and the optimal position can be calculated.
[0058] In the initial stage, the particle swarm is initialized first, and N particles are randomly generated in the positioning area. It consists of N particles in the positioning area, the weight of each particle is 1 / N, and the state space of the particle is The position coordinates at time k are (x k ,,y k ), the position at time k-1 is (x k-1 ,y k-1 ), where i=0 is the coordinate value at the time of initial positioning.
[0059] When the particles are updating their positions using the firefly optimization algorithm, each particle is analogized to a firefly, and the brightness of each firefly is initialized to L_i^(0). At the beginning, you can simply set the brightness of all fireflies to 1, or use a smaller random number. Alternatively, you can use the weight of the particle as the brightness of the firefly.
[0060] When the number of steps changes, the user moves the smartphone a distance l k When the angle between the moving direction and the y-axis is θ, the coordinates of the user at time k can be calculated as:
[0061]
[0062] Moving distance l kThe heading angle θ is obtained from the output of the PDR positioning algorithm. Due to the noise interference in the positioning system, let σ be the system observation noise. The system state equation at time k can be expressed as:
[0063]
[0064] When the movement of the target object is detected, a valid peak is generated, and the positions of the particles in the particle swarm are updated using the fractional-order firefly algorithm.
[0065] Based on the similarities between the firefly algorithm and the particle filter, each particle is analogized to a firefly, and the brightness and attractiveness of each particle are obtained. The fireflies with low brightness will move towards the fireflies with high brightness, and the brightness will continue to be updated. All particles move towards the fireflies with the highest brightness. To prevent excessive calculation, the search is stopped when the maximum number of iterations MAX is reached.
[0066] When a firefly updates and searches for the best position, it needs to interact with other fireflies. The position update formula is as follows:
[0067] x i =x i +β*(x best -x i )+α*(rand-0.5)
[0068] Among them, x i is the spatial position of firefly i, x best is the spatial position of the firefly particle with the highest brightness, α∈[0,1), α is the step factor; rand is a random number that obeys a uniform distribution on [0,1], and β is the attraction between firefly particle i and the firefly particle with the highest brightness.
[0069] When α is not equal to 1, the differential operator in the iterative equation of the firefly algorithm can be generalized from the first order to any order, thus giving the firefly algorithm the long-term memory of fractional-order differentials.
[0070] There are currently three mainstream definitions of fractional calculus, including: GL (Grumwald-Letnkov) definition, RL (Riemann-Liouville) definition and Captuo definition. Among them, the GL definition is as follows:
[0071]
[0072] From the GL definition, we can see that fractional calculus is related to all previous historical states and has long-term memory.
[0073] According to the definition of fractional-order GL, the differential expression of the fractional-order integral of a univariate signal can be derived as:
[0074]
[0075] From the above formula, we can see that the coefficients of the first n terms of the difference equation are:
[0076]
[0077] For example, if n=4, we get the position update formula:
[0078]
[0079] Wherein, v is the fractional order, which can be adjusted dynamically according to the environment, for example, the value v=0.5.
[0080] The fractional order represents the historical position of the particle at different times, where x i k-1 、x i k-2 、x i k-3 They represent the positions of the particle at time k-1, time k-2, and time k-3 respectively, and k is the current time.
[0081] For each particle, sort the firefly population according to the brightness of each firefly from small to large. When the Euclidean distance between the i-th and j-th fireflies in the firefly population is r, their attraction β is:
[0082]
[0083] Among them, β0 is the initial attraction, γ is the parameter that controls the attenuation, and r is the distance between particles.
[0084] According to the above position update formula, the positions of the particles in the particle swarm are updated.
[0085] S102, determining the weights of the particles in the particle swarm after the positions are updated.
[0086] After the particle position is updated, the particle weight needs to be recalculated.
[0087]
[0088]
[0089] d t is the geometric distance between the PDR position and the Bluetooth fingerprint position, and the Bluetooth coordinate position at time k is (x kb ,y kb ), the PDR position is (x k ,y k ).
[0090] In the process of particle filtering, each particle represents a weighted hypothesis about the current position. The larger the weight, the more accurate the positioning. The particle weight at time k is calculated based on the probability model and obeys the normal distribution. ω is the offset standard deviation of the PDR positioning result.
[0091] S103: Determine the position of the target object based on the weights of the particles in the particle swarm.
[0092] The step of determining the position of the target object based on the weights of the particles in the particle swarm comprises:
[0093] Normalizing the weights of the particles in the particle swarm;
[0094] resampling the particle population;
[0095] Based on the resampled particle swarm, the position of the target object is determined.
[0096] According to the formula, the particle weights are normalized:
[0097]
[0098] Resampling: As the number of iterations increases, the weights of particles become unbalanced, and a few particles have large weights, causing the posterior probability distribution to be affected by a few particles, reducing the filtering effect. The solution to particle degradation is to increase the number of particles and resample. This embodiment uses resampling to improve particle diversity.
[0099] Simple random resampling: Generate N random numbers from a uniform distribution U[0, 1), sort these N random numbers from small to large, and count the weight interval of each particle The number of random numbers inside is N i . Duplicate all particles, particles with large weights are copied in large quantities, and particles with small weights are copied in small quantities. Update the predicted system state X k =(x k ,y k ,θ k ).
[0100] Finally, based on the resampled particle swarm, the position of the target object is output.
[0101]
[0102] Wherein, X=(x0, y0) is the position of the target object estimated in this iteration.
[0103] After the target object step number is detected to be unchanged, the particle transfer step is entered until the navigation ends.
[0104] The embodiment of the present application adds fractional order to the firefly-based particle filter algorithm, so that the firefly algorithm has the long-term memory of fractional order differentials. This has the following advantages:
[0105] More stable positioning results: Long-term memory enables the algorithm to consider the particle's past position information, not just the current position information. This helps reduce the impact of noise and short-term measurement errors on the positioning results, thereby providing more stable positioning.
[0106] More accurate trajectory estimation: In inertial navigation, long-term memory can more accurately estimate the user's trajectory because it can comprehensively consider the user's movement information over a period of time.
[0107] Stronger global search capabilities: In optimization and search problems, long-term memory can help the algorithm jump out of the local optimal solution and find a better global solution.
[0108] In order to solve the problem that the traditional firefly particle swarm algorithm used in inertial navigation has weak exploration ability and high requirements for the quality of the global optimal particles, the idea of fractional calculus is integrated into the firefly optimization algorithm. The long-term memory characteristics and globality of fractional calculus are used to record the individual optimal positions and group optimal positions of firefly particles, find a better inertial navigation position, balance the global search ability of the particle filter, and improve the convergence speed of the algorithm. It has better convergence, improves the premature problem and local optimal problem of the traditional firefly algorithm, and thus improves the positioning accuracy of the particle filter in the positioning algorithm.
[0109] In the embodiment of the present application, when a valid peak is detected, the position of the particles in the particle swarm is updated using a firefly algorithm based on a fractional order. The valid peak indicates that the target object has moved, and the fractional order indicates the historical position of the particles at different times. Then, the weights of the particles in the particle swarm after the updated position are determined, and the position of the target object is determined based on the weights of the particles in the particle swarm. Compared with the traditional particle filtering method, this embodiment introduces a fractional order in the firefly optimization algorithm. The fractional order enables the firefly algorithm to consider the historical position information of the particles, rather than just the data at the current moment, which can prevent the algorithm from falling into a local optimum, reduce positioning errors, and obtain a more accurate position estimate.
[0110] In one embodiment, the updating of the positions of particles in the particle swarm using a fractional-order firefly algorithm includes:
[0111] Based on the fractional order in the fractional-order-based firefly algorithm, the step factor, the spatial position of the firefly particle with the highest brightness, and the spatial position of each firefly particle at the previous moment, updating the positions of the particles in the particle group;
[0112] Wherein, the step size factor ∈[0, 1).
[0113] For example, the fractional-order firefly algorithm is:
[0114]
[0115] Wherein, v is the fractional order, which can be adjusted dynamically according to the environment, for example, the value v=0.5. i is the spatial position of firefly i, x best is the spatial position of the firefly particle with the highest brightness, α∈[0,1), α is the step factor; rand is a random number that obeys a uniform distribution on [0,1], and β is the attraction between firefly particle i and the firefly particle with the highest brightness.
[0116] When α is not equal to 1, the differential operator in the iterative equation of the firefly algorithm can be generalized from the first order to any order, thus giving the firefly algorithm the long-term memory of fractional-order differentials.
[0117] In one embodiment, the determining the weight of the particle in the particle swarm after the updated position includes:
[0118] The weights of the particles in the particle swarm are updated according to the PDR coordinates and the Bluetooth positioning coordinates of the target object.
[0119] For example, the particle weight is calculated according to the formula:
[0120]
[0121]
[0122] Among them, d t is the geometric distance between the PDR position and the Bluetooth fingerprint position, and the Bluetooth coordinate position at time k is (x kb ,y kb ), the PDR position is (x k ,y k ).
[0123] This embodiment also uses Bluetooth sensors and PDR to perform initial positioning, for example:
[0124] In an indoor scene, this embodiment combines a QR code containing location information, and uses a Bluetooth beacon and a static QR code to obtain the initial indoor positioning. The RSSI value of the Bluetooth beacon is obtained through the smart terminal, and matched with the Bluetooth fingerprint stored in the database to obtain the solved indoor position. When the user enters by scanning the QR code, correction is made according to the matched QR code location information. When the QR code is scanned but the Bluetooth beacon cannot be searched, it is identified as an invalid location scan and is not processed separately, avoiding the problem of obtaining a virtual location in an area that cannot be positioned.
[0125]
[0126] Among them, α and β are the weights of Bluetooth positioning and QR code information position respectively, for example, α = 0.6, β = 0.4. When the distance between the Bluetooth position and the QR code acquisition position is too large (such as d>10m), it is regarded as invalid code scanning, and the initial positioning is completely dependent on Bluetooth positioning, filtering out user remote code scanning and other situations.
[0127] The PDR positioning of the target object is performed by the magnetometer, accelerometer and gyroscope to obtain the PDR position of the target object. The PDR can predict the current position of the target object based on the previous position and motion information of the target object. now ,y now ) is the current position, (x last ,y last ) is the user's last location.
[0128]
[0129] Among them, l last and θ last are the step length and heading.
[0130] In one embodiment, the magnetometer used in the mobile smart device is easily affected by surrounding ferromagnetic objects, such as iron doors and electromagnetic waves generated by indoor equipment, and the magnetic field changes caused will seriously affect the accuracy of inertial navigation. This embodiment uses the maximum likelihood estimation method in probability distribution statistics to detect whether there is magnetic interference, and the measurement value of the magnetometer contains true value and noise.
[0131]
[0132] Among them, M xm is the actual measured value, M xr is the observed value, and nx is the noise. A reasonable threshold г is calculated for the fixed-length observation time series. If it is greater than г, there is electromagnetic interference, and the electromagnetic interference is suppressed when entering the heading estimation. If it is less than г, there is no electromagnetic interference.
[0133] In one embodiment, step count, step length, and heading estimation are performed:
[0134] Steps: The acceleration data is low-pass filtered, and then the smoothed data is peak detected to avoid the influence of pseudo peaks. By determining the peak value and trough value of the acceleration, two peaks appearing within a time period exceeding the threshold time can be identified as valid walking steps.
[0135] Dynamically adjust the step length: Adopt an adaptive step length algorithm based on the change of step frequency and acceleration, which can be expressed as:
[0136] l=a*f+b
[0137] Among them, f is the cadence, and a and b are fixed constants. When estimating the coefficients, a large amount of data is collected by the smartphone in the data preprocessing stage to analyze the relationship between cadence and step length, and the model coefficients a and b are calculated at the same time.
[0138] The server analyzes the relationship between pedestrian cadence and stride length based on sensor data obtained from the user's mobile phone, and uses an adaptive step length algorithm to dynamically adjust the step length during inertial navigation.
[0139] Heading estimation: You can first use Butterworth low-pass filtering to filter the angle to ensure the stability of the angle output. Then fuse the magnetometer and gyroscope data to estimate the heading, classify according to the above magnetic interference detection results, and use the following different formulas to calculate the heading angle according to the classification results:
[0140]
[0141] where θ last ,θ mag ,βθ gry are the angle at the previous moment, the heading angle of the electronic compass and the heading angle of the gyroscope, and α, β and γ are the weights of the above three components, for example, they can be set to a constant of 2:1:2.
[0142] In one embodiment, since the sampling value of the accelerometer of the smart terminal still has deviation when the accelerometer sensor is not moving, a zero-speed calibration can reduce the subsequent accumulated error, that is:
[0143] a=a sample -a zero
[0144] Through the acceleration sensor, you can obtain the linear acceleration a of the device on the x-axis, y-axis, and z-axis. x ,a y ,a z , calculate the total acceleration a:
[0145]
[0146] In one embodiment, the method for determining the weight of the particles in the particle swarm after the updated position further comprises:
[0147] According to the coordinates of the obstacle marked in advance in the indoor electronic map, determine whether there is an intersection between the particle after the position update and the obstacle;
[0148] If there is an intersection, the weight of the particle that intersects with the obstacle is set to 0.
[0149] For example, the obstacle can be a wall. A standard 2D electronic map is uploaded to the server in advance. The main structural elements in the electronic map are segmented and identified by the Line Segment Detector (LSD) algorithm, and the coordinates of all walls are obtained according to the scale. The corner coordinates of the map are marked separately and saved in the database as key point information. For each corner, the angle of the corner is marked in the electronic map.
[0150] According to the key data obtained from the indoor map, the regional legitimacy is checked to determine whether the particle has an intersection with the wall, to avoid the problem of pedestrians passing through the wall, and to filter out invalid particles. If the particle has an intersection with the wall, the particle weight is reset to 0.
[0151]
[0152] like Figure 2 As shown in the figure, particles that intersect with the wall are invalid particles, and particles on the traversable path are valid particles.
[0153] In one embodiment, the method further comprises:
[0154] When it is detected that the position of the target object is located at a corner mark point on the indoor electronic map, if the gyroscope detection value of the target object is greater than a first threshold, the movement direction of the target object is calibrated according to a preset angle of the corner mark point.
[0155] According to the signal changes obtained by the gyroscope, the user status is verified, mainly distinguishing the user's straight and turning movement states. A simple classifier is used to verify the user's movement mode (turning / straight), and when it is identified as a turn, the marked corner is combined to perform a secondary calibration of the movement direction.
[0156] When the user turns, the direction of movement changes. The gyroscope changes in the pattern of "walking → left / right turn → walking". The direction of movement can be identified based on the data changes of the gyroscope sensor. Set the measurement rules:
[0157] |μ t |>γ g
[0158] Among them, γ g is the threshold, μ t is the measurement value of the gyroscope. t |When it is greater than the threshold, it is determined to be a turn at an indoor corner.
[0159] This embodiment marks the corner coordinates and the angle of the corner on the electronic map in advance. For example, when the gyroscope of the target object near the corner (90 degrees) changes beyond the first threshold, it is determined that the target object has turned. At this time, calibration can be performed according to the preset angle of the corner mark point. If the angle obtained after the target object turns is less than the preset angle, it is very likely to pass through the wall if it moves a step at this angle. This embodiment is to avoid this situation as much as possible.
[0160] In one embodiment, the method further comprises:
[0161] If the time difference between two consecutive peaks detected is greater than the time threshold, and the peak values of the two consecutive peaks are both greater than the second threshold, it is determined that a valid peak is detected.
[0162] Since there are obvious peaks in spatial acceleration when people walk, the number of steps can be read through peak detection. The principle of peak detection is to detect the number of peaks in the acceleration cycle and record the number of peaks as the number of steps. However, since there are often false peaks (for example, users shake their phones quickly), which will affect the step counting results, it is necessary to detect effective peaks.
[0163] For example, when a peak is detected and the time difference between two peaks is greater than a certain time threshold, and the difference between the peak and the trough is greater than the dynamic threshold, the step number is +1, and it is confirmed as a valid peak.
[0164] Figure 3 : is a schematic diagram of a step counting process provided by an embodiment of the present invention, the process includes:
[0165] First, when a peak is detected through acceleration data, it is determined whether the peak value of the peak exceeds a threshold. If it exceeds the threshold, the peak is stored as a candidate peak.
[0166] Then, it is determined whether the time difference between the candidate peak and the last valid peak is greater than the time difference threshold. If so, the candidate peak is determined to be a valid peak, and then the step count is performed.
[0167] Figure 4This is a schematic diagram of a positioning system framework provided by an embodiment of the present invention. When a user moves indoors, the smartphone carried by the user reports data to the server in real time through a magnetometer, accelerometer and gyroscope, and the server performs PDR prediction of the position based on the data reported by the smartphone. The smartphone is used to obtain the RSSI value of the Bluetooth beacon, which is matched with the Bluetooth fingerprint stored in the server database, and the current position is obtained based on Bluetooth. When the user enters by scanning a QR code, the initial position is corrected according to the matched QR code position information.
[0168] Combined with the QR code containing location information, the Bluetooth beacon and the static QR code are fused to obtain the initial indoor positioning, and the indoor map is used to match the walls and doors as key information. The fractional order + firefly particle filter algorithm is combined to fuse and correct the Bluetooth positioning position and the PDR predicted position to accurately estimate the user's location. The navigation accuracy of inertial navigation is improved, the positioning accuracy is higher, and the performance is more stable.
[0169] Figure 5 : is a flow chart of a particle filter algorithm combining fractional order and firefly optimization provided by an embodiment of the present invention, the flow chart includes:
[0170] S51, initial sample particle.
[0171] Establish the initial sample particles, randomly generate N particles in the positioning area, and set the particle group It consists of N particles in the positioning area, the weight of each particle is 1 / N, and the state space of the particle is
[0172] S52, performing importance sampling on the particle swarm.
[0173] S53, calculating particle weights.
[0174] Calculate the weight of each particle, and use the weight of each particle as the brightness value of the individual firefly.
[0175] S54, particle position update.
[0176] The particle position is updated according to the position update formula that incorporates fractional orders.
[0177] S55, update particle weights.
[0178] S56, weight normalization.
[0179] S57, resampling.
[0180] S58, position output.
[0181] S59, whether there is a new observation value, if yes, return to execute S52.
[0182] If a new effective peak is observed, S52 is executed.
[0183] This embodiment is suitable for providing positioning services for smartphones in indoor environments. It organically integrates the two technologies of Bluetooth positioning and PDR positioning under the framework of particle filtering, solving the problem that the simple PDR technology cannot determine the initial position and the positioning error accumulates over time, and can provide stable and continuous positioning services in indoor environments.
[0184] The embodiment of the present invention incorporates the idea of fractional calculus into the firefly optimization algorithm, finds a better inertial navigation position based on more historical position information, and improves the premature and local optimal problems of the traditional firefly algorithm. Compared with the traditional fusion method, the introduction of fractional long-term memory avoids falling into the local optimal state, has higher filtering accuracy, and can obtain a more accurate position estimate.
[0185] The embodiment of the present invention combines the QR code containing the location information, uses the Bluetooth beacon and the static QR code to obtain the initial indoor positioning, and uses the indoor map to match the walls and doors as key information. In combination with the indoor map, the inertial navigation path is constrained, and when there is a large error, it can be constrained according to the real indoor scene.
[0186] The present invention introduces static QR codes, different QR codes save fixed initial positions, and combines with real indoor scenes, uses QR codes to match user initial positions, for example, shopping mall entrance venue codes, company front desk code scanning registration, etc., through user active code scanning, obtains user's accurate initial position information for auxiliary positioning, obtains accurate initial positioning, and reduces inertial navigation errors. QR codes are widely used in our daily lives, with small size, low cost, can store a lot of information and simple implementation.
[0187] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0188] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0189] It should be noted that the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.
[0190] In addition, in the embodiments of the present invention, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0191] refer to Figure 6 , Figure 6 is a schematic diagram of a positioning device provided by an embodiment of the present invention, such as Figure 6 As shown, the device includes: an updating module, a first determining module and a second determining module.
[0192] An updating module, used to update the position of particles in the particle swarm by using a firefly algorithm based on a fractional order when a valid wave peak is detected; the valid wave peak indicates that the target object has moved; the fractional order indicates the historical position of the particle at different times;
[0193] A first determination module, used to determine the weight of the particles in the particle swarm after the position is updated;
[0194] The second determination module is used to determine the position of the target object based on the weights of the particles in the particle swarm.
[0195] In one embodiment, the second determining module is specifically configured to:
[0196] Normalizing the weights of the particles in the particle swarm;
[0197] resampling the particle population;
[0198] Based on the resampled particle swarm, the position of the target object is determined.
[0199] In one embodiment, the update module is specifically used to:
[0200] Based on the fractional order in the fractional-order-based firefly algorithm, the step factor, the spatial position of the firefly particle with the highest brightness, and the spatial position of each firefly particle at the previous moment, updating the positions of the particles in the particle group;
[0201] Wherein, the step size factor ∈[0, 1).
[0202] In one embodiment, the first determining module is specifically configured to:
[0203] The weights of the particles in the particle swarm are updated according to the PDR coordinates and the Bluetooth positioning coordinates of the target object.
[0204] In one embodiment, the first determining module is specifically configured to:
[0205] According to the coordinates of the obstacle marked in advance in the indoor electronic map, determine whether there is an intersection between the particle after the position update and the obstacle;
[0206] If there is an intersection, the weight of the particle that intersects with the obstacle is set to 0.
[0207] In one embodiment, the device further comprises:
[0208] The calibration module is used to calibrate the movement direction of the target object according to a preset angle of the corner mark point when it is detected that the position of the target object is located at a corner mark point on the indoor electronic map and if the gyroscope detection value of the target object is greater than a first threshold.
[0209] In one embodiment, the device further comprises:
[0210] The detection module is used to determine that the effective peak is detected if the number of peaks with a peak value greater than a second threshold value detected within a preset time period is equal to 1.
[0211] In actual application, the update module, the first determination module and the second determination module can be implemented by a processor in an electronic device, such as a central processing unit (CPU), a digital signal processor (DSP), a microcontroller unit (MCU) or a programmable gate array (FPGA).
[0212] It should be noted that: when the positioning device provided in the above embodiment performs positioning, only the division of the above modules is used as an example. In actual applications, the above processing can be assigned to different modules as needed, that is, the internal structure of the device is divided into different modules to complete all or part of the processing described above. In addition, the positioning device provided in the above embodiment and the positioning method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0213] Based on the hardware implementation of the above program modules and in order to implement the method of the embodiment of the present application, the embodiment of the present application also provides an electronic device. Figure 7 Schematic diagram of the hardware structure of the electronic device of the present application embodiment. Figure 7 As shown, the electronic equipment includes:
[0214] Communication interface, which can exchange information with other devices such as network equipment;
[0215] The processor is connected to the communication interface to realize information exchange with other devices, and is used to execute the method provided by one or more technical solutions of the electronic device side when running the computer program. The computer program is stored in the memory.
[0216] Of course, in actual applications, the various components in the electronic device are coupled together through the bus system. It is understandable that the bus system is used to achieve connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 In the specification, various buses are labeled as bus systems.
[0217] The memory in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.
[0218] It can be understood that the memory can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM). The memory described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memory.
[0219] The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the program in the memory and completes the steps of the above method in combination with its hardware.
[0220] Optionally, when the processor executes the program, the corresponding processes implemented by the electronic device in each method of the embodiments of the present application are implemented, which will not be described in detail here for the sake of brevity.
[0221] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a first memory storing a computer program, and the computer program can be executed by a processor of an electronic device to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0222] In the several embodiments provided in the present application, it should be understood that the disclosed devices, electronic devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0223] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0224] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0225] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.
[0226] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0227] It should be noted that the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0228] In addition, in the examples of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0229] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A positioning method, characterized in that: The method comprises: When a valid wave peak is detected, the position of the particles in the particle swarm is updated using a firefly algorithm based on a fractional order; the valid wave peak indicates that the target object has moved; the fractional order indicates the historical position of the particles at different times; Determining the weights of particles in the particle swarm after the positions are updated; The position of the target object is determined based on the weights of the particles in the particle swarm.
2. The method according to claim 1, characterized in that The step of determining the position of the target object based on the weights of the particles in the particle swarm comprises: Normalizing the weights of the particles in the particle swarm; resampling the particle population; Based on the resampled particle swarm, the position of the target object is determined.
3. The method according to claim 1, characterized in that: The method of updating the positions of particles in a particle swarm by using a fractional-order firefly algorithm comprises: Based on the fractional order in the fractional-order-based firefly algorithm, the step factor, the spatial position of the firefly particle with the highest brightness, and the spatial position of each firefly particle at the previous moment, updating the positions of the particles in the particle group; Wherein, the step size factor ∈[0, 1).
4. The method according to claim 1, characterized in that The determining of the weight of the particles in the particle swarm after the updated position comprises: The weights of the particles in the particle swarm are updated according to the PDR coordinates and the Bluetooth positioning coordinates of the target object.
5. The method according to claim 1, characterized in that The method further comprises: determining the weight of the particles in the particle swarm after the updated position is updated. According to the coordinates of the obstacle marked in advance in the indoor electronic map, determine whether there is an intersection between the particle after the position update and the obstacle; If there is an intersection, the weight of the particle that intersects with the obstacle is set to 0.
6. The method according to claim 1, characterized in that The method further comprises: When it is detected that the position of the target object is located at a corner mark point on the indoor electronic map, if the gyroscope detection value of the target object is greater than a first threshold, the movement direction of the target object is calibrated according to a preset angle of the corner mark point.
7. The method according to claim 1, characterized in that The method further comprises: If the number of peaks with a peak value greater than the second threshold detected within the preset time period is equal to 1, it is determined that the generation of the valid peak is detected.
8. A positioning device, characterized in that: include: An updating module is used to update the positions of particles in the particle swarm by using a fractional-order firefly algorithm when a valid wave peak is detected; The effective wave peak represents that the target object has moved; the fractional order represents the historical position of the particle at different times; A first determination module, used to determine the weight of the particles in the particle swarm after the position is updated; The second determination module is used to determine the position of the target object based on the weights of the particles in the particle swarm.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the positioning method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the positioning method according to any one of claims 1 to 7.