Course estimation method and related device

By integrating positioning system heading with magnetic heading in a filtering model and optimizing error covariance, the method improves the accuracy of heading estimation in smartphones, addressing magnetic interference challenges.

CN119223273APending Publication Date: 2024-12-31GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310801482.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing heading estimation methods in smartphones, relying on gyroscopes, gravimeters, and magnetometers, suffer from significant accuracy limitations due to magnetic interference, particularly in areas with large changes, leading to large deviations in heading estimation.

Method used

A method that integrates the magnetic heading with a positioning system heading as an observation quantity in a filtering model, adjusting error covariance and observation noise, using quaternion conversions to optimize the filtering model for improved accuracy.

Benefits of technology

Enhances the accuracy of heading estimation by offsetting magnetic interference, allowing for more precise heading determination across various environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119223273A_ABST
    Figure CN119223273A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a course estimation method and a related device. The method comprises the following steps: determining a magnetic course and a first attitude angle represented by a roll angle, a pitch angle and the magnetic course based on the roll angle, the pitch angle and a magnetic intensity measurement value of electronic equipment; acquiring the course of a positioning system of the electronic equipment, and replacing the magnetic course with the course of the positioning system to obtain a second attitude angle; performing quaternion conversion on the first attitude angle to obtain a first quaternion, and performing quaternion conversion on the second attitude angle to obtain a second quaternion; the first quaternion and the second quaternion serve as input data of a filtering model, state variables of the filtering model and error covariance of observation noise are adjusted, and a target filtering model is obtained; and determining the course of the electronic equipment according to the target filtering model. Therefore, by introducing the course of the positioning system, and taking the course and the magnetic course as the observed quantity of the filtering model, optimization and adjustment of the filtering model are realized, and further the course estimation precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a heading estimation method and related devices. Background Art

[0002] With the continuous update and upgrade of smartphones, more and more functions are available to users, and heading estimation is one of them. In actual application scenarios, smartphones mostly use multi-sensor fusion heading estimation algorithms based on gyroscopes, gravimeters and magnetometers. Regardless of whether it is a magnetic heading algorithm that relies only on magnetometers and accelerometers, or an algorithm that focuses on gyroscope integration, the accuracy of its absolute heading estimation is greatly limited by the accuracy of the magnetic vector. For areas with large changes in magnetic interference, the heading obtained by the above algorithm has a large deviation.

[0003] Therefore, there is an urgent need for a heading estimation method that solves the above problems. Summary of the invention

[0004] The embodiments of the present application provide a heading estimation method and related devices, which can achieve the optimization and adjustment of the filtering model and thus improve the accuracy of heading estimation by introducing the heading of the positioning system and using it together with the magnetic heading as the observation quantity of the filtering model.

[0005] In a first aspect, an embodiment of the present application provides a heading estimation method, which is applied to an electronic device, and the method includes:

[0006] Determining a magnetic heading and a first attitude angle of the electronic device based on a roll angle, a pitch angle, and a magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle, and the magnetic heading;

[0007] Acquire a positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device;

[0008] Performing quaternion conversion on the first posture angle to obtain a first quaternion, and performing quaternion conversion on the second posture angle to obtain a second quaternion;

[0009] Using the first quaternion and the second quaternion as input data of a filtering model, adjusting the error covariance of the state variable and the observation noise of the filtering model, and obtaining a target filtering model;

[0010] Determining attitude angle data according to the target filtering model;

[0011] The heading of the electronic device is determined according to the attitude angle data.

[0012] In a second aspect, an embodiment of the present application provides a heading estimation device, which is applied to an electronic device, and the device includes: a determination unit, an acquisition unit, a conversion unit and an input unit, wherein:

[0013] The determining unit is used to determine the magnetic heading and a first attitude angle of the electronic device based on the roll angle, the pitch angle and the magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle and the magnetic heading;

[0014] The acquisition unit is used to acquire the positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device;

[0015] The conversion unit is used to perform quaternion conversion on the first posture angle to obtain a first quaternion, and perform quaternion conversion on the second posture angle to obtain a second quaternion;

[0016] The input unit is used to use the first quaternion and the second quaternion as input data of a filtering model, adjust the error covariance of the state variable of the filtering model and the observation noise, and obtain a target filtering model;

[0017] The determination unit is further used to determine the attitude angle data according to the target filtering model;

[0018] The determination unit is further used to determine the heading of the electronic device according to the attitude angle data.

[0019] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.

[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.

[0022] It can be seen that in the embodiment of the present application, the magnetic heading and the first attitude angle are determined based on the roll angle, pitch angle and magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, pitch angle and magnetic heading; the positioning system heading of the electronic device is obtained, and the magnetic heading representing the first attitude angle is replaced with the positioning system heading to obtain the second attitude angle; the first attitude angle is converted into a quaternion to obtain a first quaternion, and the second attitude angle is converted into a quaternion to obtain a second quaternion; the first quaternion and the second quaternion are used as input data of the filtering model, and the error covariance of the state variables and the observation noise of the filtering model are adjusted to obtain the target filtering model; according to the target filtering model, the attitude angle data is determined; according to the attitude angle data, the heading of the electronic device is determined. In this way, it can be achieved that by introducing the heading of the positioning system and the magnetic heading as the observed quantity of the filtering model together, the filtering model can be optimized and adjusted, thereby improving the accuracy of the heading estimation. Moreover, in the magnetic interference area, the influence of magnetic interference can be offset by adjusting the weight of the heading observation of the positioning system in the filter model, so that the heading estimation is more accurate and has a wider range of application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1A It is a schematic diagram of internal modules of an electronic device of a heading estimation system provided by an embodiment of the present application;

[0025] Figure 1B This is a schematic diagram of data flow of an electronic device provided in an embodiment of the present application;

[0026] Figure 1C This is a schematic diagram of a scenario for estimating the heading of an electronic device provided in an embodiment of the present application;

[0027] Figure 2 It is a flowchart of a heading estimation method provided by an embodiment of the present application;

[0028] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0029] Figure 4 It is a block diagram of the functional units of a heading estimation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0031] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0032] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0033] The electronic device may be a portable electronic device that also includes other functions such as a personal digital assistant and / or a music player function, such as a mobile phone, a tablet computer, a wearable electronic device with a wireless communication function (such as a smart watch, smart glasses, a smart helmet), a vehicle-mounted device, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with an IOS system, an Android system, a Microsoft system, or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer (Laptop), etc. It should also be understood that in some other embodiments, the above-mentioned electronic device may also be an electronic device in the present application scheme.

