Fusion heading angle estimation method and system based on machine learning classification
The machine learning classification method is used to fuse the heading angle, which solves the problems of error accumulation and magnetic field interference in heading angle estimation in indoor environments, and improves positioning accuracy.
Patent Information
- Application Number
- CN202111662081.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-12-31
AI Technical Summary
Existing heading angle estimation methods have problems with positioning error accumulation and magnetic field interference in indoor environments, resulting in low positioning accuracy.
Adopt a classification method based on machine learning, use support vector machine (SVM) and principal component analysis (PCA) to classify whether the magnetometer measurement data is interfered by magnetic fields, and choose an appropriate method to fuse the heading angle results of the magnetometer and gyroscope to avoid Error accumulation and magnetic field interference effects.
The estimation accuracy of the heading angle is improved, the positioning error of the PDR algorithm is reduced, and the heading angle estimation results are more robust and accurate.
Smart Images

Figure CN114323008B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of wireless positioning, and in particular relates to a fusion heading angle estimation method and system based on machine learning classification. Background Art
[0002] With the popularization of mobile smart devices and the development of Internet of Things (IOT) technology, the demand for location-based services (LBS) is gradually increasing. Global navigation satellite systems (such as GPS and GNSS) are the most widely used and most mature outdoor positioning technologies. However, in indoor environments, due to the obstruction of obstacles and the weak penetration of satellite signals, GPS / GNSS cannot meet the requirements of practical indoor applications. At the same time, the indoor environment is more complex than the outdoor environment in terms of layout, topological constraints and spatial limitations, and requires higher positioning accuracy. Therefore, developing a low-cost, high-positioning accuracy and widely popular indoor positioning technology in indoor scenarios is still a research hotspot in academia and industry.
[0003] Inertial sensors have become the standard configuration of mainstream smartphones. The dead reckoning technology based on inertial sensors has attracted much attention from researchers due to its low cost, simple implementation, and independence from external auxiliary equipment. However, the dead reckoning method has the problem of gradual accumulation of positioning errors in practical applications. The most commonly used pedestrian dead reckoning (PDR) algorithm uses inertial sensors (accelerometers, magnetometers, gyroscopes, etc.) in smart devices to estimate the position of pedestrians. The PDR algorithm includes gait detection, step length estimation, and heading angle estimation. Heading angle estimation is a difficult point in PDR positioning based on smartphones. It is generally obtained through gyroscopes and magnetometers. The gyroscope can calculate the relative value of the heading angle based on the angular velocity. The accuracy is high in a short period of time, but the error will gradually accumulate over time. The magnetometer calculates the absolute value of the heading angle based on the measured magnetic field strength, but the magnetometer is easily affected by the electromagnetic environment. Especially in an environment with magnetic field interference, the heading angle measured by the magnetometer has a large deviation, resulting in a large error in the PDR positioning result, thereby affecting the positioning accuracy. In summary, the two existing heading angle estimation methods have certain limitations in practical applications, and the lack of a more robust heading angle estimation method affects the application of PDR in various scenarios. Summary of the invention
[0004] In view of the shortcomings of the heading angle estimation in the prior art, the present invention discloses a fusion heading angle estimation method and system based on machine learning classification, which can effectively improve the estimation accuracy of the heading angle, thereby reducing the positioning error of the PDR algorithm. The present invention uses the support vector machine (SVM) and principal component analysis (PCA) method in the machine learning algorithm to classify whether the magnetometer measurement data is interfered by the magnetic field, and selects different methods to fuse the heading angle results of the magnetometer and the gyroscope according to the classification results, which not only avoids the cumulative error of the gyroscope, but also avoids the use of the data of the magnetometer interfered by the strong magnetic field, so that the heading angle estimation result proposed by the present invention is more robust and has higher accuracy.
[0005] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0006] The fusion heading angle estimation method based on machine learning classification is as follows:
[0007] Step 1: Calculate the heading angle by measuring the three-axis magnetic induction intensity and three-axis acceleration information;
[0008] Step 2: Calculate the heading angle by measuring the three-axis angular velocity information;
[0009] Step 3: Classify whether the three-axis magnetic induction intensity data obtained in step 1 is interfered by the magnetic field; Step 4: According to the classification result of step 3, in the scenario without magnetic field interference, the heading angles obtained in step 1 and step 2 are Kalman filtered to fuse and calculate the final heading angle; in the scenario with magnetic field interference, only the heading angle obtained in step 2 is used to estimate the final heading angle.
[0010] Preferably, the specific steps of step 1, calculating the heading angle using acceleration and magnetic induction intensity, are as follows:
[0011] Step 1.1: Use the built-in magnetometer and accelerometer of the smartphone to collect the three-axis magnetic induction intensity and three-axis acceleration values in the carrier coordinate system.
[0012] The carrier coordinate system (b system) is fixed to the carrier, with its origin at the center of mass of the carrier, and the three axes are represented by X, Y, and Z. The carrier coordinate system of the pedestrian navigation system is defined as the right front upper coordinate system, with its X axis pointing to the right along the carrier's horizontal axis, its Y axis pointing forward along the carrier's horizontal axis, and its Z axis pointing vertically upward along the carrier. The three-axis magnetic induction intensity collected by the magnetometer in the b system is The three-axis acceleration collected by the accelerometer in the b system is (A x ,A y ,A z ).
[0013] The navigation coordinate system (n system) usually adopts the geographic coordinate system, and the northeast celestial coordinate system is selected, that is, its X axis points to the horizontal east, the Y axis points to the horizontal north, and the Z axis is perpendicular to the ground and upward along the vertical line.
[0014] The carrier coordinate system and the navigation coordinate system do not coincide with each other during pedestrian walking. The coordinate system needs to be obtained through three rotations. The commonly used rotation sequences are ZXY, ZYX, etc. Taking the rotation sequence ZXY as an example, the rotation around the X-axis is the pitch angle θ, the rotation around the Y-axis is the roll angle γ, and the rotation around the Z-axis is the heading angle ψ.
[0015] First, the attitude information of the mobile phone is initialized according to the acceleration sensor information, and the pitch angle θ and roll angle γ are calculated, where g is the gravitational acceleration. The specific calculation formula is as follows:
[0016]
[0017] After the n system is rotated by the ZXY axis, the b system is obtained, and the attitude matrix As shown below:
[0018]
[0019] The attitude transformation matrix from b system to n system is as follows:
[0020]
[0021] Secondly, since the heading angle does not participate in the conversion, the heading angle ψ is set to 0, and the three-axis magnetometer component in the n system is calculated using the measurement value of the magnetometer in the b system. The conversion formula is as follows:
[0022]
[0023] Step 1.2: Calculate the heading angle ψ in the n frame based on the magnetometer measurement value in the b frame m .
[0024] Calculate the heading angle in the reference coordinate system according to formula (1.5), where ψ MD Indicates the local magnetic declination.
[0025]
[0026] Preferably, the step 2, calculating the heading angle using the three-axis angular velocity values measured by the gyroscope sensor, comprises the following steps:
[0027] Step 2.1: Use the three-axis angular velocity values (W) measured by the gyroscope sensor x ,W y ,W z ) and quaternion method to solve the attitude transformation matrix.
[0028] The quaternion is defined as follows:
[0029] q=q0+q1·i+q2·j+q3·k (1.3)
[0030] The quaternions satisfy the following relationship:
[0031]
[0032] The attitude transformation matrix from b system to n system expressed by quaternion is as follows:
[0033]
[0034] Combining equations (1.3) and (1.8), we can derive the relationship between quaternions and Euler angles:
[0035]
[0036] The differential equation for quaternion update is as follows:
[0037]
[0038] Step 2.2: Calculate the heading angle ψ based on the updated quaternion data above g .
[0039]
[0040] Preferably, the step 3 adopts support vector machine (SVM) + principal component analysis (PCA) method to classify whether the magnetometer measurement data is interfered by the magnetic field, which specifically includes an offline training stage and an online recognition stage.
[0041] Step 3.1: The specific steps of the offline training phase are as follows:
[0042] Step 3.1.1: Collect inertial sensor data in environments with and without magnetic interference, use the data without magnetic interference as positive samples, the data with magnetic interference as negative samples, and record the labels corresponding to the data.
[0043] Step 3.1.2: Perform data preprocessing to achieve data segmentation and discretization between steps.
[0044] The heading angles calculated in step 1 and step 2 are divided into steps to determine the magnetometer heading angle ψ of each step of the pedestrian. m and the gyro heading angle ψ g , assuming that the k-th step contains N sample points, the heading angles of the k-th step are:
[0045]
[0046]
[0047] Step 3.1.3: Extract the data features contained in each step during walking. The features include: (1) The mean square value M of the magnetic field intensity at the kth step k ; (2) Standard deviation σ of the magnetic field intensity at step k m ; (3) The kth step magnetometer heading angle Gyro heading angle The absolute value of the difference ψ dif ; (4) skewness ske of the k-th step magnetic field intensity; (5) kurtosis kur of the k-th step magnetic field intensity; (6) square root of the difference between the k-th step magnetometer heading angle energy and the k-th step gyroscope heading angle energy E dif ; (7) The heading deviation of the magnetometer between two adjacent steps Δψ m Gyro heading deviation Δψ g The absolute value of the difference between the two steps Δψ; (8) The absolute value of the difference between the energy of the magnetic field signal between two adjacent steps ΔE m .
[0048] Step 3.1.4: According to the extracted data features and their corresponding labels, PCA principal component analysis is used to reduce the dimension of the prediction space to prevent overfitting, and then the SVM classifier is trained. The processed data features and their corresponding labels are input into the classifier for training. When there is no magnetic interference, the label of the magnetometer is label = 0, and when there is magnetic interference, the label is label = 1. Finally, the classification model with or without magnetic field interference based on SVM+PCA is output.
[0049] Step 3.2: The specific steps of the online identification stage are as follows:
[0050] Step 3.2.1: Use the smart terminal with built-in inertial sensor to collect three-axis accelerometer, three-axis magnetometer and three-axis gyroscope data in real time in the actual environment. The way pedestrians carry the smart terminal is consistent with the training stage.
[0051] Step 3.2.2: Preprocess the collected data to achieve data segmentation and discretization between steps.
[0052] Step 3.2.3: Extract data features in each step. The feature types are consistent with step 3.1.3.
[0053] Step 3.2.4: The features extracted in real time after PCA processing are used as the input of the SVM classifier trained in the offline stage, and the data label is used as the output of the classifier to identify whether there is magnetic field interference. Online identification is used to verify whether the trained SVM classifier can accurately identify magnetic field interference. If it cannot be accurately identified, the classifier needs to be retrained. If it can be accurately identified, the heading angle estimation in the subsequent steps is performed.
[0054] Preferably, step 4 is based on the classification result, in a scenario without magnetic field interference, the heading angles obtained in steps 1 and 2 are Kalman filtered and fused to calculate the final heading angle, that is, executing step 4.1; in a scenario with magnetic field interference, the heading angle obtained by the gyroscope is selected as the final heading angle, that is, executing step 4.2.
[0055] Step 4.1: Without magnetic field interference, the steps for heading angle estimation are as follows:
[0056] Step 4.1.1: Convert the heading angle obtained by the gyroscope As the state equation, the heading angle obtained by the magnetometer is As the observation equation. The formula is as follows:
[0057]
[0058]
[0059] Among them, H k represents the fusion heading, A and B represent the unit matrix, and w k represents a Gaussian component with a mean of 0 and a covariance of Q, v k Represents a Gaussian component with mean 0 and covariance R.
[0060] Step 4.1.2: Prediction phase of Kalman filter fusion:
[0061]
[0062] Step 4.1.3: Correction phase of Kalman filter fusion:
[0063]
[0064]
[0065]
[0066] Step 4.1.4: At this point, the heading angle after the k-th step fusion is as follows:
[0067]
[0068] Step 4.2: Under magnetic field interference, the gyroscope heading angle obtained in step 2 is used as the heading angle of the kth step.
[0069]
[0070] Among them, ψ k-1 is the heading angle of the k-1th step.
[0071] The present invention also discloses a fusion heading angle estimation system based on machine learning classification, comprising the following modules:
[0072] Module 1 for calculating heading angle: Calculates heading angle by measuring the three-axis magnetic induction intensity and three-axis acceleration information;
[0073] Module 2 for calculating heading angle: Calculates heading angle through the three-axis angular velocity information obtained by measurement;
[0074] Magnetic field interference classification module: classifies whether the three-axis magnetic induction intensity data obtained by the heading angle calculation module 1 is interfered by the magnetic field;
[0075] Final heading angle module: According to the classification results of the magnetic field interference classification module, in the scenario without magnetic field interference, the heading angles obtained by the heading angle calculation module 1 and the heading angle calculation module 2 are fused by Kalman filtering to calculate the final heading angle; in the scenario with magnetic field interference, only the heading angle obtained by the heading angle calculation module 2 is used to estimate the final heading angle.
[0076] The beneficial effects of the present invention are:
[0077] The present invention proposes a fusion heading angle estimation method and system based on machine learning. In the heading angle estimation process, support vector machine (SVM) and principal component analysis (PCA) methods are used to classify whether magnetometer measurement data is interfered with by a magnetic field, and different methods are selected according to the classification results to fuse the heading angle results of the magnetometer and the gyroscope, thereby avoiding the cumulative error of the gyroscope and avoiding the use of data of the magnetometer interfered with by a strong magnetic field, thereby making the heading angle estimation result proposed by the present invention more robust and more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 Flow chart of the fusion heading angle estimation method based on machine learning classification in the present invention.
[0079] Figure 2 Block diagram of the fusion heading angle estimation system based on machine learning classification in the present invention. DETAILED DESCRIPTION
[0080] The present invention is described in detail below with reference to the accompanying drawings.
[0081] like Figure 1 As shown, the fusion heading angle estimation method based on machine learning classification in this embodiment has the following specific steps:
[0082] Step 1.1: Use the built-in magnetometer and accelerometer of the smartphone to collect the measurement values (M) in the carrier coordinate system (b system) x ,M y ,M z) and the three-axis acceleration value (A x ,A y ,A z ).
[0083] Generally speaking, the carrier coordinate system and the reference coordinate system do not coincide when pedestrians are walking. The coordinate system needs to be obtained through three rotations. The commonly used rotation sequences are ZXY, ZYX, etc. This article takes the rotation sequence ZXY as an example, where the rotation around the X-axis is the pitch angle θ, the rotation around the Y-axis is the roll angle γ, and the rotation around the Z-axis is the heading angle ψ.
[0084] The pitch angle θ and roll angle γ are calculated based on the measured values of the accelerometer. The formula is as follows:
[0085]
[0086] After the n system is rotated by the ZXY axis, the b system is obtained, and the attitude matrix As shown below:
[0087]
[0088] The attitude transformation matrix from b system to n system is as follows:
[0089]
[0090] Secondly, since the heading angle does not participate in the conversion, the heading angle ψ is set to 0, and the measurement value of the magnetometer in the b system is used to calculate the corresponding three-axis magnetometer component in the n system. The conversion formula is as follows:
[0091]
[0092] Step 1.2: Calculate the heading angle ψ in the n frame based on the magnetometer measurement value in the b frame m , ψ MD Indicates the local magnetic declination.
[0093]
[0094] The steps to calculate the heading angle using the three-axis angular velocity values measured by the gyroscope sensor are as follows:
[0095] Step 2.1: Use the three-axis angular velocity values (W) measured by the gyroscope sensor x ,W y ,W z ) and quaternion method to solve the attitude transformation matrix.
[0096] The quaternion is defined as follows:
[0097] q=q0+q1·i+q2·j+q3·k
[0098] The quaternions satisfy the following relationship:
[0099]
[0100] The attitude transformation matrix from b system to n system expressed by quaternion is as follows:
[0101]
[0102] The relationship between quaternion and Euler angle can be obtained:
[0103]
[0104] The differential equation for quaternion update is as follows:
[0105]
[0106] Step 2.2: Calculate the heading angle ψ based on the updated quaternion data above g .
[0107]
[0108] The support vector machine (SVM) + principal component analysis (PCA) method in the machine learning algorithm is used to classify whether the magnetometer measurement data is interfered by the magnetic field.
[0109] Step 3.1: The specific steps of the offline training phase are as follows:
[0110] Step 3.1.1: Collect inertial sensor data in environments with and without magnetic interference, use the data without magnetic interference as positive samples, the data with magnetic interference as negative samples, and record the labels corresponding to the data.
[0111] Step 3.1.2: Perform data preprocessing to achieve data segmentation and discretization between steps.
[0112] The heading angles calculated in step 1 and step 2 are divided into steps to determine the magnetometer heading angle ψ of each step of the pedestrian. m and the gyro heading angle ψ g , assuming that the k-th step contains N sample points, the heading angles of the k-th step are:
[0113]
[0114]
[0115] Step 3.1.3: Extract the data features contained in each step during the walking process. The specific features are as follows:
[0116] The collected three-axis magnetometer data M xi,M yi ,M zi Calculate the mean square value M of the magnetic field strength at step k k :
[0117]
[0118] The standard deviation σ of the magnetic field intensity at the kth step m :
[0119]
[0120] The k-th step magnetometer heading angle Gyro heading angle The absolute value of the difference ψ dif :
[0121]
[0122] The skewness ske of the magnetic field intensity at step k:
[0123]
[0124] The kurtosis kur of the magnetic field intensity at step k:
[0125]
[0126] The square root of the difference between the k-th step magnetometer heading angle energy and the gyroscope heading angle energy E dif :
[0127]
[0128] The magnetometer heading deviation between two adjacent steps Δψ m Gyro heading deviation Δψ g The absolute value of the difference Δψ:
[0129]
[0130] in, They represent the magnetometer heading angle and gyroscope heading angle of the k-1th step respectively.
[0131] The absolute value of the difference in energy between two adjacent steps of magnetic field signal ΔE m :
[0132]
[0133] ΔE m =|E k -E k-1 |
[0134] Among them, E k is the magnetic field signal energy at the kth step.
[0135] Step 3.1.4: According to the extracted data features and their corresponding labels, PCA principal component analysis is used to reduce the dimension of the prediction space to prevent overfitting, and then the SVM classifier is trained. The processed data features and their corresponding labels are input into the classifier for training. When there is no magnetic interference, the label of the magnetometer is label = 0, and when there is magnetic interference, the label is label = 1. Finally, the classification model with or without magnetic field interference based on SVM+PCA is output.
[0136] Step 3.2: The specific steps of the online identification stage are as follows:
[0137] Step 3.2.1: Use a smart terminal with built-in inertial sensors to collect three-axis accelerometer, three-axis magnetometer, and three-axis gyroscope data in real time in environments without and with magnetic field interference. The way pedestrians carry the smart terminal remains the same as in the training phase.
[0138] Step 3.2.2: Preprocess the collected data to achieve data segmentation and discretization between steps.
[0139] Step 3.2.3: Extract data features in each step. The feature types are consistent with step 3.1.3.
[0140] Step 3.2.4: The features extracted in real time after PCA processing are used as the input of the SVM classifier trained in the offline stage, and the data label is used as the output of the classifier to identify whether there is magnetic field interference. Online identification is used to verify whether the trained SVM classifier can accurately identify magnetic field interference. If it cannot be accurately identified, the classifier needs to be retrained. If it can be accurately identified, the heading angle estimation in the subsequent steps is performed.
[0141] The step 4 is to calculate the final heading angle by Kalman filtering the heading angles obtained in steps 1 and 2 according to the classification results in a scenario without magnetic field interference, that is, to execute step 4.1; in a scenario with magnetic field interference, select the heading angle obtained by the gyroscope as the final heading angle, that is, to execute step 4.2.
[0142] Step 4.1: Without magnetic field interference, the steps for heading angle estimation are as follows:
[0143] Step 4.1.1: Convert the heading angle obtained by the gyroscope As the state equation, the heading angle obtained by the magnetometer is As the observation equation. The formula is as follows:
[0144]
[0145]
[0146] Among them, H k represents the fusion heading, A and B represent the unit matrix, and w k represents a Gaussian component with a mean of 0 and a covariance of Q, v k Represents a Gaussian component with mean 0 and covariance R.
[0147] Step 4.1.2: Prediction phase of Kalman filter fusion:
[0148]
[0149]
[0150] Step 4.1.3: Correction phase of Kalman filter fusion:
[0151]
[0152]
[0153]
[0154] Step 4.1.4: At this point, the heading angle after the k-th step fusion is as follows:
[0155]
[0156] Step 4.2: Under magnetic field interference, the gyroscope heading angle obtained in step 2 is used as the heading angle of the kth step.
[0157]
[0158] Among them, ψ k-1 is the heading angle of the k-1th step.
[0159] like Figure 2 As shown, this embodiment discloses a fusion heading angle estimation system based on machine learning classification, including the following modules:
[0160] Module 1 for calculating heading angle: Calculates heading angle by measuring the three-axis magnetic induction intensity and three-axis acceleration information;
[0161] Module 2 for calculating heading angle: Calculates heading angle through the three-axis angular velocity information obtained by measurement;
[0162] Magnetic field interference classification module: classifies whether the three-axis magnetic induction intensity data obtained by the heading angle calculation module 1 is interfered by the magnetic field;
[0163] Final heading angle module: According to the classification results of the magnetic field interference classification module, in the scenario without magnetic field interference, the heading angles obtained by the heading angle calculation module 1 and the heading angle calculation module 2 are fused by Kalman filtering to calculate the final heading angle; in the scenario with magnetic field interference, only the heading angle obtained by the heading angle calculation module 2 is used to estimate the final heading angle.
[0164] The connection relationship between each module is as follows Figure 2 shown.
[0165] The above is only a description of the preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that those skilled in the art can combine the above embodiments, or make various obvious changes, readjustments and substitutions without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A fusion heading angle estimation method based on machine learning classification, characterized by Follow these steps: Step 1: Calculate the heading angle by measuring the three-axis magnetic induction intensity and three-axis acceleration information; Step 2: Calculate the heading angle by measuring the three-axis angular velocity information; Step 3: classify whether the three-axis magnetic induction intensity data obtained in step 1 is interfered by the magnetic field; Step 4: Based on the classification result of step 3, in the scenario without magnetic field interference, the heading angles obtained in step 1 and step 2 are fused by Kalman filtering to calculate the final heading angle; in the scenario with magnetic field interference, only the heading angle obtained in step 2 is used to estimate the final heading angle; The step 3 uses a support vector machine combined with a principal component analysis method to classify whether the magnetometer measurement data is interfered by a magnetic field, which specifically includes an offline training stage and an online recognition stage; The specific steps of the offline training phase are as follows: Step 3.1.1: Collect inertial sensor data in environments with and without magnetic interference, use the data without magnetic interference as positive samples, the data with magnetic interference as negative samples, and record the labels corresponding to the data; Step 3.1.2: Perform data preprocessing to achieve data segmentation and discretization between steps; The heading angles calculated in step 1 and step 2 are divided into steps to determine the magnetometer heading angle ψ of each step of the pedestrian. m and the gyro heading angle ψ g , assuming that the k-th step contains N sample points, the heading angles of the k-th step are: Step 3.1.3: Extract the data features contained in each step during walking, including: (1) the mean square value M of the magnetic field intensity at the kth step k ; (2) Standard deviation σ of the magnetic field intensity at step k m ; (3) The kth step magnetometer heading angle Gyro heading angle The absolute value of the difference ψ dif ; (4) skewness ske of the k-th step magnetic field intensity; (5) kurtosis kur of the k-th step magnetic field intensity; (6) square root of the difference between the k-th step magnetometer heading angle energy and the k-th step gyroscope heading angle energy E dif ; (7) The heading deviation of the magnetometer between two adjacent steps Δψ m Gyro heading deviation Δψ g The absolute value of the difference between the two steps Δψ; (8) The absolute value of the difference between the energy of the magnetic field signal between two adjacent steps ΔE m ; Step 3.1.4: According to the extracted data features and their corresponding labels, the principal component analysis method is used to reduce the dimension of the prediction space, and then the support vector machine classifier is trained; the processed data features and their corresponding labels are input into the classifier for training, and the label is label = 0 when there is no magnetic interference, and the label is label = 1 when there is magnetic interference; finally, a classification model based on the support vector machine combined with the principal component analysis method is output for the presence or absence of magnetic field interference; The specific steps of the online identification stage are as follows: Step 3.2.1: Use a smart terminal with built-in inertial sensors to collect three-axis accelerometer, three-axis magnetometer and three-axis gyroscope data in real time in the actual environment; the way pedestrians carry the smart terminal is consistent with the training stage; Step 3.2.2: Preprocess the collected data to achieve data segmentation and discretization between steps; Step 3.2.3: Extract the data features in each step. The feature types are consistent with those in step 3.1.
3. Step 3.2.4: The features extracted in real time after principal component analysis are used as the input of the SVM classifier trained in the offline stage, and the data label is used as the output of the classifier to identify whether there is magnetic field interference; online identification is used to verify whether the trained support vector machine classifier can accurately identify magnetic field interference. If it cannot be accurately identified, the classifier needs to be retrained; if it can be accurately identified, the heading angle estimation is performed in the subsequent step.
2. The fusion heading angle estimation method based on machine learning classification as claimed in claim 1, characterized in that: In step 1, the specific steps of using a magnetometer to measure the three-axis magnetic induction intensity and an accelerometer to measure the three-axis acceleration information and calculating the heading angle are as follows: Step 1.1: Use the built-in magnetometer and accelerometer of the smartphone to collect the three-axis magnetic induction intensity and three-axis acceleration values in the carrier coordinate system; The carrier coordinate system, i.e., the b system, is fixedly connected to the carrier, with its origin located at the center of mass of the carrier, and the three axes are represented as X, Y, and Z. The carrier coordinate system of the pedestrian navigation system is defined as the right-front-up coordinate system, with its X axis pointing to the right along the carrier's horizontal axis, its Y axis pointing forward along the carrier's horizontal axis, and its Z axis pointing vertically upward along the carrier. The three-axis magnetic induction intensity collected by the magnetometer in the b system is The three-axis acceleration collected by the accelerometer in the b system is (A x ,A y ,A z ); The navigation coordinate system, i.e., the n-system, adopts the geographic coordinate system, and the northeast celestial coordinate system is selected, that is, the X-axis points to the horizontal east, the Y-axis points to the horizontal north, and the Z-axis is perpendicular to the ground and upward along the vertical line; The carrier coordinate system and the navigation coordinate system do not coincide when pedestrians are walking. The coordinate system needs to be obtained through three rotations. Taking the rotation sequence ZXY as an example, the rotation around the X axis is the pitch angle θ, the rotation around the Y axis is the roll angle γ, and the rotation around the Z axis is the heading angle ψ. Initialize the attitude information of the mobile phone according to the acceleration sensor information, calculate the pitch angle θ and roll angle γ, where g is the gravitational acceleration. The specific calculation formula is as follows: After the n system is rotated by the ZXY axis, the b system is obtained, and the attitude matrix As shown below: The attitude transformation matrix from b system to n system is as follows: Since the heading angle does not participate in the conversion, the heading angle ψ is set to 0, and the three-axis magnetometer components in the n system are calculated using the measured values of the magnetometer in the b system. The conversion formula is as follows: Step 1.2: Calculate the heading angle ψ in the n frame based on the magnetometer measurement value in the b frame m ; Calculate the heading angle in the reference coordinate system according to formula (1.5), where ψ MD Indicates the local magnetic declination; 3. The fusion heading angle estimation method based on machine learning classification as claimed in claim 2, characterized in that: The step 2, using the three-axis angular velocity values measured by the gyroscope sensor to calculate the heading angle, specifically includes the following steps: Step 2.1: Use the gyroscope sensor to measure the three-axis angular velocity value (W x ,W y ,W z ) and quaternion method to solve the attitude transformation matrix; The quaternion is defined as follows: q=q0+q1·i+q2·j+q3·k (1.6) The quaternions satisfy the following relationship: The attitude transformation matrix from b system to n system represented by quaternion is as follows: Combining equations (1.3) and (1.8), we can get the relationship between quaternion and Euler angle: The differential equation for quaternion update is as follows: Step 2.2: Calculate the heading angle ψ based on the updated quaternion data above g ; 4. The fusion heading angle estimation method based on machine learning classification as claimed in claim 1, characterized in that: The step 4 is specifically as follows: according to the classification result of step 3, in a scenario without magnetic field interference, the heading angles obtained in step 1 and step 2 are fused by Kalman filtering to calculate the final heading angle, that is, executing step 4.1; in a scenario with magnetic field interference, the heading angle obtained by the gyroscope is selected as the final heading angle, that is, executing step 4.2; Step 4.1: Without magnetic field interference, the steps for heading angle estimation are as follows: Step 4.1.1: Convert the heading angle obtained by the gyroscope As the state equation, the heading angle obtained by the magnetometer is As the observation equation, the formula is as follows: Among them, H k represents the fusion heading, A and B represent the unit matrix, and w k represents a Gaussian component with a mean of 0 and a covariance of Q, v k Represents a Gaussian component with a mean of 0 and a covariance of R; Step 4.1.2: Prediction phase of Kalman filter fusion: Step 4.1.3: Correction phase of Kalman filter fusion: K k =P k - C T (CP k - C T +R) -1 (1.18) Step 4.1.4: The heading angle after the k-th step fusion is as follows: Step 4.2: Under magnetic field interference, use the gyro heading angle obtained in step 2 as the heading angle of the kth step. Among them, ψ k-1 is the heading angle of the k-1th step.
5. A fusion heading angle estimation system based on machine learning classification, characterized by Includes the following modules: Module 1 for calculating heading angle: Calculates heading angle by measuring the three-axis magnetic induction intensity and three-axis acceleration information; Module 2 for calculating heading angle: Calculates heading angle through the three-axis angular velocity information obtained by measurement; Magnetic field interference classification module: classifies whether the three-axis magnetic induction intensity data obtained by the heading angle calculation module 1 is interfered by the magnetic field; Final heading angle module: According to the classification results of the magnetic field interference classification module, in the scenario without magnetic field interference, the heading angles obtained by the heading angle calculation module 1 and the heading angle calculation module 2 are fused by Kalman filtering to calculate the final heading angle; in the scenario with magnetic field interference, only the heading angle obtained by the heading angle calculation module 2 is used to estimate the final heading angle; Support vector machine combined with principal component analysis is used to classify whether the magnetometer measurement data is interfered by the magnetic field, which includes an offline training stage and an online recognition stage. The specific steps of the offline training phase are as follows: Step 3.1.1: Collect inertial sensor data in environments with and without magnetic interference, use the data without magnetic interference as positive samples, the data with magnetic interference as negative samples, and record the labels corresponding to the data; Step 3.1.2: Perform data preprocessing to achieve data segmentation and discretization between steps; The heading angles calculated by the heading angle calculation module 1 and the heading angle calculation module 2 are divided into steps to determine the magnetometer heading angle ψ of each step of the pedestrian m and the gyro heading angle ψ g , assuming that the k-th step contains N sample points, the heading angles of the k-th step are: Step 3.1.3: Extract the data features contained in each step during walking, including: (1) the mean square value M of the magnetic field intensity at the kth step k ; (2) Standard deviation σ of the magnetic field intensity at step k m ; (3) The kth step magnetometer heading angle Gyro heading angle The absolute value of the difference ψ dif ; (4) skewness ske of the k-th step magnetic field intensity; (5) kurtosis kur of the k-th step magnetic field intensity; (6) square root of the difference between the k-th step magnetometer heading angle energy and the k-th step gyroscope heading angle energy E dif ; (7) The heading deviation of the magnetometer between two adjacent steps Δψ m Gyro heading deviation Δψ g The absolute value of the difference between the two steps Δψ; (8) The absolute value of the difference between the energy of the magnetic field signal between two adjacent steps ΔE m ; Step 3.1.4: According to the extracted data features and their corresponding labels, the principal component analysis method is used to reduce the dimension of the prediction space, and then the support vector machine classifier is trained; the processed data features and their corresponding labels are input into the classifier for training, and the label is label = 0 when there is no magnetic interference, and the label is label = 1 when there is magnetic interference; finally, a classification model based on the support vector machine combined with the principal component analysis method is output for the presence or absence of magnetic field interference; The specific steps of the online identification stage are as follows: Step 3.2.1: Use a smart terminal with built-in inertial sensors to collect three-axis accelerometer, three-axis magnetometer and three-axis gyroscope data in real time in the actual environment; the way pedestrians carry the smart terminal is consistent with the training stage; Step 3.2.2: Preprocess the collected data to achieve data segmentation and discretization between steps; Step 3.2.3: Extract the data features in each step. The feature types are consistent with those in step 3.1.
3. Step 3.2.4: The features extracted in real time after principal component analysis are used as the input of the SVM classifier trained in the offline stage, and the data label is used as the output of the classifier to identify whether there is magnetic field interference; online identification is used to verify whether the trained support vector machine classifier can accurately identify magnetic field interference. If it cannot be accurately identified, the classifier needs to be retrained; if it can be accurately identified, the heading angle estimation is performed in the subsequent step.
