A switching method for seamless indoor and outdoor positioning based on HMM
Through the HMM-based seamless positioning switching method, combined with Beidou and Bluetooth positioning technology, the scene state is identified and network switching is performed, the challenge of seamless positioning in the indoor and outdoor is solved, and high-precision and real-time navigation and positioning are achieved.
Patent Information
- Application Number
- CN202510045659.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2024-01-18
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-13
AI Technical Summary
The prior art is difficult to achieve seamless indoor and outdoor positioning, especially when switching heterogeneous networks, resulting in discontinuity and reduced accuracy of positioning.
Using the HMM-based seamless positioning switching method, the outdoor Beidou positioning system and the indoor Bluetooth positioning system are deployed, combined with the HMM model and Bayesian inference, the scene state is identified and network switching is performed, and a state holding mechanism and unidirectional constraints of motion trajectory are introduced to reduce the ping-pong effect of heterogeneous network switching.
It realizes smooth switching and continuous positioning of seamless indoor and outdoor positioning, improves the real-time and high-precision of navigation positioning, and solves the problem of heterogeneous network switching.
Smart Images

Figure CN119439045B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of navigation and positioning, and in particular to a switching method for seamless indoor and outdoor positioning based on HMM. Background Art
[0002] At present, outdoor positioning technology is mature, especially satellite navigation systems (such as the US GPS, China's Beidou, Europe's Galileo, etc.) have been widely used around the world and have achieved success in many application fields. However, outdoor positioning technology still has shortcomings such as multipath effect and shielding effect. The former is that the signal reaches the receiver through multiple paths during the propagation process, resulting in reflection or refraction of the signal during the propagation process, and the latter refers to the signal being blocked by buildings, trees, mountains and other objects during the propagation process, resulting in signal weakening or complete shielding. Both will affect the reliability and accuracy of positioning.
[0003] With the continuous development of wireless communication and sensor technology, indoor positioning technology has gradually matured and is widely used in various scenarios. Indoor positioning technology mainly includes positioning methods based on Wi-Fi, Bluetooth, RFID, infrared, ultrasonic and other technologies. These technologies can accurately measure and calculate indoor position and posture by deploying wireless sensor nodes, base stations or tags in indoor environments. Compared with outdoor positioning technology, indoor positioning technology can provide higher positioning accuracy in indoor environments and can be applied to closed spaces where satellite navigation systems cannot be used, such as indoor shopping malls, office buildings, airports, hospitals, etc.
[0004] Although outdoor positioning technology and indoor positioning technology have achieved great development and application in their respective fields, there are still certain challenges and needs for seamless connection of indoor and outdoor positioning in the process of moving from outdoor to indoor or from indoor to outdoor. The future network will be highly heterogeneous. Indoor and outdoor seamless positioning technology can solve the problem of heterogeneous networks, fill the gap between indoor and outdoor positioning, and achieve smooth switching and continuous positioning in different environments. At present, indoor and outdoor seamless positioning technology mainly adopts the method of combining different indoor and outdoor positioning technologies to achieve seamless indoor and outdoor navigation and positioning. The indoor and outdoor seamless positioning system involves multiple network systems, belongs to the field of heterogeneous network problems, and has the key problem of heterogeneous network switching. The traditional method is to collect various sensor data in different environments and distinguish the environments by setting thresholds. The switching method is simple and the accuracy is low. Summary of the invention
[0005] In view of the above technical problems to be solved, the present invention provides a switching method for seamless indoor and outdoor positioning based on HMM, which solves the problem of heterogeneous network switching and realizes smooth switching and continuous positioning in different environments.
[0006] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0007] A switching method for seamless indoor and outdoor positioning based on HMM, comprising the following steps:
[0008] Step S1, deploying an outdoor positioning system and an indoor positioning system;
[0009] Step S2, dividing the daily activity scenes into three scenes: indoor, indoor and outdoor mixed area, and outdoor, which is the optimal hidden state required by HMM;
[0010] Step S3, establish HMM model, model Represented by a triple: ,in Initial state distribution, A is the state transition probability matrix, B is the observed state probability matrix;
[0011] Step S4, using Bayesian reasoning in combination with the HMM model to calculate the posterior probability distribution of each hidden state at each time step, the hidden state with the maximum probability is the best, that is, scene state recognition;
[0012] Step S5, when a scene switch is detected, a state holding mechanism and a method of unidirectional motion trajectory constraint are used to perform auxiliary constraint through angular velocity data provided by a gyroscope sensor;
[0013] Step S6, determining whether to trigger network switching.
[0014] As a further improvement of the above technical solution:
[0015] Preferably, in step S3, the HMM model is established, specifically:
[0016] S3-1, the state transition probability matrix is obtained from prior knowledge ; Use the mixed Gaussian model to describe the probability density distribution of the observed variables in each scenario, use the EM algorithm to estimate the parameters of the mixed Gaussian model in each scenario, and obtain the observed state probability matrix B; set the initial state distribution based on prior knowledge , where T is the length of the observation sequence;
[0017] S3-2, build HMM, model Represented by a triple: .
[0018] Preferably, in step S4, specifically:
[0019] S4-1, the forward algorithm calculates the probability of the observation sequence:
[0020] The forward probability at initialization time t=1 is:
[0021]
[0022] in, For the status The probability of observing Indicates that the system is in state at the initial moment i The probability of Status i The initial probability of
[0023] Recursively calculate the forward probability, for the moment t =2 to each moment from T, the forward probability is calculated using the state transition probability and the observed state probability:
[0024] ;
[0025] in, is the probability that the system is in state j at time t; is the probability of being in state i at time t-1 and observing a partial sequence; is the probability of transitioning from state i to state j, To observe the state in state j The probability of
[0026] S4-2, then calculate the backward probability:
[0027] According to the state transition probability and the observed state probability, the backward probability of the previous moment is calculated. t =T-1,T-2,…,1, each state i =1,2,3:
[0028] ;
[0029] in, is the probability of the observation sequence occurring at time t in state i and from time t+1 to time T; is observed in state j The probability of is the probability of transitioning from state i to state j, is the backward probability of being in state j at time t+1 and observing a partial sequence;
[0030] S4-3, create a list path to store the hidden state sequence:
[0031] from t =T starts moving forward:
[0032] ;
[0033] in, is the forward probability; is the backward probability, indicating the time The probability of the next state i; is the most likely hidden state;
[0034] For every moment t =T-1,T-2,…,1, select the state with the largest product as the hidden state at the current moment, and record it. The best hidden state at each moment is the scene type;
[0035] ;
[0036] in, is the best hidden state at time t, From state i to The transition probability, is observed in state i The observation probability of is the forward probability of being in state i at the moment, is the backward probability of being in state i at time t;
[0037] Select the state with the largest product As the optimal state at the current time t, it is recorded in the path list path.
[0038] Preferably, in step S5, the state maintaining mechanism is: when a scene switch is detected, the current navigation mode is used for t time, where t represents the state maintaining time. v is the current user's speed; t and v The relational expression is:
[0039] ;
[0040] Preferably, in step S5, the unidirectional constraint of the motion trajectory is: the motion process of the user from indoors to outdoors or from outdoors to indoors has continuity and unidirectionality, and there is a motion state of sudden return; the method of unidirectional constraint of the motion trajectory is used, and a gyroscope sensor is used for auxiliary constraint; the data provided by the gyroscope sensor is angular velocity ω, and the angle change is obtained by integrating the angular velocity data:
[0041] ;
[0042] in, is the angle, For the angular velocity data for each time interval, is the time interval between adjacent data samples; when the angle If the change is greater than the threshold x, it is determined that the user has made a turnaround and a network switch is performed; otherwise, no network switch is performed.
[0043] Compared with the prior art, the HMM-based indoor and outdoor seamless positioning switching method provided by the present invention has the following advantages:
[0044] (1) The HMM-based indoor and outdoor seamless positioning switching method of the present invention adopts a probabilistic statistical method based on HMM / Bayesian Inference, combined with Bluetooth and Beidou positioning technology, to achieve indoor and outdoor scene switching; introduces a state retention mechanism and a unidirectional constraint on the motion trajectory to reduce the ping-pong effect of heterogeneous network switching; uses a mixed Gaussian model to describe the probability density distribution of observed data, and estimates parameters through Bayesian Inference and EM algorithm.
[0045] (2) The HMM-based indoor and outdoor seamless positioning switching method of the present invention is used in the field of indoor and outdoor seamless navigation and positioning, solves the problem of heterogeneous network switching, realizes smooth switching and continuous positioning in different environments, and provides a real-time, high-precision solution for navigation and positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a flow chart of the indoor and outdoor switching algorithm based on HMM inference of the present invention. DETAILED DESCRIPTION
[0047] The specific embodiments of the present invention are described in detail below. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0048] The HMM-based indoor and outdoor seamless positioning switching method of the present invention, in application, divides daily activity scenes into three scenes: outdoor, indoor-outdoor-indoor transition, and indoor. The indoor area refers to the space inside the building, which is usually separated from the external space by walls, roofs or other structures. This includes any room, corridor, hall, etc. inside the house. The outdoor area refers to the space outside the building, which is not restricted by walls or roofs. This includes outdoor streets, gardens, parks and any place not covered by building structures. Indoor-outdoor transition refers to the area between indoors and outdoors, such as porches, doorways, stairways and other places. These places have some indoor features and are connected to the outdoors. Usually in these places, indoor and outdoor environmental features will exist at the same time, and there may be some indoor features (such as lighting in the room) and some outdoor features (such as sunlight). Use , , They represent three scenarios: indoor area, indoor and outdoor mixed area, and outdoor area.
[0049] HMM is a probabilistic model used to model time series data. It describes a dynamic system with a hidden state sequence and an observable state sequence. The hidden state sequence cannot be observed directly, but can be indirectly inferred from the observable state sequence. , state transition probability matrix A and observation state probability matrix B. Bayesian Inference is a statistical method used to estimate the probability distribution of unknown parameters based on observed data and prior knowledge.
[0050] The switching method for seamless indoor and outdoor positioning based on HMM of the present invention,
[0051] like Figure 1 As shown, an implementation of the switching method for seamless indoor and outdoor positioning based on HMM of the present invention specifically includes the following steps:
[0052] Step S1, deploying an outdoor Beidou positioning system and an indoor Bluetooth positioning system to ensure that the system can collect Beidou positioning data and Bluetooth positioning data in real time.
[0053] Bluetooth positioning collects Bluetooth AOA data, which includes pitch angle and azimuth angle. The two-dimensional coordinates are calculated as the output data of the Bluetooth positioning system. , combined with Beidou positioning data , get the observation set of HMM .
[0054] Step S2: divide the daily activity scenes into three types: indoor, indoor and outdoor mixed area, and outdoor. , , It represents the best hidden state required by HMM, and the scene state set is:
[0055] .
[0056] Step S3, establishing an HMM model.
[0057] The HMM model uses two features:
[0058] (1) The problem is sequence-based, such as time series or state series;
[0059] (2) There are two types of data in the problem. One type of sequence data is observable, namely the observation sequence, and the other type of data is unobservable, namely the hidden state sequence, referred to as the state sequence;
[0060] HMM is a mathematical model based on probability statistics, which can well describe the characteristics of the situation determined by the characteristics of human activities. The characteristics of the situation can be transformed into a continuous time series, and the continuous time series conforms to the time series characteristics of HMM.
[0061] The observable data is the data collected by the sensor, and the data that cannot be directly observed is the scene status, which conforms to the data characteristics of HMM.
[0062] S3-1, according to prior knowledge, the scene state transition probability distribution is shown in Table 1. Since the user movement process is a continuous state, the three scenes of indoor, indoor and outdoor mixed area and outdoor can only be switched in pairs, and there is no situation of going directly from indoor to outdoor or from outdoor to indoor. Therefore, the indoor and outdoor transition probability is 0.
[0063] Table 1 Transition probability between scenes:
[0064]
[0065] The state transition probability matrix is obtained from prior knowledge .
[0066] The observation set is a data set with multiple different features. The Gaussian mixture model is used to describe the probability density distribution of the observed variables in each scenario:
[0067] (1)
[0068] in, For the scene Next, the observed variables The joint probability density of It's a scene The number of Gaussian distributions under It's a scene The weight of the next j-th Gaussian distribution, It's a scene The multivariate Gaussian probability density function of the jth Gaussian distribution under has a mean vector and the covariance matrix This probability density distribution represents the The complex probability distribution of the observed data.
[0069] Use the EM (Expectation-Maximum) algorithm to estimate the parameters of the mixed Gaussian model for each scenario, including the mean vector , covariance matrix And weight , and obtain a 2×3 observation state probability matrix B. The initial state distribution is set by prior knowledge , T is the length of the observation sequence.
[0070] S3-2, build HMM, model It can be represented by a triple: , where A is the state transition probability matrix and B is the observed state probability matrix. Q is the set of all hidden states and V is the set of all observed states, which is:
[0071] ;
[0072] Wherein, n is the number of hidden states, m is the number of observed states, and in this embodiment, n=3, m=2.
[0073] In step S4, Bayesian inference is used to calculate the posterior probability distribution of each hidden state at each time step. The state with the highest probability is the best hidden state, i.e., scene state recognition.
[0074] Specifically:
[0075] S4-1, the forward algorithm calculates the probability of the observation sequence.
[0076] The forward algorithm includes initializing the forward probability and recursively calculating the forward probability. T is the length of the observation sequence. is the forward probability matrix, used to store each moment t The forward probability value of . Select the hidden state with the largest posterior probability, which is the current scene state, to form the scene state sequence S. The forward probability at the initialization time t=1 is:
[0077] (2)
[0078] in, For the status The probability of observing To indicate that the system is in the state at the initial moment i The probability of Status i The initial probability of .
[0079] Recursively calculate the forward probability. For each moment from t=2 to T, use the state transition probability and the observed state probability to calculate the forward probability:
[0080] (3)
[0081] in, is the probability that the system is in state j at time t; is the probability of being in state i at time t-1 and observing a partial sequence; is the probability of transitioning from state i to state j, is the state observed in state j probability.
[0082] S4-2, then calculate the backward probability.
[0083] The calculation of backward probability includes two parts: initialization and recursion. For the last moment, the backward probability is 1, that is, ,in i =1,2,3. Calculate the backward probability of the previous moment based on the state transition probability and the observed state probability. t =T-1,T-2,…,1, each state i =1,2,3:
[0084] (4)
[0085] in, For the moment t In state i And the probability of the observation sequence from time t+1 to time T occurring; is observed in state j probability; is the probability of transitioning from state i to state j, is the backward probability of being in state j at time t+1 and observing a partial sequence.
[0086] S4-3, create a list path to store the most likely hidden state sequence.
[0087] Starting from t=T and moving forward:
[0088] ;
[0089] in, is the forward probability; is the backward probability, which indicates the probability of state i at time T, is the most likely hidden state.
[0090] For every moment t =T-1,T-2,…,1, select the state with the largest product as the hidden state at the current moment and record it. The best hidden state at each moment is the scene type.
[0091] ;
[0092] in, is the best hidden state at time t, From state i to The transition probability, is observed in state i The observation probability of is the forward probability of being in state i at the moment, is in the state at time t i The backward probability of .
[0093] Select the state with the largest product As the best hidden state at the current time t, this best hidden state is then recorded in the path list path, and the best hidden state at each moment is recorded to finally form a hidden state sequence, reflecting the optimal evolution process of the system state.
[0094] Step S5, based on the optimal hidden state result of step S4, when the scene switch is detected, the state retention mechanism and the unidirectional constraint method of the motion trajectory are adopted, and the angular velocity data provided by the gyroscope sensor are used for auxiliary constraints to reduce the ping-pong effect caused by heterogeneous network switching, and finally achieve real-time and high-precision seamless positioning indoors and outdoors.
[0095] All scene states are stored in a sequence. When the recognized scene state changes, the navigation mode needs to be switched, that is, network switching occurs. After switching, when the navigation terminal uses the Bluetooth positioning system to complete positioning in indoor positioning scenarios, the Beidou positioning system is used to complete positioning in outdoor scenarios, and the two networks are used for fusion positioning in indoor and outdoor mixed scenarios.
[0096] In the process of network switching, this embodiment adopts a state retention mechanism and a method of unidirectional constraint of motion trajectory to reduce the ping-pong effect caused by heterogeneous network switching.
[0097] Furthermore, the state retention mechanism is: when a scene switch is detected, the navigation mode is not switched immediately, but the current navigation mode is continued for a period of time until the stability of the switch is confirmed. t Indicates the time the state is maintained. v is the current user's speed. If the speed v The smaller it is, the larger t is, and the current positioning system remains unchanged without switching. v The larger the value, the smaller t is and the faster the switching response is. The minimum value of t is 0. Define t and v The relational expression is:
[0098] ;
[0099] Furthermore, the unidirectional constraint of the motion trajectory is: when the user moves from indoors to outdoors or from outdoors to indoors, the motion has the characteristics of continuity and unidirectionality, and the existence of a sudden return motion state will greatly produce a ping-pong effect. The present invention proposes a method of using the unidirectional constraint of the motion trajectory, and uses a gyroscope sensor for auxiliary constraint. The data provided by the gyroscope sensor is the angular velocity ω, and the angle change is obtained by integrating the angular velocity data.
[0100] ;
[0101] in, is the angle, For the angular velocity data for each time interval, is the time interval between adjacent data samples. If the change is greater than the threshold x, it is determined that the user has turned back and a network switch is performed, otherwise no network switch is performed. Adjust the threshold x according to the actual scenario to ensure the accuracy of the constraint, preferably set to 180. At the same time, start the state retention mechanism, delay a period of time t before switching the network, and keep the current positioning system unchanged within t time.
[0102] Step S6, after step S5, determine whether to trigger network switching.
[0103] If you decide to switch, select the corresponding navigation method. In indoor positioning scenarios, use the Bluetooth positioning system, in outdoor scenarios, use the Beidou positioning system, and in indoor and outdoor mixed scenarios, use the fusion positioning of the two.
[0104] The above implementation cases are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Although the present invention has been disclosed as above with preferred embodiments, they are not intended to limit the present invention. Therefore, any simple modification, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A switching method for seamless indoor and outdoor positioning based on HMM, characterized in that: The following steps are involved: Step S1, deploying an outdoor positioning system and an indoor positioning system; Step S2, dividing the daily activity scenes into three scenes: indoor, indoor and outdoor mixed area, and outdoor, which is the optimal hidden state required by HMM; Step S3, establish HMM model, model Represented by a triple: , where π is the initial state distribution, A is the state transition probability matrix, and B is the observed state probability matrix; Step S4, using Bayesian reasoning in combination with the HMM model to calculate the posterior probability distribution of each hidden state at each time step, the hidden state with the maximum probability is the best, that is, scene state recognition; Step S5, when a scene switch is detected, a state holding mechanism and a method of unidirectional motion trajectory constraint are used to perform auxiliary constraint through angular velocity data provided by a gyroscope sensor; Step S6, determining whether to trigger network switching; In the step S4, specifically: S4-1, the forward algorithm calculates the probability of the observation sequence: The forward probability at initialization time t=1 is: ; in, For the status The probability of observing To indicate that the system is in the state at the initial moment i The probability of Status The initial probability of Recursively calculate the forward probability, for the moment t =2 to each moment from T, the forward probability is calculated using the state transition probability and the observed state probability: ; in, For the moment t The system is in state j probability; is the probability of being in state i at time t-1 and observing a partial sequence; From the state i Transfer to state j The probability of For the status j The observed state probability; S4-2, then calculate the backward probability: According to the state transition probability and the observed state probability, the backward probability of the previous moment is calculated. t =T-1,T-2,…,1, each state i =1,2,3: ; in, For the moment t In state i And the probability of the observation sequence from time t+1 to time T occurring; For the status j Observed below probability; is the probability of transitioning from state i to state j, For at the moment t +1 in status j And observe the backward probability of some sequences; S4-3, create a list path to store the hidden state sequence: from t =T starts moving forward: ; in, is the forward probability; is the backward probability, indicating the moment Down state i probability; is the most likely hidden state; For every moment t =T-1,T-2,…,1, select the state with the largest product as the hidden state at the current moment, and record it. The best hidden state at each moment is the scene type; ; in, is the best hidden state at time t, From the state i arrive The transition probability, Yes Status i Observed below The observation probability of Is always in a state i The forward probability of It's time t In state i The backward probability of Select the state with the largest product As the current moment t The optimal state is recorded in the path list path.
2. The switching method for seamless indoor and outdoor positioning based on HMM according to claim 1, characterized in that: In step S3, an HMM model is established, specifically: S3-1, obtain the state transition probability matrix A from prior knowledge; use the mixed Gaussian model to describe the probability density distribution of the observed variables in each scenario, use the EM algorithm to estimate the parameters of the mixed Gaussian model in each scenario, and obtain the observed state probability matrix B; set the initial state distribution based on prior knowledge , where T is the length of the observation sequence; S3-2, build HMM, model Represented by a triple: .
3. The switching method for seamless indoor and outdoor positioning based on HMM according to claim 1, characterized in that: In step S5, the state maintenance mechanism is: when the scene switching is detected, the current navigation mode is used t Time, use t Indicates the time the state is maintained. v is the speed of the current user; t and v The relational expression is: .
4. The switching method for seamless indoor and outdoor positioning based on HMM according to claim 1, characterized in that: In step S5, the unidirectional constraint of the motion trajectory is: the motion process of the user from indoors to outdoors or from outdoors to indoors is continuous and unidirectional, and there is a sudden return motion state; the method of unidirectional constraint of the motion trajectory is used, and the gyroscope sensor is used for auxiliary constraint; the data provided by the gyroscope sensor is the angular velocity , the angle change is obtained by integrating the angular velocity data: ; where a is the angle, For the angular velocity data for each time interval, is the time interval between adjacent data samples; when the angle If the change is greater than the threshold x, it is determined that the user has made a turnaround and a network switch is performed; otherwise, no network switch is performed.
Citation Information
Patent Citations
Indoor and outdoor seamless positioning algorithm based on smart phone scene recognition
CN113534226A
Indoor and outdoor seamless positioning method based on multi-source sensing fusion
CN117367418A