[0034] Figure 1A A schematic diagram showing the internal modules of an electronic device of a heading estimation system to which the present application is applicable, which electronic device may be Figure 1A The electronic device 100 may specifically include the following modules: a data acquisition module 101, a data processing module 102, a filtering processing module 103, and the like.

[0035] For example, in practical applications, the electronic device composed of the above modules, its internal structure and data processing flow can be found in Figure 1B , Figure 1B A schematic diagram of data flow of an electronic device provided in an embodiment of the present application.

[0036] Specifically, Figure 1B As shown, the data acquisition module 101 may specifically include: Figure 1B The sensor part commonly used in the inertial navigation of the electronic device shown. Among them, the sensor part can be used to measure the attitude, motion state and environmental information of the device, including but not limited to: gyroscope, accelerometer and magnetometer. The data collected by the gyroscope, accelerometer and magnetometer usually have three-axis acceleration, angular velocity and magnetic field intensity components, and the units of the sampling values ​​vary according to the sensor type and application scenario. In practical applications, it is necessary to use the measurement results of these sensors in combination to perform tasks such as motion state estimation and attitude estimation. The following introduces the sampling value representation of the gyroscope, accelerometer and magnetometer respectively:

[0037] Gyroscope sampling value: Gyroscopes are usually used to measure the angular velocity of a device. Its sampling value represents the angular velocity of the device in three axes. For example, for a three-axis gyroscope, it can collect angular velocity values ​​in the x-axis, y-axis, and z-axis directions, which are represented by w and z, respectively. x 、w y and w z The sampling value unit is usually degrees / second or radians / second.

[0038] Accelerometer sampling value: Accelerometers are usually used to measure the acceleration of a device. In inertial navigation, they are often used to estimate the position and velocity of a device. Its sampling value represents the acceleration of the device in three axes. For example, for a three-axis accelerometer, it can measure the acceleration values ​​in the x-axis, y-axis, and z-axis directions, which are expressed as a x 、a y and a z The sampling value unit is usually m / s 2 Or g (acceleration due to gravity).

[0039] Magnetometer sampling value: Magnetometers are usually used to measure the magnetic field strength of the earth, thereby providing directional information about the environment in which the device is located. Its sampling value represents the magnitude of the magnetic field strength of the device in three axes. For example, for a three-axis magnetometer, it can measure the magnetic field strength values ​​in the x-axis, y-axis, and z-axis directions, expressed as m respectively. x 、m y and m z The sampling value unit is usually Gauss or Tesla.

[0040] In the present application, in addition to acquiring initial measurement data through the hardware of the sensor part, the data acquisition module 101 also introduces the following Figure 1B The azimuth error compensator (AEC) in the positioning system GPS shown in the figure is used to collect ACC data. It is a technology used to correct the heading angle error measured by the GPS receiver. Generally, the GPS receiver can provide the longitude, latitude and altitude information of the device, but it cannot directly provide the direction information of the device relative to the true north or magnetic north. Therefore, in practical applications, some technical means are needed to estimate the direction information of the device. One of the methods is to use an accelerometer (ACC) to obtain the motion state of the device, thereby inferring the direction information of the device. Specifically, ACC can compare the measured heading angle with the actual direction information to determine the error value, and correct the direction information of the device, thereby improving the accuracy and reliability of the GPS navigation system. ACC can provide the acceleration information of the device in three axes, which can be used to infer the attitude information of the device, and then obtain the direction information of the device relative to the true north or magnetic north. ACC can improve the accuracy and reliability of the GPS navigation system by correcting the measured heading angle.

[0041] Furthermore, the data processing module 102 receives the initial measurement data from the data acquisition module 101 and processes the data by Figure 1B The low-pass filtering shown in the figure realizes the preprocessing of the initial measurement data. Then, according to the preprocessed data, the first attitude angle and the second attitude angle of the electronic device are calculated according to the data obtained by the sensor part and the data obtained by the GPS, and then the first attitude angle and the second attitude angle are converted into quaternions respectively to obtain the corresponding first quaternion and the second quaternion respectively.

[0042] Furthermore, the filtering processing module 103 includes: Figure 1B In the filter model shown, the filter processing module 103 first receives the first quaternion and the second quaternion partially transmitted from the data processing module 102, and updates the filter model according to the received data to obtain the target filter model. Then, the electronic device obtains the current attitude angle data according to the target filter model, and performs matrix conversion on the attitude angle data to obtain the final electronic device heading.

[0043] Specifically, see Figure 1C , Figure 1C FIG. 1 is a schematic diagram of a scenario of electronic device heading estimation provided by an embodiment of the present application. In this flat end scenario, when a user holds an electronic device and moves along a certain direction at a certain speed, the electronic device moves along a certain direction at a certain speed. Figure 1BThe built-in gyroscope, accelerometer, magnetometer and other sensors and positioning system shown in the figure collect data, and then use Figure 1A The data acquisition module 101 shown determines the posture of the electronic device in three-dimensional space by collecting the initial measurement data generated when the user uses the electronic device while traveling, and calculates it through the data processing module 102 and the filtering processing module 103. The posture is expressed as the angle of the electronic device relative to different directions in the three-dimensional space, and then the heading of the electronic device is determined according to the calculated posture.

[0044] It should be noted that the accuracy of the mobile phone's heading estimation is affected by many factors, such as sensor noise, the accuracy of the filtering model, etc. Therefore, the present application scheme is optimized and adjusted for different scenarios and needs in practical applications. By introducing the heading of the positioning system and the magnetic heading as the observation quantity of the filtering model, the filtering model can be optimized and adjusted to improve the accuracy of the heading estimation. In addition, in the magnetic interference area, the weight of the positioning system heading observation in the filtering model can be adjusted to offset the influence of magnetic interference, so that the heading estimation is more accurate and has a wider range of applications.

[0045] In order to better understand the solution of the present application, the solution will be described in detail below.

[0046] See also Figure 2 , Figure 2 is a flow chart of a heading estimation method provided by an embodiment of the present application, which is applied to electronic devices such as Figure 2 As shown, the heading estimation method includes the following operations.

[0047] S201. Determine a magnetic heading and a first attitude angle of the electronic device based on a roll angle, a pitch angle, and magnetic intensity measurement values ​​of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle, and the magnetic heading.

