Positioning method, device, equipment, medium and product
By combining gyroscope, acceleration, gravity and magnetometer data, and using gradient descent and Kalman filtering algorithms for processing, the target equipment is accurately positioned, solving the problem of insufficient stability and accuracy of indoor positioning, and improving the user experience.
Patent Information
- Application Number
- CN202210667112.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-06-13
AI Technical Summary
Indoor positioning is difficult to achieve accurate positioning when blocked by buildings. WiFi-based positioning technology is greatly affected by the environment, and the accuracy of sensor data fusion is also poor, resulting in insufficient stability and accuracy of position estimation, affecting user experience.
By obtaining the gyroscope data, linear acceleration data, gravimeter data and magnetometer data of the target device, the data processing is performed using the gradient descent algorithm and the Kalman filtering algorithm, the pace detection results and step length estimation results are obtained, the conversion matrix and heading angle are calculated, and the position estimation of the target device is realized.
Improves the accuracy and stability of positioning, reduces the error in position estimation, and improves the user experience.
Smart Images

Figure CN115096310B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of positioning technology, and in particular to a positioning method, device, equipment, medium and product. Background Art
[0002] In recent years, in indoor environments, due to the obstruction of buildings, the positioning function based on the Global Positioning System (GPS) often cannot achieve accurate positioning. In order to improve the accuracy of indoor positioning, a WiFi-based positioning technology can be used to construct a fingerprint map using the signal strength of multiple WiFi access points in the indoor environment to estimate the position. However, considering that the signal strength of WiFi access points is easily affected by the environment, the stability of the position estimation in the above scheme is poor.
[0003] In recent years, with the popularization of smart mobile terminals, there are more and more types of embedded sensors in mobile terminals. In order to solve the above problems, in the related technology, data fusion can be performed on the sensor data of the mobile terminal, and the user's walking action and walking direction can be detected according to the data fusion results, and the user's position can be estimated based on the above detection results. However, in the above scheme, considering the poor accuracy of data fusion of the sensor data of the mobile terminal, it is easy to make the error of position estimation larger, which damages the user experience. Summary of the invention
[0004] In order to solve the problems in the related art, the embodiments of the present disclosure provide a positioning method, device, equipment, medium and product.
[0005] In a first aspect, an embodiment of the present disclosure provides a model training method, the method comprising:
[0006] Acquire gyroscope data and linear acceleration data of the target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, the first moment being earlier than the second moment;
[0007] Obtaining step detection results and step length estimation results based on linear acceleration data;
[0008] According to the gravimeter data and the magnetometer data, a calculation is performed based on a gradient descent algorithm to obtain a first quaternion at the second moment;
[0009] The gyroscope data is used as the input of the Kalman filter algorithm, and the first quaternion is used as the observation value of the Kalman filter algorithm for calculation to obtain the second quaternion at the second moment;
[0010] Obtaining a conversion matrix and a first heading angle of the target device at a second moment according to the second quaternion, and obtaining a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the conversion matrix, the first time period being after the second moment;
[0011] In response to the step detection result satisfying the step condition, the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
[0012] In one implementation of the present disclosure, obtaining a step detection result according to linear acceleration data includes:
[0013] Obtaining the vector sum of acceleration vectors of the target device in multiple directions at different times according to the linear acceleration data;
[0014] In response to the maximum value of the vector sum within the target time range being greater than or equal to the first vector sum threshold, and the minimum value of the vector sum within the target time range being less than or equal to the second vector sum threshold, a step detection result is generated to indicate that the user of the target device has taken a step, and the time length of the target time range is less than or equal to the target time length threshold.
[0015] In one implementation of the present disclosure, obtaining a step length estimation result according to linear acceleration data includes:
[0016] pass Get the step length l of the i-th step i , and according to l i To obtain the step size estimation result, is the maximum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, is the minimum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, and k is a constant.
[0017] In one implementation of the present disclosure, in response to the step detection result satisfying the step condition, before acquiring the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, the method further includes:
[0018] according to Get the mean of the three-axis angular velocity vector in the gyroscope data within the time range corresponding to the i-th step where w x,i is the angular velocity vector in the x-axis direction, w y,i is the angular velocity vector in the y-axis direction, w z,i is the angular velocity vector in the z-axis direction;
[0019] In response to the step detection result satisfying the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, including:
[0020] In response to is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0021] In one implementation of the present disclosure, in response to is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including
[0022] In response to the position of the target device in the first period matching the steering position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0023] In one implementation of the present disclosure, in response to the position of the target device in the first period matching the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including:
[0024] In response to the second heading angle being greater than or equal to the turning heading angle threshold, the position of the target device in the first time period matches the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0025] In a second aspect, an embodiment of the present disclosure provides a positioning device, the device comprising:
[0026] a data acquisition module configured to acquire gyroscope data and linear acceleration data of a target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, the first moment being earlier than the second moment;
[0027] A step detection module is configured to obtain a step detection result and a step length estimation result according to the linear acceleration data;
[0028] A first quaternion calculation module is configured to perform calculation based on the gravimeter data and the magnetometer data based on a gradient descent algorithm to obtain a first quaternion at a second moment;
[0029] A second quaternion calculation module is configured to use the gyroscope data as an input of the Kalman filter algorithm and to calculate the first quaternion as an observation value of the Kalman filter algorithm to obtain a second quaternion at a second moment;
[0030] a heading angle calculation module, configured to obtain a conversion matrix and a first heading angle of the target device at a first moment according to the second quaternion, and obtain a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the conversion matrix, the first time period being after the second moment;
[0031] The position estimation module is configured to obtain the position of the target device in the second time period in response to the step detection result satisfying the step condition according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
[0032] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps as described in any one of the first aspect and any one of the implementation methods of the first aspect.
[0033] In a fourth aspect, an embodiment of the present disclosure provides a readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the method steps as described in any one of the first aspect and any one of the implementation methods of the first aspect are implemented.
[0034] In a fifth aspect, a computer program product is provided in an embodiment of the present disclosure, comprising computer instructions, which, when executed by a processor, implement the method steps as described in any one of the first aspect and any one of the implementations of the first aspect.
[0035] The scheme of the embodiment of the present disclosure is as follows: by acquiring gyroscope data and linear acceleration data of the target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment; acquiring a step detection result and a step length estimation result according to the linear acceleration data; calculating based on the gravimeter data and the magnetometer data based on a gradient descent algorithm to obtain a first quaternion at the second moment; using the gyroscope data as an input of a Kalman filter algorithm, and calculating the first quaternion as an observation value of the Kalman filter algorithm to obtain a second quaternion at the second moment; acquiring a transformation matrix and a first heading angle of the target device at the second moment according to the second quaternion, and acquiring a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the transformation matrix, the first time period being after the second moment; in response to the step detection result satisfying a stepping condition, acquiring a position of the target device in a second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, the second time period being after the first time period. Among them, considering that the second quaternion calculated by taking the gyroscope data as the input of the Kalman filter algorithm and the first quaternion as the observation value of the Kalman filter algorithm has a higher accuracy, the accuracy of the second heading angle obtained based on the second quaternion is also higher, so that the accuracy of the position of the second time period obtained based on the second heading angle is higher, thereby improving the user experience
[0036] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0038] Figure 1 A flowchart of a positioning method according to an embodiment of the present disclosure is shown.
[0039] Figure 2 A structural block diagram of a positioning device according to an embodiment of the present disclosure is shown.
[0040] Figure 3 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0041] Figure 4 A schematic diagram showing the structure of a computer system suitable for implementing the method according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0042] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0043] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0044] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0045] In related technologies, in order to improve the accuracy of indoor positioning, a WiFi-based positioning technology can be used to construct a fingerprint map using the signal strength of multiple WiFi access points in the indoor environment to estimate the position. Alternatively, the sensor data of the mobile terminal can be fused, and the user's walking action and walking direction can be detected based on the data fusion results, and the user's position can be estimated based on the above detection results.
[0046] However, in the above scheme, considering that the signal strength of the WiFi access point is easily affected by the environment, the stability of the position estimation in the above scheme is poor. At the same time, considering that the accuracy of data fusion of the mobile terminal sensor data is poor, it is easy to make the position estimation error large, thereby damaging the user experience.
[0047] In order to solve the above problems, the present disclosure provides a positioning device, an apparatus, a medium and a product.
[0048] Figure 1 A flowchart of a positioning method according to an embodiment of the present disclosure is shown. Figure 1 As shown, the method includes steps S101 to S106.
[0049] In step S101 , gyroscope data and linear acceleration data of a target device at a first moment, and gravimeter data and magnetometer data of a target device at a second moment are acquired.
[0050] Among them, the first moment is earlier than the second moment.
[0051] In one embodiment of the present disclosure, the gravimeter data can be understood as indicating the magnitude and direction of the gravity field in the target device coordinate system with the target device as the origin, and the magnetometer data can be understood as indicating the magnitude and direction of the magnetic field in the target device coordinate system. Considering that the actually measured gravimeter data and magnetometer data will be affected by inevitable noise, errors will be introduced if they are directly used as observation values of the Kalman filter. In order to improve the accuracy of attitude estimation, the gradient descent algorithm can be used to fuse the magnetometer data and the gravimeter data to obtain an instantaneous attitude estimate to correct the attitude error output by the gyroscope.
[0052] In step S102, a step detection result and a step length estimation result are obtained according to the linear acceleration data.
[0053] In step S103, a calculation is performed based on the gravimeter data and the magnetometer data based on a gradient descent algorithm to obtain a first quaternion at the second moment.
[0054] In one embodiment of the present disclosure, illustratively, the process of obtaining the first quaternion at the second moment by calculating based on the gravimeter data and the magnetometer data based on the gradient descent algorithm can be as follows:
[0055] Take the second time as time k+1 as an example, where the gravimeter data at time k+1 is g k+1 =[0,g x,k+1 ,g y,k+1 ,g z,k+1 ] T , magnetometer data is m k+1 =[0,m x,k+1 ,m y,k+1 ,m z,k+1 ] T , the quaternion at time k is Z k =[q z0,k ,q z1,k ,q z2,k ,q z3,k ] T , we can construct the objective function:
[0056]
[0057] Among them, f g (Z k ,g k+1 ) and f d (Z k ,d k+1 ,m k+1 ) represent the objective functions calculated by gravimeter data and magnetometer data, respectively.
[0058] f g(Z k ,g k+1 ) can be calculated by the following formula:
[0059]
[0060] f d (Z k ,d k+1 ,m k+1 ) can be calculated by the following formula:
[0061]
[0062] Among them, d k+1 It represents the inclination of the Earth's magnetic field, which can be regarded as distributed only in the horizontal and vertical directions on the Earth's surface. It can be obtained by the direction of the Earth's magnetic field in the navigation coordinate system h k+1 OK, h k+1 It can be obtained by converting the magnetometer data in the target device coordinate system and the quaternion:
[0063]
[0064] * means taking conjugate of the matrix. represents the Kronecker product, so:
[0065]
[0066] Then the Jacobian matrix of the objective function can be described as:
[0067]
[0068] Among them J g (Z k ) and J d (Z k ,d k+1 ) represent the Jacobian matrices calculated from the gravimeter data and magnetometer data, respectively, which can be calculated by the following formula:
[0069]
[0070]
[0071] According to the objective function and the corresponding Jacobian matrix, the gradient of the objective function can be obtained:
[0072]
[0073] Finally, the attitude quaternion Z at time k+1 can be obtained by the following formula: k+1 :
[0074]
[0075] Among them, μ k It is a parameter determined by the magnitude of the direction change rate and the sampling period, and can be obtained through experiments.
[0076] In step S104, the gyroscope data is used as an input of the Kalman filter algorithm, and the first quaternion is used as an observation value of the Kalman filter algorithm for calculation to obtain a second quaternion at the second moment.
[0077] In one embodiment of the present disclosure, exemplarily, the process of using the gyroscope data as the input of the Kalman filter algorithm and calculating the first quaternion as the observation value of the Kalman filter algorithm to obtain the second quaternion at the second moment can be as follows:
[0078] The first quaternion Z k+1 It can be used as the observation value of Kalman filter. The state of Kalman filter at time k is represented by the quaternion q k =[q x0,k ,q x1,k ,q x2,k ,q x3,k ] T and the gyroscope drift three-axis vector value ε k =[ε x,k ,ε y,k ,ε z,k ] T Therefore, the state quantity at time k is defined as:
[0079] X k =[q x0,k ,q x1,k ,q x2,k ,q x3,k ,ε x,k ,ε y,k ,ε z,k ] T ;
[0080] The state equation and measurement equation are established as: k+1 =F k X k +v k , Z k =HX k +n k ;
[0081] Among them, F k and H are the state transfer matrix and observation matrix respectively, v k and n k They are the system noise and observation noise that obey Gaussian distribution respectively. The noise covariance matrices corresponding to the system noise and observation noise that obey Gaussian distribution are Q k , Rk .
[0082] The observation matrix can be constructed as: H = [I 4×4 O 4×3 ];
[0083] Among them, I 4×4 represents the 4*4 identity matrix, O 4×3 Represents a 4*3 all-zero matrix.
[0084] The state transfer matrix is:
[0085] Among them, F w,k It can be obtained by the following formula:
[0086]
[0087] w k =[w x,k ,w y,k ,w z,k ] T is the three-axis gyroscope data in the target device coordinate system at time k, and Δt is the sampling time interval.
[0088] According to the modulus of the angular velocity, it can be determined whether the current state is dynamic or static. Different state noise covariance matrices Q are set for the two states. k and the observation noise covariance matrix R k , used for time update and observation update process, the state judgment rule is:
[0089]
[0090] γ is the threshold for judging the state.
[0091] According to the constructed state equation and measurement equation, the square root unscented Kalman filter algorithm is used for calculation. The specific steps include initialization, calculation of sigma points, time update, observation update and state update. Finally, the second quaternion q representing the attitude of the target device can be obtained. k+1 =[q x0,k+1 ,q x1,k+1 ,q x2,k+1 ,q x3,k+1 ] T .
[0092] In step S105, a conversion matrix and a first heading angle of the target device at a first moment are obtained according to the second quaternion, and a second heading angle of the target device in a first time period is obtained according to the first heading angle, gyroscope data and the conversion matrix.
[0093] The first time period is after the second time.
[0094] In one embodiment of the present disclosure, illustratively, the process of acquiring the conversion matrix and the first heading angle of the target device at the first moment according to the second quaternion may be as follows:
[0095] Based on the second quaternion, it can be converted into a rotation matrix and roll angle, pitch angle and heading angle through the following formula:
[0096]
[0097] C represents the transformation matrix from the target device coordinate system to the navigation coordinate system.
[0098]
[0099] Among them, φ, Φ, They represent the roll angle, pitch angle and heading angle respectively. The roll angle represents the angle of rotation around the X-axis of the target device coordinate system, the pitch angle represents the angle of rotation around the Y-axis of the target device coordinate system, and the heading angle represents the angle of rotation around the Z-axis of the target device coordinate system.
[0100] In one embodiment of the present disclosure, illustratively, the process of obtaining the second heading angle of the target device within the first time period according to the first heading angle, the gyroscope data, and the conversion matrix may be as follows:
[0101] The attitude change can be calculated from the angular velocity, i.e. the gyroscope data:
[0102]
[0103] in, Represents the mean value of the three-axis gyroscope data in the target device coordinate system during the time period when the i-th step occurs.
[0104] If the attitude changes slightly, the heading angle remains unchanged. If the change is too large, it is determined whether the current position is at the turning point marked in advance. If it is not a turning point, the heading angle remains unchanged. Otherwise, the heading angle changes by 90 degrees to calibrate the heading angle when walking in a straight line. Whether to increase or decrease by 90 degrees is determined by the change in the Z-axis gyroscope data in the navigation coordinate system during the i-th time period Δn z,i Determine the angular velocity data n in the navigation coordinate system = [n x ,n y ,n z ] T The angular velocity w in the target device coordinate system can be obtained by the transformation matrix and the angular velocity w = [w x ,w y ,w z ] T We get: n = Cw;
[0105] Among them, Δnz,i The time period from the i-th step The Z-axis gyroscope data integration in the navigation coordinate system is:
[0106] Therefore, the second heading angle θ i It can be calculated by the following formula:
[0107]
[0108] θ i-1 represents the heading angle of the i-1th step, and ρ is the attitude change threshold, which is set by experiment.
[0109] In step S106, in response to the step detection result satisfying the stepping condition, the position of the target device in the second time period is acquired according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0110] The second period is after the first period.
[0111] In one embodiment of the present disclosure, illustratively, a process of acquiring the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period may be as follows:
[0112] The coordinates of the two-dimensional position of the pedestrian at the i-th step, that is, the position of the target device in the first period, are (x i ,y i ), the second heading angle is θ i , the step length indicated by the step length estimation result is l i For example, the next step position, that is, the position of the target device in the second period, can be expressed as: i+1 =x i +l i cosθ i ,y i+1 =y i +l i sinθ i . Pedestrian navigation and trajectory reconstruction can be achieved by continuously updating the above formula.
[0113] In the scheme of the embodiment of the present disclosure, the gyroscope data and linear acceleration data of the target device at the first moment, and the gravimeter data and magnetometer data of the target device at the second moment are obtained; the step detection result and the step length estimation result are obtained according to the linear acceleration data; the first quaternion at the second moment is obtained by calculating based on the gradient descent algorithm according to the gravimeter data and the magnetometer data; the gyroscope data is used as the input of the Kalman filter algorithm, and the first quaternion is used as the observation value of the Kalman filter algorithm to calculate, and the second quaternion at the second moment is obtained; the transformation matrix and the first heading angle of the target device at the second moment are obtained according to the second quaternion, and the second heading angle of the target device in the first time period is obtained according to the first heading angle, the gyroscope data and the transformation matrix, and the first time period is after the second moment; in response to the step detection result satisfying the stepping condition, the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period. Among them, considering that the second quaternion calculated by using the gyroscope data as the input of the Kalman filter algorithm and the first quaternion as the observation value of the Kalman filter algorithm has a higher accuracy, the accuracy of the second heading angle obtained based on the second quaternion is also higher, so that the accuracy of the position of the second time period obtained based on the second heading angle is higher, thereby improving the user experience.
[0114] In one implementation of the present disclosure, obtaining a step detection result according to linear acceleration data includes:
[0115] Obtaining the vector sum of acceleration vectors of the target device in multiple directions at different times according to the linear acceleration data;
[0116] In response to the maximum value of the vector sum within the target time range being greater than or equal to the first vector sum threshold, and the minimum value of the vector sum within the target time range being less than or equal to the second vector sum threshold, a step detection result is generated to indicate that the user of the target device has taken a step, and the time length of the target time range is less than or equal to the target time length threshold.
[0117] In one implementation of the present disclosure, obtaining a step length estimation result according to linear acceleration data includes:
[0118] pass Get the step length l of the i-th step i , and according to l i To obtain the step size estimation result, is the maximum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, is the maximum and minimum values of the three-axis vector sum in the linear acceleration data within the time range corresponding to the i-th step, and k is a constant.
[0119] In the scheme of the disclosed embodiment, it is considered that when detecting steps, if the pedestrian collects data by holding the mobile phone flat, the acceleration data perpendicular to the ground will fluctuate periodically with the change of footsteps during walking. However, when the pedestrian changes the posture of the mobile phone while walking, the acceleration data perpendicular to the ground will affect the detection of steps. Therefore, the three-axis vector sum of linear acceleration can be calculated, and a sliding average process is performed on it to filter out high-frequency noise. Therefore, by obtaining the vector sum of the acceleration vectors of the target device in multiple directions at different times according to the linear acceleration data, and only in response to the maximum value of the vector sum within the target time range being greater than or equal to the first vector sum threshold, and the minimum value of the vector sum within the target time range being less than or equal to the second vector sum threshold, a step detection result for indicating that the user of the target device has taken a step is generated, which can improve the accuracy of step detection.
[0120] In one implementation of the present disclosure, in response to the step detection result satisfying the step condition, before acquiring the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, the method further includes:
[0121] according to Get the mean of the three-axis angular velocity vector in the gyroscope data within the time range corresponding to the i-th step where w x,i is the angular velocity vector in the x-axis direction, w y,i is the angular velocity vector in the y-axis direction, w z,i is the angular velocity vector in the z-axis direction;
[0122] In response to the step detection result satisfying the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, including:
[0123] In response to is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0124] In the solution of the embodiment of the present disclosure, according to Get the mean of the three-axis angular velocity vector in the gyroscope data within the time range corresponding to the i-th step and respond to If the position of the target device in the second time period is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period. This ensures that the position of the target device in the second time period is calculated only when the posture change of the target device is large, and avoids calculating the position of the target device when the posture of the target device has not changed significantly, thereby minimizing the amount of calculation without reducing the positioning accuracy.
[0125] In one implementation of the present disclosure, in response to is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including
[0126] In response to the position of the target device in the first period matching the steering position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0127] In one implementation of the present disclosure, in response to the position of the target device in the first period matching the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including:
[0128] In response to the second heading angle being greater than or equal to the turning heading angle threshold, the position of the target device in the first time period matches the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0129] In the solution of the embodiment of the present disclosure, in response to the second heading angle being greater than or equal to the turning heading angle threshold, the position of the target device in the first time period matches the turning position, If the position of the target device in the second period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first period, the position of the target device in the second period is calculated only when the attitude of the target device changes greatly and the heading angle changes greatly, and the position of the target device in the second period is avoided when the attitude of the target device does not change greatly or the heading angle does not change greatly, thereby minimizing the amount of calculation without reducing the positioning accuracy.
[0130] Figure 2 The structural block diagram of the positioning device according to the embodiment of the present disclosure is shown. The device can be implemented as part or all of the electronic device through software, hardware or a combination of both.
[0131] like Figure 2 As shown, the positioning device 200 includes:
[0132] The data acquisition module 201 is configured to acquire gyroscope data and linear acceleration data of the target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, the first moment being earlier than the second moment;
[0133] A step detection module 202 is configured to obtain a step detection result and a step length estimation result according to the linear acceleration data;
[0134] The first quaternion calculation module 203 is configured to calculate based on the gravimeter data and the magnetometer data based on the gradient descent algorithm to obtain the first quaternion at the second moment;
[0135] The second quaternion calculation module 204 is configured to use the gyroscope data as an input of the Kalman filter algorithm and use the first quaternion as an observation value of the Kalman filter algorithm to calculate and obtain a second quaternion at a second moment;
[0136] The heading angle calculation module 205 is configured to obtain the conversion matrix and the first heading angle of the target device at the second moment according to the second quaternion, and obtain the second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the conversion matrix, the first time period being after the second moment;
[0137] The position estimation module 206 is configured to obtain the position of the target device in a second time period in response to the step detection result satisfying the step condition according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
[0138] The present disclosure also discloses an electronic device, Figure 3 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0139] like Figure 3 As shown, the electronic device 300 includes a memory 301 and a processor 302, wherein the memory 301 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 302 to implement the following method steps:
[0140] In a first aspect, an embodiment of the present disclosure provides a model training method, the method comprising:
[0141] Acquire gyroscope data and linear acceleration data of the target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, the first moment being earlier than the second moment;
[0142] Obtaining step detection results and step length estimation results based on linear acceleration data;
[0143] According to the gravimeter data and the magnetometer data, a calculation is performed based on a gradient descent algorithm to obtain a first quaternion at the second moment;
[0144] The gyroscope data is used as the input of the Kalman filter algorithm, and the first quaternion is used as the observation value of the Kalman filter algorithm for calculation to obtain the second quaternion at the second moment;
[0145] Obtaining a conversion matrix and a first heading angle of the target device at a second moment according to the second quaternion, and obtaining a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the conversion matrix, the first time period being after the second moment;
[0146] In response to the step detection result satisfying the step condition, the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
[0147] In one implementation of the present disclosure, obtaining a step detection result according to linear acceleration data includes:
[0148] Obtaining the vector sum of acceleration vectors of the target device in multiple directions at different times according to the linear acceleration data;
[0149] In response to the maximum value of the vector sum within the target time range being greater than or equal to the first vector sum threshold, and the minimum value of the vector sum within the target time range being less than or equal to the second vector sum threshold, a step detection result is generated to indicate that the user of the target device has taken a step, and the time length of the target time range is less than or equal to the target time length threshold.
[0150] In one implementation of the present disclosure, obtaining a step length estimation result according to linear acceleration data includes:
[0151] pass Get the step length l of the i-th step i , and according to l i To obtain the step size estimation result, is the maximum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, is the maximum and minimum values of the three-axis vector sum in the linear acceleration data within the time range corresponding to the i-th step, and k is a constant.
[0152] In one implementation of the present disclosure, in response to the step detection result satisfying the step condition, before acquiring the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, the method further includes:
[0153] according to Get the mean of the three-axis angular velocity vector in the gyroscope data within the time range corresponding to the i-th step where w x,i is the angular velocity vector in the x-axis direction, w y,i is the angular velocity vector in the y-axis direction, w z,i is the angular velocity vector in the z-axis direction;
[0154] In response to the step detection result satisfying the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, including:
[0155] In response to is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0156] In one implementation of the present disclosure, in response to is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including
[0157] In response to the position of the target device in the first period matching the steering position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0158] In one implementation of the present disclosure, in response to the position of the target device in the first period matching the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including:
[0159] In response to the second heading angle being greater than or equal to the turning heading angle threshold, the position of the target device in the first time period matches the turning position, is greater than or equal to the single-step posture change threshold and the step detection result meets the stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
[0160] Figure 4 A schematic diagram showing the structure of a computer system suitable for implementing the method according to an embodiment of the present disclosure is shown.
[0161] like Figure 4 As shown, the computer system 400 includes a processing unit 401, which can execute various methods in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage part 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the system 400 are also stored. The processing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0162] The following components are connected to the I / O interface 405: an input part 406 including a keyboard, a mouse, etc.; an output part 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part 408 including a hard disk, etc.; and a communication part 409 including a network interface card such as a LAN card, a modem, etc. The communication part 409 performs a communication process via a network such as the Internet. The drive 410 is also connected to the I / O interface 405 as needed. Removable media 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive 410 as needed, so that the computer program read therefrom is installed into the storage part 408 as needed. Among them, the processing unit 401 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, an NPU, etc.
[0163] In particular, according to an embodiment of the present disclosure, the method described above can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes a program code for executing the above method. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 409, and / or installed from a removable medium 411.
[0164] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0165] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or programmable hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0166] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0167] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A positioning method, It is characterized in that The method comprises: Acquire gyroscope data and linear acceleration data of the target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, wherein the first moment is earlier than the second moment; Acquire a step detection result and a step length estimation result according to the linear acceleration data; Calculating based on the gravimeter data and the magnetometer data based on a gradient descent algorithm to obtain a first quaternion at a second moment; Using the gyroscope data as an input of a Kalman filter algorithm, and using the first quaternion as an observation value of the Kalman filter algorithm for calculation, to obtain a second quaternion at a second moment; Acquire a conversion matrix and a first heading angle of the target device at a second moment according to the second quaternion, and acquire a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data, and the conversion matrix, wherein the first time period is after the second moment; In response to the step detection result satisfying the stepping condition, the position of the target device in a second time period is obtained according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
2. The positioning method according to claim 1, It is characterized in that The step detection result is obtained according to the linear acceleration data, comprising: Acquire the vector sum of acceleration vectors of the target device in multiple directions at different times according to the linear acceleration data; In response to the maximum value of the vector sum within the target time range being greater than or equal to a first vector sum threshold, and the minimum value of the vector sum within the target time range being less than or equal to a second vector sum threshold, a step detection result is generated to indicate that the user of the target device has taken a step, and the time length of the target time range is less than or equal to the target time length threshold.
3. The positioning method according to claim 1, It is characterized in that The step length estimation result is obtained according to the linear acceleration data, comprising: pass Get the step length l of the i-th step i , and according to l i Get the step size estimation result, where is the maximum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, is the minimum value of the sum of the three-axis vectors in the linear acceleration data within the time range corresponding to the i-th step, and k is a constant.
4. The positioning method according to claim 1, It is characterized in that In response to the step detection result satisfying the step condition, before obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, the method further includes: according to Get the mean value of the three-axis angular velocity vector in the gyroscope data within the time range corresponding to step i where w x,i is the angular velocity vector in the x-axis direction, w y,i is the angular velocity vector in the y-axis direction, w z,i is the angular velocity vector in the z-axis direction; In response to the step detection result satisfying the step condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period includes: In response to is greater than or equal to a single-step posture change threshold and the step detection result satisfies a stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
5. The positioning method according to claim 4, It is characterized in that The response is greater than or equal to a single-step posture change threshold and the step detection result satisfies a stepping condition, obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result and the position of the target device in the first time period, including In response to the position of the target device in the first time period matching the turning position, is greater than or equal to a single-step posture change threshold and the step detection result satisfies a stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
6. The positioning method according to claim 4, It is characterized in that in response to the position of the target device in the first time period matching the steering position, is greater than or equal to a single-step posture change threshold and the step detection result satisfies a stepping condition, and obtaining the position of the target device in the second time period according to the second heading angle, the step length estimation result, and the position of the target device in the first time period, including: In response to the second heading angle being greater than or equal to a turning heading angle threshold, the position of the target device in the first time period matches the turning position, is greater than or equal to a single-step posture change threshold and the step detection result satisfies a stepping condition, and the position of the target device in the second time period is obtained according to the second heading angle, the step length estimation result, and the position of the target device in the first time period.
7. A positioning device, It is characterized in that The device comprises: a data acquisition module configured to acquire gyroscope data and linear acceleration data of a target device at a first moment, and gravimeter data and magnetometer data of the target device at a second moment, wherein the first moment is earlier than the second moment; A step detection module, configured to obtain a step detection result and a step length estimation result according to the linear acceleration data; A first quaternion calculation module is configured to perform calculation based on the gravimeter data and the magnetometer data based on a gradient descent algorithm to obtain a first quaternion at a second moment; A second quaternion calculation module is configured to use the gyroscope data as an input of a Kalman filter algorithm and use the first quaternion as an observation value of the Kalman filter algorithm to calculate a second quaternion at a second moment; a heading angle calculation module, configured to obtain a conversion matrix and a first heading angle of the target device at a second moment according to the second quaternion, and obtain a second heading angle of the target device in a first time period according to the first heading angle, the gyroscope data and the conversion matrix, wherein the first time period is after the second moment; The position estimation module is configured to obtain the position of the target device in a second time period in response to the step detection result satisfying the step condition according to the second heading angle, the step length estimation result and the position of the target device in the first time period, and the second time period is after the first time period.
8. An electronic device, It is characterized in that The method comprises a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method according to any one of claims 1 to 6.
9. A readable storage medium having computer instructions stored thereon, It is characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising computer instructions, which, when executed by a processor, implement the method steps of any one of claims 1 to 6.
Citation Information
Patent Citations
Self-adaptive step length estimating method based on gradient descent
CN109459028A
Zero-speed detection method, pedestrian inertial navigation method and device, and storage medium
CN110715659A