[0048] Exemplarily, the present application scheme uses the 2-1-3 rotation method as an example to calculate the magnetic heading. Specifically, the 2-1-3 rotation method is a method of describing the rotation of an object in three-dimensional space, also known as Euler angles, where 2-1-3 represents rotation around the Z axis of a fixed coordinate system, around the X axis of a fixed coordinate system, and around the Y axis of a fixed coordinate system. It is a combination of three rotation angles that can be used to describe the direction and posture of an object in space.

[0049] Exemplarily, assuming that an object is in the same direction as the coordinate system at the initial moment, the rotation order is as follows: rotate an angle around the Z axis of the fixed coordinate system to obtain a temporary coordinate system; rotate an angle around the X axis of the temporary coordinate system to obtain a new temporary coordinate system; rotate an angle around the Y axis of the new temporary coordinate system to finally obtain the orientation of the object.

[0050] Specifically, electronic equipment Figure 1B The initial measurement data collected by the sensor part in the data acquisition module 101 is subjected to a series of preprocessing by the data processing module 102 to obtain the target data, and the magnetic heading, roll angle, and pitch angle of the electronic device are determined according to the target data, and the first attitude angle of the electronic device is characterized by the roll angle, pitch angle, and magnetic heading. Among them, the first attitude angle of the electronic device obtained in the 2-1-3 rotation mode includes the roll angle, pitch angle, and magnetic heading.

[0051] It should be noted that in practical applications, other rotation methods of Euler angles can also be used to calculate the magnetic heading of the electronic device. The 2-1-3 rotation method of the present application example can effectively avoid problems such as universal joint lock due to the characteristics of its rotation sequence, thereby improving the accuracy and reliability of motion control.

[0052] S202: Acquire a positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device.

[0053] Exemplarily, when the positioning system GPS is available, the electronic device replaces the magnetic heading obtained in step S201 with the positioning system heading measured in the GPS system, and thus obtains a second attitude angle introduced under the positioning system heading by combining it with the roll angle, pitch angle and positioning system heading calculated in step S201.

[0054] S203 , performing quaternion conversion on the first posture angle to obtain a first quaternion, and performing quaternion conversion on the second posture angle to obtain a second quaternion.

[0055] Specifically, attitude angle and quaternion are both mathematical models that describe the rotation state of an object in space, and they can be converted to each other. Quaternion (Quaternion, Q) is a complex number used to describe rotation, which contains a scalar part and three vector parts, and can be used to represent the rotation attitude in three-dimensional space.

[0056] For example, the quaternion Q can be expressed as Q=q0+q1i+q2j+q3k, where q0, q1, q2 and q3k are all real numbers, and i, j, k are three imaginary units. The quaternion can be expressed as a function of the rotation vector and the rotation angle, that is, Q(θ,u), where θ is the rotation angle and u is the rotation axis.

[0057] Specifically, the attitude angle is converted into quaternion form according to the formula: Q = cos (θ / 2) + (sin (θ / 2) * u x )i+(sin(θ / 2)*u y )j+(sin(θ / 2)*u z )k. Among them, θ is the rotation angle, u x 、u y 、u z is the component of the rotation vector on the x, y, and z axes. For example, if the object rotates 60 degrees around the x axis, the corresponding quaternion is expressed as: Q = cos30° + sin30° * i. Where i represents the unit vector of the object rotating around the x axis.

[0058] It should be noted that the quaternions corresponding to different attitude angles may be different. Therefore, in actual application, we need to select the appropriate attitude angle representation method according to the specific problem scenario and coordinate system to ensure the accuracy and consistency of the calculation.

[0059] Exemplarily, the electronic device performs quaternion conversion processing according to the first attitude angle and the second attitude angle data acquired in steps S201-S202, and obtains the first quaternion corresponding to the first attitude angle, respectively, with q m Represented by; and the second quaternion corresponding to the second attitude angle, q GPS express.

[0060] S204: Use the first quaternion and the second quaternion as input data of a filtering model, adjust the error covariance of the state variables and the observation noise of the filtering model, and obtain a target filtering model.

[0061] For example, Figure 1B As shown in the internal module diagram of the electronic device, the filtering processing module 103 includes a filtering model. The electronic device uses the first quaternion and the second quaternion obtained by step S203 as the observation input data of the filtering model, thereby adjusting the error covariance of the observation noise of the state variable of the filtering model, and updating the filtering model to obtain the target filtering model. At this time, the positioning system heading is introduced as input data in the state update process of the target filtering model, and is used together with the magnetic heading as the observation of the filtering model to optimize and adjust the filtering model, thereby improving the accuracy of the heading estimation.

[0062] S205: Determine attitude angle data according to the target filtering model.

[0063] Furthermore, the electronic device obtains attitude angle data of the fused navigation system relative to the electronic device system according to the target filtering model, wherein the attitude angle data is a quaternion.

[0064] S206: Determine the heading of the electronic device according to the attitude angle data.

[0065] Furthermore, the obtained attitude angle data is inverted by quaternion, and converted into the attitude angle according to the 2-1-3 rotation method described in step S201, so as to obtain the fused mobile phone heading.

[0066] It can be seen that through the example of this application, the electronic device determines the magnetic heading and the first attitude angle based on the roll angle, pitch angle and magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, pitch angle and magnetic heading; obtains the positioning system heading of the electronic device, and replaces the magnetic heading representing the first attitude angle with the positioning system heading to obtain the second attitude angle; performs quaternion conversion on the first attitude angle to obtain the first quaternion, and performs quaternion conversion on the second attitude angle to obtain the second quaternion; uses the first quaternion and the second quaternion as the input data of the filtering model, adjusts the error covariance of the state variables and the observation noise of the filtering model, and obtains the target filtering model; determines the attitude angle data according to the target filtering model; determines the heading of the electronic device according to the attitude angle data. In this way, it can be achieved that by introducing the heading of the positioning system and the magnetic heading as the observed quantity of the filtering model, the filtering model can be optimized and adjusted, thereby improving the accuracy of the heading estimation. Moreover, in the magnetic interference area, the influence of magnetic interference can be offset by adjusting the weight of the heading observation of the positioning system in the filter model, so that the heading estimation is more accurate and has a wider range of application.

[0067] In a possible example, the magnetic heading and the first attitude angle of the electronic device are determined based on the roll angle, pitch angle and magnetic intensity measurement values ​​of the electronic device, and the method also includes the following steps: acquiring initial measurement data; performing moving mean filtering on the initial measurement data to obtain target data; calculating according to the target data to obtain value groups corresponding to the magnetic heading, the roll angle and the pitch angle, respectively; and determining the first attitude angle according to the value groups.

[0068] Exemplarily, the electronic device acquires the initial measurement data described in step S201, wherein the initial measurement data includes gyroscope measurement data, accelerometer measurement data, magnetometer measurement data, and measurement data corresponding to the GPS system.

[0069] Furthermore, by moving mean filtering, the present application solution can take a group of 10 data to obtain the mean value. The initial measurement data is preprocessed to obtain the target data.

[0070] Furthermore, the magnetic heading is calculated based on the target data to obtain corresponding values ​​of the magnetic heading, roll angle, and pitch angle.

[0071] For example, considering a simple scenario where the pedestrian has no acceleration (uniform speed / stationary), the following relationship can be obtained:

[0072]

[0073] Among them, b represents the mobile phone system; n represents the navigation system, and the ENU coordinate system is selected here; It represents the rotation matrix from the navigation system to the local system; G represents the gravitational acceleration of the local system; g represents the local gravitational acceleration.

[0074] Exemplarily, the ENU coordinate system: The ENU coordinate system is a local tangent coordinate system used to represent spatial data related to a geographic location. In the ENU coordinate system, E stands for East, N stands for North, and U stands for Up. It is a right-handed coordinate system, often used in geographic information systems (GIS) and navigation, with its origin usually set at a specific geographic location (such as an observation station), and the local horizontal plane at this location is used as the reference plane. The ENU coordinate system is different from the geographic coordinate system because it is a Cartesian coordinate system, while the geographic coordinate system is a spherical coordinate system.

[0075] For example, when the 2-1-3 rotation method is adopted, there are:

[0076]

[0077] Where θ is the roll angle (rotation around the y-axis), γ is the pitch angle (rotation around the x-axis), is the heading angle (rotation around the z axis).

[0078] From equations (1) and (2), we can get:

[0079]

[0080] Furthermore, combined with the magnetometer, the following conversion formula is obtained:

[0081]

[0082] Where M is the magnetometer measurement value; B is the reference vector of the ENU coordinate system, which can be obtained by table lookup or IGRF calculation; and Transpose each other.

[0083] Furthermore, by combining equations (2), (3) and (4), we can get the magnetic heading:

[0084] Furthermore, the above roll angle θ, pitch angle γ and magnetic heading are combined Get the first attitude angle

[0085] Furthermore, if the positioning system is available, the positioning system heading measured by the positioning system is obtained, and the magnetic heading is converted to Replaced with positioning system heading Get the second attitude angle

[0086] It can be seen that through the example of this application, the electronic device calculates the magnetic heading and the first attitude angle respectively after performing mobile filtering on the initial measurement data. The mobile filtering process can effectively filter out some data with large fluctuations to improve the accuracy of the calculation.

[0087] In a possible example, the method also includes the following steps: constructing a state equation, wherein the state equation is used to characterize the iterative relationship between the state variables at consecutive moments; initializing the state variables according to the second quaternion; constructing an error quaternion state equation according to the state equation, wherein the error quaternion state equation is used to predict the state variables at the current moment according to the input data at the previous moment; constructing a measurement equation according to the error quaternion state equation, wherein the measurement equation is used to characterize the relationship between the input data and the state variables; combining the state equation, the error quaternion state equation and the measurement equation to obtain the filtering model.

[0088] Exemplarily, the electronic device constructs the state equation based on a pre-established gyroscope model and a kinematic equation of a quaternion.

[0089] For example, a gyroscope model is first established:

[0090]

[0091] Among them, w b is the true value of the carrier angular velocity; b g is the gyro zero bias; v a With v r is uncorrelated Gaussian white noise.

[0092] Furthermore, the kinematic equation based on quaternion is:

[0093]

[0094] Take the state variable as [qT b T ]T, then the state equation is:

[0095]

[0096] Furthermore, in the present application, in order to accelerate the convergence of the model, the quaternion in the state variable can be replaced by the first quaternion q m Initialize the state.

[0097] Furthermore, the electronic device establishes the error quaternion state equation based on equation (7):

[0098]

[0099] Among them, △q represents the difference between the theoretical quaternion and the estimated quaternion, △q v represents the vector part of the error quaternion △q; △b represents the difference between the theoretical gyro bias and the estimated gyro bias.

[0100] Furthermore, the electronic device determines the corresponding measurement equation based on the above formula (8):

[0101] Δy=Δq v +v s =[I 3*3 0 3*3 ] (9)

[0102] Among them, v s To measure noise.

[0103] Furthermore, the state equation, the error quaternion state equation and the measurement equation are combined to obtain a filtering model.

[0104] It can be seen that in this example, a filter model for filtering is constructed to analyze the second quaternion after the fusion positioning system heading and the first quaternion obtained by the initial measurement data, and the filter model is optimized according to the iterative calculation process to obtain the target filter model. The attitude angle and heading of the electronic device are determined by the optimized target filter model. While improving the accuracy of heading estimation, considering that in the magnetic interference area, the weight of the positioning system heading observation in the filter model can be adjusted to offset the influence of magnetic interference, so that the heading estimation is more accurate and has a wider range of applications.

[0105] In a possible example, the method for constructing the state equation specifically includes the following steps: obtaining error parameters of the gyroscope, wherein the error parameters include zero bias parameters of the gyroscope and white noise parameters in a process of measuring data by the gyroscope; constructing a gyroscope model according to the error parameters, wherein the gyroscope model is used to predict the angular velocity of the electronic device; and constructing the state equation according to the gyroscope model and the kinematic equation of the quaternion.

[0106] Specifically, the gyroscope model refers to the modeling and analysis of various errors contained in the gyroscope measurement data in order to more accurately obtain the true rotation angular velocity information. Generally speaking, the gyroscope measurement data contains many error sources, and the error parameters include but are not limited to: the gyroscope's zero bias parameter, that is, the error of the gyroscope outputting a non-zero value when it is stationary, and the white noise parameter during the measurement process, that is, the error of the gyroscope output signal with random walks. These errors will affect the accuracy and stability of the gyroscope, so they need to be modeled and corrected.

[0107] Exemplarily, the electronic device obtains the error parameters of the gyroscope and constructs a gyroscope model according to the error parameters to obtain the gyroscope model as shown in the above formula (5).

[0108] Furthermore, the state equation (7) is constructed by combining the above equation (5) and the kinematic equation of the quaternion (6), wherein the kinematic equation of the quaternion refers to a mathematical equation that uses quaternions to describe the rotation of an object, thereby calculating the change of the object's posture and angular velocity in space.

[0109] It can be seen that in this example, the electronic device constructs a gyroscope model and constructs a state equation for state prediction based on the kinematic equation of the gyroscope model and the quaternion. This is to achieve a mathematical model for modeling and analyzing various errors contained in the gyroscope measurement data. By modeling and correcting the errors, the accuracy and stability of the gyroscope measurement data can be improved, so that the true rotation angular velocity information can be obtained more accurately.

[0110] In one possible example, before using the first quaternion and the second quaternion as input data of the filtering model, the method may also include the following steps: calculating the state variables at the current moment according to the state equation, wherein the state variables include the position variables and the gyroscope zero bias variables; and calculating the covariance error matrix corresponding to the state variables at the current moment according to the state variables at the current moment.

[0111] For example, the electronic device predicts the state variable through the state equation, that is, through the historical observation data (that is, the state variable q corresponding to the previous moment) k / k-1 ,b k / k-1) estimates the current state, and uses the difference (covariance) between the current estimate and the measured data to minimize the prediction error of the future state variable. Specifically, the electronic device recursively obtains the current state quantity q by formula (7): k / k-1 ,b k / k-1 , and the corresponding covariance error matrix is ​​calculated by the following formula (10):

[0112]

[0113] in,

[0114] For example, state prediction is to predict the state at the current moment based on the state at the previous moment, without involving observations. P is the covariance error matrix representation of x (state variable), that is, P k|k-1 represents the last moment P k|k-1 When it happens, P will appear at the next moment. k is the state variable, Q is the variance matrix of the observation noise used for error adjustment.

[0115] It can be seen that in this example, the state equation is used to recursively predict the state variables at the current moment to obtain the predicted value. Furthermore, the covariance error matrix is ​​calculated based on the predicted state variables to update the covariance error, so as to continuously reduce the prediction deviation and improve the prediction accuracy.

[0116] In one possible example, the target data includes measurement data corresponding to a magnetometer of the electronic device; after calculating the state variable at the current moment according to the state equation, the following steps may be included: determining a measurement vector modulus according to the measurement data; obtaining local magnetic field data of the magnetic field in which the electronic device is located; determining a local magnetic vector modulus according to the local magnetic field data; if the difference between the measurement vector modulus and the local magnetic vector modulus is less than a second preset threshold, determining a first measurement value corresponding to a first error state according to the measurement vector modulus and the local magnetic vector modulus, wherein the first measurement value is used to characterize the error between the predicted state variable output by the state equation and the first quaternion.

[0117] Exemplarily, after constructing the filtering model, the electronic device optimizes the model through the following steps: by initializing the state vector and the state covariance matrix, in order to accelerate the convergence of the model in the present application scheme, the first quaternion q m To initialize the state vector. According to the state equation, perform state prediction, that is, obtain the predicted state variables at the next moment; according to the measurement equation, perform state update; loop through the state prediction and state update steps to update the state vector and covariance matrix to obtain the final target filter model.

[0118] Exemplarily, when the difference between the measured vector modulus value measured by the electronic device magnetometer and the local magnetic vector modulus value where the electronic device is located is less than the second preset threshold, that is, when the deviation between the measured magnetic field data and the local actual magnetic field data is small, the first quaternion q can be obtained according to formula (11): m A first measurement value corresponding to the first error state.

[0119]

[0120] in, Represents quaternion multiplication.

[0121] It can be seen that in this example, the electronic device obtains the first quaternion through target data, including data measured by a gyroscope, a magnetometer, and an accelerometer, and inputs it into the filtering model as a new observation. In this way, the algorithm process can be simplified and the influence of external acceleration other than gravity in the accelerometer can be reduced.

[0122] In a possible example, after calculating the state variable at the current moment according to the state equation, the method specifically includes the following steps: calculating a second measurement value corresponding to a second error state according to the state variable at the current moment and the second quaternion, wherein the second measurement value is used to characterize the error between the predicted state variable output by the state equation and the second quaternion.

[0123] Exemplarily, in the solution of the present application, when it is determined that the GPS is valid, that is, the positioning accuracy is greater than a first preset threshold, and at the same time, the moving speed of the electronic device is greater than 1 m / s, it indicates that the electronic device is in a moving state.

[0124] Furthermore, the electronic device calculates a second measurement value corresponding to the second error state according to the second quaternion calculated in step S203.

[0125] The specific calculation method is to convert the second quaternion q GRS Substituting the first quaternion q in formula (11) m , to calculate the second measurement value corresponding to the second quaternion.

[0126] It can be seen that through the example of this application, the electronic device introduces the positioning system heading, and when the electronic device is in a moving state, it is input into the filtering model together with the magnetic heading as a new observation quantity. In this way, the estimation accuracy of the attitude angle of the electronic device by the filtering model can be improved, and in the magnetic interference area, the weight of the positioning system heading observation quantity in the filtering model can be adjusted to offset the influence of magnetic interference, so that the absolute heading estimation is more accurate and has a wider range of applications.

[0127] In a possible example, the method may include the following steps: updating the filtering model according to the covariance error matrix and the first measurement value; and / or updating the filtering model according to the covariance error matrix and the second measurement value.

[0128] Exemplarily, the electronic device updates and optimizes the filtering model according to the first measurement value and the second measurement value respectively calculated according to formula (11).

[0129] Exemplarily, the specific state update calculation process includes:

[0130]

[0131]

[0132]

[0133] Among them, formula (14) uses the predicted value of the prediction process, Δy is the deviation between the predicted value and the actual estimated value, and k is a compensation factor, thereby obtaining the final estimated state variable value x.

[0134] The following formula (15) can be used to obtain the attitude quaternion of the fused navigation system, i.e., the GPS system, relative to the mobile phone system. The quaternion is inverted and converted into the attitude angle using the 2-1-3 method to obtain the fused mobile phone heading.

[0135]

[0136] b k =b k / k-1 +Δb k (15)

[0137] It can be seen that in the example of this application, the electronic device performs state prediction according to the state equation in the filter model to obtain the predicted state variable at the next moment; then, according to the measurement equation, the state is updated and the covariance matrix corresponding to the predicted state variable is obtained, and then the state prediction and state update steps are executed cyclically to update the state vector and the covariance matrix to obtain the final target filter model. In the process of multiple state predictions and state updates, the estimation accuracy of the target filter model is improved to better provide heading estimation services for the electronic device.

[0138] In a possible example, the updating of the filtering model may include the following steps: determining whether the first measurement value and the second measurement value are available; if both the first measurement value and the second measurement value are available, updating the filtering model using a first target matrix combination; if the first measurement value or the second measurement value is available, updating the filtering model using a second target matrix combination; if both the first measurement value and the second measurement value are unavailable, updating the filtering model using the state prediction variable output by the state equation.

[0139] For example, when the electronic device updates and optimizes the model state according to formula (12) to formula (14), it should be noted that the electronic device needs to determine q GPS ,q m Whether the first measurement value and the second measurement value respectively corresponding to each other meet the conditions for use.

[0140] Exemplarily, when both the first measurement value and the second measurement value are available, the values ​​of the H and R matrices are as follows:

[0141]

[0142] Exemplarily, when only one measurement value is available, the H and R matrices take the following values:

[0143] H=[I 3*3 0 3*3 ],

[0144] For example, when both the first measurement value and the second measurement value are unavailable, the state is not updated by using formula 1 to 2, but the predicted state variable, that is, the predicted output x at the next moment is used. k / k-1 Replace x k , with P k / k-1 Replace P k When necessary, usually set v GPS The main diagonal value is relative to v m An order of magnitude smaller.

[0145] It can be seen that in the example of this application, by fusing the heading of the positioning system and the target data, a more accurate and reliable attitude, speed and position estimation result is obtained. The target data is used for kinematic attitude estimation, and the heading data is combined for correction and modification to obtain a more accurate attitude estimation result; the accelerometer measurement value of the target data and the GPS data are used for integral calculation to obtain information such as the state variables of the electronic device; and the state variables of the filter model are updated and the co-array is optimized to achieve the prediction accuracy of the heading estimation.

[0146] See also Figure 3, Figure 3 This is a structural diagram of an electronic device provided in an embodiment of the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface and one or more programs, which are applied to the electronic device in the scheme of the present application.

[0147] In a possible example, the one or more programs are stored in the memory, and the one or more programs are configured to cause the processor to execute the following steps:

[0148] Determining a magnetic heading and a first attitude angle of the electronic device based on a roll angle, a pitch angle, and a magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle, and the magnetic heading;

[0149] Acquire a positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device;

[0150] Performing quaternion conversion on the first posture angle to obtain a first quaternion, and performing quaternion conversion on the second posture angle to obtain a second quaternion;

[0151] Using the first quaternion and the second quaternion as input data of a filtering model, adjusting the error covariance of the state variable and the observation noise of the filtering model, and obtaining a target filtering model;

[0152] Determining attitude angle data according to the target filtering model;

[0153] The heading of the electronic device is determined according to the attitude angle data.

[0154] It can be seen that the electronic device described in the embodiment of the present application determines the magnetic heading and the first attitude angle based on the roll angle, pitch angle and magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, pitch angle and magnetic heading; obtains the positioning system heading of the electronic device, and replaces the magnetic heading representing the first attitude angle with the positioning system heading to obtain the second attitude angle; performs quaternion conversion on the first attitude angle to obtain the first quaternion, and performs quaternion conversion on the second attitude angle to obtain the second quaternion; uses the first quaternion and the second quaternion as input data of the filtering model, adjusts the error covariance of the state variables and observation noise of the filtering model, and obtains the target filtering model; determines the attitude angle data according to the target filtering model; determines the heading of the electronic device according to the attitude angle data. In this way, it can be achieved that by introducing the heading of the positioning system and the magnetic heading as the observed quantity of the filtering model together, the filtering model can be optimized and adjusted, thereby improving the accuracy of the heading estimation. Moreover, in the magnetic interference area, the influence of magnetic interference can be offset by adjusting the weight of the heading observation of the positioning system in the filter model, so that the heading estimation is more accurate and has a wider range of application.

[0155] In a possible example, the determining the magnetic heading and the first attitude angle of the electronic device based on the roll angle, the pitch angle and the magnetic intensity measurement value of the electronic device, the program includes instructions for executing the following steps:

[0156] Obtain initial measurement data;

[0157] Performing moving mean filtering on the initial measurement data to obtain target data;

[0158] Calculating according to the target data to obtain a value group corresponding to the magnetic heading, the roll angle, and the pitch angle;

[0159] The first attitude angle is determined according to the value group.

[0160] In one possible example, the above program includes instructions for executing the following steps:

[0161] Constructing a state equation, wherein the state equation is used to characterize an iterative relationship between the state variables at consecutive moments;

[0162] Initialize the state variable according to the second quaternion;

[0163] Constructing an error quaternion state equation according to the state equation, wherein the error quaternion state equation is used to predict the state variable at the current moment according to the input data at the previous moment;

[0164] Constructing a measurement equation according to the error quaternion state equation, wherein the measurement equation is used to characterize the relationship between the input data and the state variable;

[0165] The state equation, the error quaternion state equation and the measurement equation are combined to obtain the filtering model.

[0166] In one possible example, the state equation is constructed, and the program includes instructions for executing the following steps:

[0167] Acquire error parameters of the gyroscope, wherein the error parameters include zero bias parameters of the gyroscope and white noise parameters in a process of measuring data by the gyroscope;

[0168] constructing a gyroscope model according to the error parameter, wherein the gyroscope model is used to predict the angular velocity of the electronic device;

[0169] The state equation is constructed according to the gyroscope model and the kinematic equation of the quaternion.

[0170] In a possible example, before using the first quaternion and the second quaternion as input data of the filtering model, the program includes instructions for performing the following steps:

[0171] Calculating the state variables at the current moment according to the state equation, wherein the state variables include the position variables and the gyroscope zero bias variables;

[0172] According to the state variables at the current moment, a covariance error matrix corresponding to the state variables at the current moment is calculated.

[0173] In a possible example, the target data includes measurement data corresponding to a magnetometer of the electronic device;

[0174] After calculating the state variables at the current moment according to the state equation, the program includes instructions for executing the following steps:

[0175] Determining a measurement vector modulus value based on the measurement data;

[0176] Acquiring local magnetic field data of the magnetic field in which the electronic device is located;

[0177] Determine the local magnetic vector modulus value according to the local magnetic field data;

[0178] If the difference between the measured vector modulus and the local magnetic vector modulus is less than a second preset threshold, a first measurement value corresponding to a first error state is determined based on the measured vector modulus and the local magnetic vector modulus, wherein the first measurement value is used to characterize the error between the predicted state variable output by the state equation and the first quaternion.

[0179] In a possible example, after calculating the state variable at the current moment according to the state equation, the program includes instructions for executing the following steps:

[0180] A second measurement value corresponding to a second error state is calculated according to the state variable at the current moment and the second quaternion, wherein the second measurement value is used to characterize the error between the predicted state variable output by the state equation and the second quaternion.

[0181] In one possible example, the above program includes instructions for executing the following steps:

[0182] updating the filtering model according to the covariance error matrix and the first measurement value; and / or,

[0183] The filtering model is updated according to the covariance error matrix and the second measurement value.

[0184] In a possible example, the updating of the filtering model includes instructions for executing the following steps:

[0185] Determining whether the first measurement value and the second measurement value are available;

[0186] If both the first measurement value and the second measurement value are available, updating the filter model using a first target matrix combination;

[0187] If the first measurement value or the second measurement value is available, updating the filter model using a second target matrix combination;

[0188] If both the first measurement value and the second measurement value are unavailable, the filtering model is updated by the state prediction variable output by the state equation.

[0189] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0190] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0191] In the case of dividing each functional module into corresponding functional modules, Figure 4 A schematic diagram of a heading estimation device is shown. Figure 4 As shown, applied to electronic equipment, the heading estimation device 400 may include: a determination unit 401, an acquisition unit 402, a conversion unit 403 and an input unit 404, wherein:

[0192] The determining unit 401 is used to determine the magnetic heading and a first attitude angle of the electronic device based on the roll angle, the pitch angle and the magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle and the magnetic heading;

[0193] The acquisition unit 402 is configured to acquire a positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device;

[0194] The conversion unit 403 is used to perform quaternion conversion on the first posture angle to obtain a first quaternion, and perform quaternion conversion on the second posture angle to obtain a second quaternion;

[0195] The input unit 404 is used to use the first quaternion and the second quaternion as input data of a filtering model, adjust the error covariance of the state variable of the filtering model and the observation noise, and obtain a target filtering model;

[0196] The determining unit 401 is further used to determine the attitude angle data according to the target filtering model;

[0197] The determining unit 401 is further configured to determine the heading of the electronic device according to the attitude angle data.

[0198] It can be seen that the heading estimation device provided in the embodiment of the present application is applied to an electronic device, and the determination unit of the electronic device determines the magnetic heading and the first attitude angle based on the roll angle, pitch angle and magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, pitch angle and magnetic heading; the acquisition unit acquires the positioning system heading of the electronic device, and replaces the magnetic heading representing the first attitude angle with the positioning system heading to obtain the second attitude angle; the conversion unit performs quaternion conversion on the first attitude angle to obtain the first quaternion, and performs quaternion conversion on the second attitude angle to obtain the second quaternion; the processing unit uses the first quaternion and the second quaternion as input data of the filtering model, adjusts the error covariance of the state variable and the observation noise of the filtering model, and obtains the target filtering model; the determination unit determines the attitude angle data according to the target filtering model; the determination unit determines the heading of the electronic device according to the attitude angle data. In this way, it can be achieved that by introducing the heading of the positioning system and the magnetic heading as the observed quantity of the filtering model together, the filtering model can be optimized and adjusted, thereby improving the accuracy of the heading estimation. Moreover, in the magnetic interference area, the influence of magnetic interference can be offset by adjusting the weight of the heading observation of the positioning system in the filter model, so that the heading estimation is more accurate and has a wider range of application.

[0199] In a possible example, the determining the magnetic heading and the first attitude angle of the electronic device based on the roll angle, the pitch angle, and the magnetic intensity measurement value of the electronic device, the determining unit 401 is further used to:

[0200] Obtain initial measurement data;

[0201] Performing moving mean filtering on the initial measurement data to obtain target data;

[0202] Calculating according to the target data to obtain a value group corresponding to the magnetic heading, the roll angle, and the pitch angle;

[0203] The first attitude angle is determined according to the value group.

[0204] In a possible example, the conversion unit 403 is further used for:

[0205] Constructing a state equation, wherein the state equation is used to characterize an iterative relationship between the state variables at consecutive moments;

[0206] Initialize the state variable according to the second quaternion;

[0207] Constructing an error quaternion state equation according to the state equation, wherein the error quaternion state equation is used to predict the state variable at the current moment according to the input data at the previous moment;

[0208] Constructing a measurement equation according to the error quaternion state equation, wherein the measurement equation is used to characterize the relationship between the input data and the state variable;

[0209] The state equation, the error quaternion state equation and the measurement equation are combined to obtain the filtering model.

[0210] In a possible example, in constructing the state equation, the conversion unit 403 is further used for:

[0211] Acquire error parameters of the gyroscope, wherein the error parameters include zero bias parameters of the gyroscope and white noise parameters in a process of measuring data by the gyroscope;

[0212] constructing a gyroscope model according to the error parameter, wherein the gyroscope model is used to predict the angular velocity of the electronic device;

[0213] The state equation is constructed according to the gyroscope model and the kinematic equation of the quaternion.

[0214] In a possible example, before using the first quaternion and the second quaternion as input data of the filtering model, the conversion unit 403 is further used to:

[0215] Calculating the state variables at the current moment according to the state equation, wherein the state variables include the position variables and the gyroscope zero bias variables;

[0216] According to the state variables at the current moment, a covariance error matrix corresponding to the state variables at the current moment is calculated.

[0217] In a possible example, the target data includes measurement data corresponding to a magnetometer of the electronic device;

[0218] After calculating the state variable at the current moment according to the state equation, the conversion unit 403 is further used to:

[0219] Determining a measurement vector modulus value based on the measurement data;

[0220] Acquiring local magnetic field data of the magnetic field in which the electronic device is located;

[0221] Determine the local magnetic vector modulus value according to the local magnetic field data;

[0222] If the difference between the measured vector modulus and the local magnetic vector modulus is less than a second preset threshold, a first measurement value corresponding to a first error state is determined based on the measured vector modulus and the local magnetic vector modulus, wherein the first measurement value is used to characterize the error between the predicted state variable output by the state equation and the first quaternion.

[0223] In a possible example, after calculating the state variable at the current moment according to the state equation, the conversion unit 403 is further used to:

[0224] A second measurement value corresponding to a second error state is calculated according to the state variable at the current moment and the second quaternion, wherein the second measurement value is used to characterize the error between the predicted state variable output by the state equation and the second quaternion.

[0225] In a possible example, the conversion unit 403 is further used for:

[0226] updating the filtering model according to the covariance error matrix and the first measurement value; and / or,

[0227] The filtering model is updated according to the covariance error matrix and the second measurement value.

[0228] In a possible example, the updating of the filtering model, the conversion unit 403 is further configured to:

[0229] Determining whether the first measurement value and the second measurement value are available;

[0230] If both the first measurement value and the second measurement value are available, updating the filter model using a first target matrix combination;

[0231] If the first measurement value or the second measurement value is available, updating the filter model using a second target matrix combination;

[0232] If both the first measurement value and the second measurement value are unavailable, the filtering model is updated by the state prediction variable output by the state equation.

[0233] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0234] The electronic device provided in this embodiment is used to execute the above-mentioned heading estimation method, and thus can achieve the same effect as the above-mentioned implementation method.

[0235] In the case of using integrated units, the electronic device may include a processing module, a storage module and a communication module. Among them, the processing module can be used to control and manage the actions of the electronic device, for example, it can be used to support the electronic device to execute the steps performed by the above-mentioned determination unit 401, acquisition unit 402, conversion unit 403 and input unit 404. The storage module can be used to support the electronic device to execute stored program codes and data, etc. The communication module can be used to support the communication between the electronic device and other devices.

[0236] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, etc.

[0237] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0238] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.

[0239] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0240] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0241] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0242] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0243] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0244] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.

[0245] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.

[0246] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A heading estimation method, applied to an electronic device, characterized in that: Methods include: Determining a magnetic heading and a first attitude angle of the electronic device based on a roll angle, a pitch angle, and a magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle, and the magnetic heading; Acquire a positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device; Performing quaternion conversion on the first posture angle to obtain a first quaternion, and performing quaternion conversion on the second posture angle to obtain a second quaternion; Using the first quaternion and the second quaternion as input data of a filtering model, adjusting the error covariance of the state variable and the observation noise of the filtering model, and obtaining a target filtering model; Determining attitude angle data according to the target filtering model; The heading of the electronic device is determined according to the attitude angle data.

2. The method according to claim 1, characterized in that: The method of determining the magnetic heading and the first attitude angle of the electronic device based on the roll angle, the pitch angle and the magnetic intensity measurement value of the electronic device comprises: Obtain initial measurement data; Performing moving mean filtering on the initial measurement data to obtain target data; Calculating according to the target data to obtain a value group corresponding to the magnetic heading, the roll angle, and the pitch angle; The first attitude angle is determined according to the value group.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Constructing a state equation, wherein the state equation is used to characterize an iterative relationship between the state variables at consecutive moments; Initialize the state variable according to the second quaternion; Constructing an error quaternion state equation according to the state equation, wherein the error quaternion state equation is used to predict the state variable at the current moment according to the input data at the previous moment; Constructing a measurement equation according to the error quaternion state equation, wherein the measurement equation is used to characterize the relationship between the input data and the state variable; The state equation, the error quaternion state equation and the measurement equation are combined to obtain the filtering model.

4. The method according to claim 3, characterized in that The constructing of the state equation comprises: Acquire error parameters of the gyroscope, wherein the error parameters include zero bias parameters of the gyroscope and white noise parameters in a process of measuring data by the gyroscope; constructing a gyroscope model according to the error parameter, wherein the gyroscope model is used to predict the angular velocity of the electronic device; The state equation is constructed according to the gyroscope model and the kinematic equation of the quaternion.

5. The method according to claim 4, characterized in that Before using the first quaternion and the second quaternion as input data of the filtering model, the method further includes: Calculating the state variables at the current moment according to the state equation, wherein the state variables include the position variables and the gyroscope zero bias variables; According to the state variables at the current moment, a covariance error matrix corresponding to the state variables at the current moment is calculated.

6. The method according to claim 5, characterized in that The target data includes measurement data corresponding to the magnetometer of the electronic device; After calculating the state variable at the current moment according to the state equation, the method further includes: Determining a measurement vector modulus value based on the measurement data; Acquiring local magnetic field data of the magnetic field in which the electronic device is located; Determine the local magnetic vector modulus value according to the local magnetic field data; If the difference between the measured vector modulus and the local magnetic vector modulus is less than a second preset threshold, a first measurement value corresponding to a first error state is determined based on the measured vector modulus and the local magnetic vector modulus, wherein the first measurement value is used to characterize the error between the predicted state variable output by the state equation and the first quaternion.

7. The method according to claim 5, characterized in that After calculating the state variable at the current moment according to the state equation, the method further includes: A second measurement value corresponding to a second error state is calculated according to the state variable at the current moment and the second quaternion, wherein the second measurement value is used to characterize the error between the predicted state variable output by the state equation and the second quaternion.

8. The method according to claim 6 or 7, characterized in that: The method further comprises: updating the filtering model according to the covariance error matrix and the first measurement value; and / or, The filtering model is updated according to the covariance error matrix and the second measurement value.

9. The method according to claim 8, characterized in that The updating of the filtering model comprises: Determining whether the first measurement value and the second measurement value are available; If both the first measurement value and the second measurement value are available, updating the filter model using a first target matrix combination; If the first measurement value or the second measurement value is available, updating the filter model using a second target matrix combination; If both the first measurement value and the second measurement value are unavailable, the filtering model is updated by the state prediction variable output by the state equation.

10. A heading estimation device, applied to an electronic device, characterized in that: The device includes: A determination unit, an acquisition unit, a conversion unit and an input unit, wherein: The determining unit is used to determine the magnetic heading and a first attitude angle of the electronic device based on the roll angle, the pitch angle and the magnetic intensity measurement value of the electronic device, wherein the first attitude angle is characterized by the roll angle, the pitch angle and the magnetic heading; The acquisition unit is used to acquire the positioning system heading of the electronic device, and replace the magnetic heading representing the first attitude angle with the positioning system heading to obtain a second attitude angle of the electronic device; The conversion unit is used to perform quaternion conversion on the first posture angle to obtain a first quaternion, and perform quaternion conversion on the second posture angle to obtain a second quaternion; The input unit is used to use the first quaternion and the second quaternion as input data of a filtering model, adjust the error covariance of the state variable of the filtering model and the observation noise, and obtain a target filtering model; The determination unit is further used to determine the attitude angle data according to the target filtering model; The determination unit is further used to determine the heading of the electronic device according to the attitude angle data.

11. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program causes a computer to execute the method according to any one of claims 1 to 9.