Heading determination method and electronic device

By matching the real-time magnetic field strength index collected by the magnetometer with the historical correlation when the GNSS signal is poor, the problem of low heading accuracy under poor GNSS signal or low equipment speed is solved, and heading determination with low overhead and high accuracy is achieved.

WO2026123783A1PCT designated stage Publication Date: 2026-06-18BEIJING AUTONAVI YUNMAP TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
BEIJING AUTONAVI YUNMAP TECH CO LTD
Filing Date
2025-08-26
Publication Date
2026-06-18

AI Technical Summary

Technical Problem

When GNSS signals are poor or the equipment moves at low speeds, the accuracy of determining heading based on magnetometers is low. Furthermore, traditional methods require a large amount of computational resources and are susceptible to magnetic field interference, resulting in high resource consumption and poor accuracy.

Method used

When GNSS signals are not available, the magnetometer on the terminal device collects magnetic field strength in real time, and matches the current magnetic field strength with the historical heading and magnetic field strength indices to determine the current heading of the terminal device, thus avoiding the magnetometer calibration process.

🎯Benefits of technology

It reduces resource consumption, improves the accuracy and robustness of heading determination, and ensures that the equipment's direction of travel can still be accurately characterized even when GNSS signals are poor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025117109_18062026_PF_FP_ABST
    Figure CN2025117109_18062026_PF_FP_ABST
Patent Text Reader

Abstract

A heading determination method and an electronic device. The heading determination method comprises: on the basis of data collected in real time by a magnetometer mounted on a terminal device within a set duration, obtaining a current magnetic field strength indicator; if a positioning signal from a navigation satellite system currently received by the terminal device does not satisfy an availability condition, determining, from a correspondence representing the relationship between historical headings and historical magnetic field strength indicators, a historical magnetic field strength indicator matching the current magnetic field strength indicator; and determining, as a current heading of the terminal device, the historical heading corresponding to the historical magnetic field strength indicator matched in the correspondence. In the method, when a GNSS signal is poor, a heading of a terminal device is determined by means of a correspondence between historical headings and historical magnetic field strength indicators, without requiring calibration of magnetometer data, thereby reducing overhead, overcoming the problem of the magnetometer being susceptible to external interference, and improving the accuracy of heading determination.
Need to check novelty before this filing date? Find Prior Art

Description

Course determination methods and electronic equipment

[0001] This disclosure claims priority to Chinese Patent Application No. 202411814663.7, filed on December 10, 2024, entitled “Heading Determination Method and Electronic Equipment”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the field of positioning technology, and in particular to a heading determination method and electronic device. Background Technology

[0003] In navigation or positioning scenarios, it is necessary to determine the heading of the device being navigated or positioned. The heading can also be understood as the direction of travel, driving direction, or forward direction. The heading can be expressed as a heading angle, which can be determined by data measured by the device's magnetometer, GNSS (Global Navigation Satellite System) module, inertial measurement unit (IMU), etc.

[0004] GNSS offers advantages such as all-weather operation, high coverage, and high accuracy, making GNSS-based heading determination methods widely used. However, GNSS signals are easily blocked, and determining heading based on GNSS signals requires continuous measurement of velocity and acceleration directions. When the device's movement speed is too low, the accuracy of the determined velocity direction is low, resulting in low heading accuracy based on GNSS signals. Therefore, in scenarios with many obstructions, such as tunnels and mountainous areas, and in scenarios where the device's movement speed is too low, a magnetometer onboard the device can be used to determine heading. Heading determination based on a magnetometer has advantages such as being passive, small in size, and low in power consumption. However, the inventors of this disclosure have discovered that when using a magnetometer to determine heading, it is first necessary to collect sufficient data to calibrate the magnetometer. Calibration requires significant computational resources. Then, the magnetic field strength of the Earth's magnetic field measured by the calibrated magnetometer is projected onto a horizontal plane to calculate the heading. Furthermore, magnetometers are susceptible to interference from magnetic fields other than the Earth's magnetic field, resulting in low accuracy in the measured magnetic field strength. Therefore, there is an urgent need to provide a low-cost, high-accuracy solution for determining heading based on a magnetometer. Summary of the Invention

[0005] This disclosure provides a heading determination method and electronic device, which realizes a heading determination scheme based on the mapping relationship between GNSS heading and magnetometer observation data. It overcomes the problem of poor accuracy when relying solely on the magnetometer to determine the heading. At the same time, it eliminates the need to calibrate the magnetometer observation data, reducing the resource overhead for heading determination.

[0006] In a first aspect, this disclosure provides a course determination method, the method comprising:

[0007] Based on the data collected in real time by the magnetometer on the terminal device within a set time period, the current magnetic field strength index is obtained; if the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions, then from the correspondence between historical headings and historical magnetic field strength indices, a historical magnetic field strength index that matches the current magnetic field strength index is determined; the historical heading corresponding to the historical magnetic field strength index that matches the historical heading in the correspondence is determined as the current heading of the terminal device.

[0008] Secondly, this disclosure provides a heading determination device, the device comprising:

[0009] The magnetometer data acquisition module is used to obtain the current magnetic field strength index based on the data collected in real time by the magnetometer on the terminal device within a set time period; the magnetic field strength matching module is used to determine the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence between historical headings and historical magnetic field strength indices if the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions; the heading determination module is used to set the historical heading corresponding to the matched historical magnetic field strength index in the correspondence as the current heading of the terminal device.

[0010] Thirdly, this disclosure provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the electronic device to perform the method provided in the first aspect of this disclosure.

[0011] Fourthly, this disclosure provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method provided in the first aspect of this disclosure.

[0012] Fifthly, this disclosure provides a program product including a computer program that, when executed by a processor, implements the method provided in the first aspect of this disclosure.

[0013] The heading determination method and electronic device disclosed herein determine the heading of a terminal device using GNSS signals when the GNSS signal meets the availability conditions. It also calculates a magnetic field strength index based on data collected by a magnetometer and stores the temporally correlated correspondence between the heading and the magnetic field strength index. When the GNSS signal does not meet the availability conditions, it determines a historical magnetic field strength index that matches the currently obtained magnetic field strength index from this correspondence, and uses the historical heading corresponding to the matched historical magnetic field strength index as the current heading of the terminal device. Since the historical heading recorded in the correspondence of this disclosure is determined based on GNSS signals that meet the availability conditions, i.e., based on GNSS signals with good signal quality, the historical heading of this disclosure can accurately characterize the travel direction of the terminal device. Furthermore, within a certain geographical area, when the attitude of the terminal device is fixed and magnetic field interference can be ignored, the magnetic field strength index calculated based on the data collected by the magnetometer is consistent with its corresponding heading. Therefore, when the GNSS signal does not meet the availability conditions, the current magnetic field strength index is matched with the historical magnetic field strength index recorded in the correspondence, and the historical heading corresponding to the matched historical magnetic field strength index can be used as the current heading of the terminal device. This method does not require the use of data collected by a magnetometer to directly calculate the heading. Instead, it uses the magnetic field strength index as a matching term to determine the historical heading. Therefore, there is no need to calibrate the magnetometer. Compared with the traditional method of determining heading based on a magnetometer, it reduces resource consumption and improves the convenience of determining heading based on a magnetometer. Attached Figure Description

[0014] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0015] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this disclosure;

[0016] Figure 2 is a schematic flowchart of a heading determination method provided in an embodiment of this disclosure;

[0017] Figure 3 is a flowchart illustrating another heading determination method provided in an embodiment of this disclosure;

[0018] Figure 4 is a schematic diagram of the correspondence update process provided in the embodiments of this disclosure;

[0019] Figure 5 is a schematic diagram of another heading determination method provided in an embodiment of this disclosure;

[0020] Figure 6 is a schematic diagram of a heading determination device provided in an embodiment of this disclosure;

[0021] Figure 7 is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.

[0022] The accompanying drawings have illustrated specific embodiments of this disclosure, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this disclosure to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0023] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0024] The application scenarios disclosed herein are any scenarios requiring positioning or navigation, such as driving or cycling. The terminal device can be a handheld or wearable device by the user, or a terminal device fixed or placed on a vehicle. The vehicle is typically a car, bicycle, or similar vehicle.

[0025] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this disclosure. Taking a vehicle as an example, Figure 1 shows a scenario of a user driving. The terminal device can be an in-vehicle multimedia system (also known as a car infotainment system) installed in the vehicle, or a terminal device placed in the vehicle (such as a smartphone, tablet, etc.). Taking a smartphone placed in the vehicle as an example, when the smartphone provides driving navigation services to the user, in order to ensure the quality of the navigation service, it is necessary to determine the vehicle's position and direction of travel (i.e., heading). Typically, the smartphone can determine the vehicle's position and heading based on GNSS signals. For example, the position and speed of the vehicle can be determined based on the GNSS signals received by the GNSS receiver on the smartphone, and the heading can be determined based on the continuous position and speed. Since the smartphone is located in the vehicle, the position and speed of the terminal device calculated based on the GNSS signals received by the smartphone can be equivalent to the position and speed of the vehicle.

[0026] When a smartphone provides navigation services, and the vehicle enters areas with tunnels, mountains, or tall buildings, GNSS signals can be blocked or reflected by these structures. This can lead to the smartphone receiving no GNSS signal or receiving a significantly weakened signal. Consequently, the heading may be difficult to determine based solely on GNSS signals, or the determined heading may be inaccurate. Therefore, when GNSS signals are weak, it is necessary to use data collected by other sensors on the terminal device to determine the heading, such as data collected by the magnetometer on the smartphone. In other words, when the GNSS signal is unobstructed, the heading is determined based on GNSS data; when the GNSS signal is obstructed, the heading can be determined based on the magnetometer.

[0027] Due to factors such as zero-point drift and uneven sensitivity of the magnetometer itself, the accuracy of the data collected by the magnetometer can be affected. Therefore, traditional technology requires collecting a large amount of data from the magnetometer to calibrate it before determining the heading based on the data collected by the magnetometer. The heading of the terminal device is then determined based on the data collected by the calibrated magnetometer. Since the calibration of the magnetometer requires a large amount of data, the traditional method of determining the heading based on the magnetometer has a large resource cost. At the same time, the data collected by the magnetometer is easily affected by environmental temperature, air pressure, magnetic field distribution, etc., resulting in poor accuracy and stability of the heading determined based on the data collected by the magnetometer.

[0028] To address the aforementioned issues, this disclosure provides a heading determination method. When the GNSS signal is unavailable, based on the current magnetic field strength index of the magnetometer on the terminal device, a historical magnetic field strength index matching the current index is found from the correspondence between historical headings and historical magnetic field strength indices. The historical heading corresponding to the matching historical magnetic field strength index in the correspondence is then used as the current heading of the terminal device. This heading determination method eliminates the need for magnetometer calibration, resulting in low overhead. Furthermore, the historical heading determined by this disclosure is based on a GNSS signal with good signal quality, i.e., the GNSS heading. Compared to methods that solely rely on data collected by the magnetometer, determining the GNSS heading based on a GNSS signal with good signal quality ensures both accuracy and robustness of the heading determination.

[0029] Figure 2 is a flowchart illustrating a heading determination method provided in an embodiment of this disclosure. This method can be executed by any electronic device with corresponding data processing capabilities, such as the aforementioned terminal device. The terminal device is a device equipped with at least a GNSS receiver and a magnetometer, such as a smartphone, smartwatch, tablet computer, or vehicle multimedia system (vehicle infotainment system).

[0030] The heading determination method provided in this embodiment is used to determine the heading of a terminal device with a fixed attitude. The heading can be used for services that require heading, such as positioning or navigation. As shown in Figure 2, the heading determination method includes the following steps:

[0031] Step S201: Based on the data collected in real time by the magnetometer mounted on the terminal device within a set time period, the current magnetic field strength index is obtained.

[0032] A magnetometer, also known as a magnetic sensor, is used to measure the strength and direction of a magnetic field. The data it collects reflects the change in magnetic field strength in different directions. A magnetometer typically consists of three mutually perpendicular magnetoresistive sensors (or other types of magnetic field sensors), each responsible for measuring the magnetic field strength in a specific direction (such as the x-axis, y-axis, or z-axis). This allows the obtain of the magnetic field vector information at any point in three-dimensional space.

[0033] The set duration can be 2 seconds, 3 seconds, etc. This disclosure uses the set duration to determine the time window, and calculates a magnetic field strength index based on a set of data collected by the magnetometer within each time window. Specifically, the current magnetic field strength index refers to the magnetic field strength index that can be used to determine the heading at the current moment, and is usually calculated based on the data collected by the magnetometer within the most recent time window. Magnetic field strength indices calculated before the most recent time window are called historical magnetic field strength indices. That is, in this disclosure, the prefix "current" refers to the data within the most recent time window, and "historical" refers to the data within the time window before the most recent time window. The prefixes "historical" and "current" in this disclosure are only used to distinguish the order in which the data was obtained.

[0034] For example, taking a set duration of 2 seconds, if the current time for determining the current heading is 10:11:52, then the latest time window is from 10:11:49 to 10:11:51. The current magnetic field strength index is then calculated based on a set of data collected within this time window. Alternatively, the latest time window could be from 10:11:50 to 10:11:52. It should be noted that this disclosure does not require the magnetometer's time window to be synchronized with the current time. During stable and continuous operation of the magnetometer, the magnetic field strength index of the time window closest to the current time can be selected as the current magnetic field strength index.

[0035] The current magnetic field strength index disclosed herein can be the average, median, maximum, peak-to-peak value, or other statistical indicators of the magnetic field strength collected by the magnetometer at multiple time points within a set time window. Considering magnetic field interference in environments such as tunnels, to ensure the accuracy of the current magnetic field strength index, after obtaining multiple magnetic field strengths within a time window, it is necessary to determine whether these multiple magnetic field strengths are stable, i.e., whether the fluctuations in these multiple magnetic field strengths are significant. If stable, i.e., the fluctuations are not significant, then based on these multiple magnetic field strengths, the current magnetic field strength index is calculated. A historical magnetic field strength index matching the current magnetic field strength index is then found from the correspondence, and the historical heading corresponding to the matching historical magnetic field strength index is used as the current heading of the terminal device. If unstable, then the steps of calculating the current magnetic field strength index and determining the current heading are not executed, i.e., the current heading of the terminal device is not output.

[0036] In practice, the stability of multiple magnetic field strengths can be determined based on the peak-to-peak value, variance, standard deviation, or other indicators of multiple magnetic field strengths collected in real time within a set time period.

[0037] Step S202: If the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions, then determine the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence between the historical heading and the historical magnetic field strength index.

[0038] The navigation satellite system can be any Global Navigation Satellite System, such as GPS (Global Positioning System) or BeiDou. The GNSS receiver on the terminal device continuously receives positioning signals from the navigation satellite system, i.e., GNSS signals. For example, the availability of the positioning signal can be determined based on one or more parameters such as the signal strength, the number of satellites, and the speed of the terminal device determined based on the positioning signal. Typically, when the positioning signal is available, the terminal device can directly determine its position and heading based on the GNSS signal, that is, determine its position and heading through satellite positioning.

[0039] Taking a 2-second duration as an example, if the GNSS positioning signal received by the GNSS receiver on the terminal device at 10:11:52 does not meet the usability conditions, the current magnetic field strength index can be determined based on data collected by the magnetometer within a time window including the time of 10:11:52, such as data collected from 10:11:51 to 10:11:53. In other words, when this disclosure determines that the positioning signal received in real time from the navigation satellite system, i.e., the GNSS signal at the current moment, does not meet the usability conditions, it only needs to use data collected by the magnetometer within a time window including the current moment to determine the current magnetic field strength index, and then the heading at the current moment determined by this current magnetic field strength index is the current heading.

[0040] Step S203: Determine the historical heading corresponding to the matched historical magnetic field strength index in the correspondence relationship as the current heading of the terminal device.

[0041] The correspondence disclosed herein records the correspondence between historical magnetic field strength indices and historical headings. The historical headings are determined based on positioning signals that meet availability conditions, that is, based on historical headings determined by GNSS signals with good signal quality. The historical magnetic field strength indices are determined based on data collected by the magnetometer.

[0042] For example, Table 1 is a mapping table of magnetic field strength indices and headings in the correspondence. As shown in Table 1, the correspondence records the mapping relationship between time nodes (in some embodiments, time nodes may not be recorded), magnetic field strength indices, and headings. A time node can be any moment within the time window of the magnetometer's data acquisition, such as the start time, middle time, or end time. The data acquired by the magnetometer includes observations on three mutually perpendicular coordinate axes (x-axis, y-axis, and z-axis). Therefore, the magnetic field strength indices recorded in the correspondence include the strength index values ​​of the x-axis, y-axis, and z-axis, such as x1, y1, and z1. The strength index values ​​can be the average of the observation data of the same coordinate axis measured by the magnetometer at multiple time nodes within the corresponding time window. The heading recorded in the correspondence is the GNSS heading, that is, the heading of the terminal device determined based on the GNSS signal when the GNSS signal observation is good. There is a time correlation between the recorded magnetic field strength indices and the corresponding GNSS headings. For example, the reception time of the positioning signal on which the GNSS heading is determined falls within the time window corresponding to the magnetic field strength index.

[0043] Table 1 Mapping of Magnetic Field Strength Indices to Heading

[0044] When the GNSS positioning signal does not meet the availability conditions, the system iterates through the historical magnetic field strength indicators stored in the correspondence relationship. For each historical magnetic field strength indicator, if the deviation between the historical magnetic field strength indicator and the current magnetic field strength indicator is less than a set deviation, then the historical magnetic field strength indicator is matched with the current magnetic field strength indicator. The heading corresponding to the matched historical magnetic field strength indicator is determined as the current heading of the terminal equipment.

[0045] The deviation setting is a configurable parameter that can be configured based on the accuracy requirements of the heading and the required heading determination coverage. The larger the deviation setting, the easier it is to find historical magnetic field strength indicators that match the current magnetic field strength indicator, thereby improving the heading determination coverage. This allows for heading determination based on data collected by the magnetometer even in tunnels or other areas where the magnetic field strength distribution changes significantly. The smaller the deviation setting, the higher the consistency between the current magnetic field strength indicator and the matched historical magnetic field strength indicator, and the higher the accuracy of the determined heading.

[0046] In the correspondence, the stored historical magnetic field strength indicators and their corresponding historical headings can be sorted in order of storage time from latest to earliest, that is, the latest stored historical magnetic field strength indicators are placed first, so that the latest stored historical magnetic field strength indicators are traversed first during traversal.

[0047] Furthermore, the historical position of the terminal device can also be recorded in the correspondence relationship. This historical position can be determined based on the historical heading in the correspondence relationship. Since two locations that are too far apart will have significantly different magnetic field strengths even if the terminal device's attitude is the same, the magnetic field strength collected by the onboard magnetometer will differ considerably. Therefore, to improve the accuracy of heading determination, when determining the historical magnetic field strength index that matches the previous magnetic field strength index from the correspondence relationship, it can be determined from historical magnetic field strength indices whose distance from the corresponding historical position to the latest obtained terminal device position is less than a preset distance. Because the terminal device's position, as well as the historical positions, historical magnetic field strength indices, and historical headings stored in the correspondence relationship, are constantly updated during navigation, the historical position corresponding to the latest stored historical magnetic field strength index is relatively close to the terminal device's current position. Therefore, the historical magnetic field strength index that matches the previous magnetic field strength index can be determined from the multiple historical magnetic field strength indices recently stored in the correspondence relationship.

[0048] Furthermore, if there is no historical magnetic field strength index that matches the current magnetic field strength index in the corresponding relationship, the current heading of the terminal device cannot be determined based on the data collected in real time by the magnetometer. The current heading can be set to empty, or the current heading can be determined by data collected by other sensors, such as data collected by the IMU.

[0049] The above describes the main process of the heading determination method provided in this disclosure when the GNSS signal does not meet the availability conditions. The following embodiments add the case when the GNSS signal meets the availability conditions.

[0050] For each time window (duration is a set duration), the magnetic field strength index and GNSS positioning signal corresponding to that time window are obtained, and it is determined whether the positioning signal of that time window meets the availability condition. If it does, the current heading of the terminal device is determined based on the positioning signal of that time window, and the GNSS heading corresponding to that time window is obtained. The GNSS heading and the magnetic field strength index corresponding to that time window are stored in a correspondence. If the positioning signal does not meet the availability condition, the historical magnetic field strength index corresponding to each historical time window stored in the correspondence is searched for a historical magnetic field strength index that matches the current magnetic field strength index corresponding to that time window. If a matching historical magnetic field strength index is found, the GNSS heading corresponding to the matching historical magnetic field strength index in the correspondence is determined as the heading of the terminal device at the time node corresponding to that time window, i.e., the current heading. If no matching historical magnetic field strength index is found, the heading of the terminal device at the time node corresponding to that time window is empty.

[0051] Since magnetometer data is typically three-dimensional, including data on three mutually perpendicular coordinate axes such as the X, Y, and Z axes, matching magnetic field strength indices across different time windows requires evaluating whether the deviations between the values ​​of the two magnetic field strength indices on each coordinate axis meet the set conditions, using the coordinate axes as the dimensions.

[0052] Optionally, the data collected by the magnetometer includes data from multiple coordinate axes. The magnetic field strength index (including the current magnetic field strength index and historical magnetic field strength index) includes the intensity index value corresponding to each coordinate axis of the magnetometer. From the correspondence, the historical magnetic field strength index that matches the current magnetic field strength index is determined, including:

[0053] Based on the intensity index values ​​corresponding to each coordinate axis of the magnetometer included in the current magnetic field strength index, a historical magnetic field strength index that matches the current magnetic field strength index is determined from the correspondence.

[0054] The magnetic field strength index has intensity values ​​corresponding to each coordinate axis, including the x-axis, y-axis, and z-axis values. For both the current magnetic field strength index and the historical magnetic field strength index in the corresponding relationship, the deviations between the x-axis, y-axis, and z-axis values ​​of the two magnetic field strength indices are calculated, resulting in three-axis deviations: Δx on the x-axis, Δy on the y-axis, and Δz on the z-axis. If the calculated three-axis deviations (Δx, Δy, Δz) meet preset conditions, the two magnetic field strength indices are considered matched.

[0055] For example, the three-axis deviations (Δx, Δy, Δz) can satisfy the preset conditions if Δx, Δy, and Δz are all less than preset thresholds. The preset thresholds corresponding to different coordinate axes can be the same or different. For example, the preset threshold corresponding to the z-axis is less than the preset thresholds corresponding to the other two axes.

[0056] Optionally, based on the intensity index values ​​corresponding to each coordinate axis of the magnetometer included in the current magnetic field strength index, a historical magnetic field strength index matching the current magnetic field strength index is determined from the correspondence, including:

[0057] Based on the intensity index values ​​corresponding to each axis of the magnetometer included in the current magnetic field strength index and the historical magnetic field strength index in the corresponding relationship, the deviation of the intensity index values ​​of the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis is calculated; based on the deviation of the intensity index values ​​of the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis, a historical magnetic field strength index that matches the current magnetic field strength index is determined.

[0058] The deviation can be a difference or an absolute difference (i.e., the absolute value of the difference), or it can be represented by a normalized absolute difference.

[0059] If the deviations of the two magnetic field strength indices across each coordinate axis are small, then the two magnetic field strength indices are considered to be matched.

[0060] Optionally, based on the deviation of the current magnetic field strength index from the historical magnetic field strength index on each coordinate axis, a historical magnetic field strength index matching the current magnetic field strength index is determined, including:

[0061] Determine the absolute value of the deviation between the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis; determine the historical magnetic field strength index whose absolute value of the intensity index on each coordinate axis is less than a preset deviation threshold as the historical magnetic field strength index that matches the current magnetic field strength index.

[0062] Assuming the current magnetic field strength index values ​​on the three coordinate axes are x1, y1, and z1, and the historical magnetic field strength index values ​​on the three coordinate axes are x2, y2, and z2, if the deviations of the two magnetic field strength index values ​​on each coordinate axis, i.e., |x1-x2|, |y1-y2|, and |z1-z2|, are all less than a preset threshold, the preset threshold can be 1 A / m (Ampere per meter), 2 A / m, 3 A / m, or other values, then the two magnetic field strength indices are considered matched. The preset thresholds corresponding to different coordinate axes can be the same or different; for example, the preset threshold corresponding to the z-axis may be less than the preset thresholds corresponding to the other two axes.

[0063] Matching magnetic field strength indices based on the deviations of their values ​​along each axis reduces computational complexity and speed, thus improving the efficiency of course determination.

[0064] The current heading of the determined terminal device can be combined with the terminal device's location, speed, environmental data, etc., to locate the terminal device, generate the terminal device's trajectory, or guide the vehicle carrying the terminal device to perform assisted driving, intelligent driving, etc.

[0065] The heading determination method disclosed herein combines magnetometer and GNSS data to determine heading. When GNSS signal is available (i.e., when the availability condition is met), the heading of the terminal device is determined through the GNSS signal. This heading can be referred to as the GNSS heading. The method also calculates a magnetic field strength index based on data collected by the magnetometer and stores a temporally correlated relationship between the GNSS heading and the magnetic field strength index. Specifically, the temporal correlation means that the time corresponding to the GNSS heading falls within the time window of the data on which the magnetic field strength index calculation depends. When the GNSS signal does not meet the availability condition, a historical magnetic field strength index matching the current magnetic field strength index is determined from this relationship. The GNSS heading corresponding to the matching historical magnetic field strength index is then determined as the current heading of the terminal device. Since the heading recorded in the correspondence of this disclosure is determined based on GNSS signals that meet the availability conditions, that is, based on GNSS signals with good signal quality, the GNSS heading of this disclosure can accurately characterize the direction of travel of the terminal equipment. Furthermore, within a certain geographical area, when the attitude of the terminal equipment is fixed and magnetic field interference can be ignored, the magnetic field strength index calculated based on the data collected by the magnetometer is consistent with its corresponding heading. Therefore, when the GNSS signal does not meet the availability conditions, the current magnetic field strength index is matched with the historical magnetic field strength index recorded in the correspondence, and the historical heading corresponding to the matched historical magnetic field strength index can be used as the current heading of the terminal equipment. This method does not require directly calculating the heading using data collected by the magnetometer, but instead uses the magnetic field strength index as a matching item to determine the historical heading. Therefore, it does not require magnetometer calibration. Compared with the traditional method of determining heading based on the magnetometer, this reduces resource consumption and improves the convenience of determining heading based on the magnetometer.

[0066] In some embodiments, a hash lookup method can be used to improve the speed of matching the current magnetic field strength index with historical magnetic field strength indices. For each group of corresponding GNSS headings (i.e., historical headings) and historical magnetic field strength indices, after the historical magnetic field strength indices are integerized, a hash function is used to obtain the hash value of the historical magnetic field strength indices. Then, the hash values ​​of the historical magnetic field strength indices and their corresponding GNSS headings are stored in a correspondence, thereby quickly determining the historical magnetic field strength index that matches the current magnetic field strength index through hash value matching.

[0067] In the correspondence, the historical magnetic field strength index, or the intensity index corresponding to the historical magnetic field strength index and each coordinate axis of the magnetometer, is represented by a hash value. Therefore, it is also necessary to calculate the hash value of the current magnetic field strength index, or the hash value of the current magnetic field strength index corresponding to each coordinate axis of the magnetometer.

[0068] Optionally, the method further includes: integerizing the current magnetic field strength index to obtain the integer corresponding to the current magnetic field strength index; and calculating the hash value of the integer corresponding to the current magnetic field strength index. Correspondingly, determining the historical magnetic field strength index matching the current magnetic field strength index from the correspondence includes: indexing the historical magnetic field strength index matching the current magnetic field strength index from the correspondence based on the hash value of the integer corresponding to the current magnetic field strength index.

[0069] For cases where the magnetometer has multiple axes, the method further includes: integerizing the intensity index values ​​corresponding to each axis of the magnetometer included in the current magnetic field strength index to obtain the integer corresponding to each intensity index value included in the current magnetic field strength index; calculating the hash value of the integer corresponding to each intensity index value included in the current magnetic field strength index; and determining the historical magnetic field strength index matching the current magnetic field strength index from the correspondence relationship based on the intensity index values ​​corresponding to each coordinate axis of the magnetometer included in the current magnetic field strength index, including: indexing the historical magnetic field strength index matching the current magnetic field strength index from the correspondence relationship based on the hash value corresponding to each intensity index value included in the current magnetic field strength index.

[0070] Integerization can be achieved through rounding, such as rounding up, rounding down, or by multiplying the decimal by a positive integer power of 10, such as multiplying by 10. 5 .

[0071] The magnetic field strength index can be represented as a floating-point number, accurate to four decimal places. When converting to an integer, the magnetic field strength index (current or historical) can be multiplied by 10 raised to the power of n to obtain the corresponding integer. Here, n can be a positive integer greater than or equal to 4.

[0072] Any hash function can be used to calculate the hash value of an integer, and this disclosure does not impose any restrictions on it.

[0073] The mapping relationship stores multiple key-value pairs. The key in each key-value pair is the hash value corresponding to the historical magnetic field strength index, and the value is the historical heading.

[0074] After obtaining the hash value of the integer corresponding to the current magnetic field strength index or the hash value of the integer corresponding to each strength index value included in the current magnetic field strength index, the hash value is used as an index to search among multiple key-value pairs stored in the correspondence to find the historical magnetic field strength index that matches the current magnetic field strength index, that is, the historical magnetic field strength index with the same hash value as the current magnetic field strength index, and the value corresponding to the matching magnetic field strength index, i.e. the historical heading, is determined as the current heading of the terminal device.

[0075] Figure 3 is a flowchart illustrating another heading determination method provided by an embodiment of this disclosure. This embodiment is a preferred embodiment based on the embodiment shown in Figure 2. As shown in Figure 3, the heading determination method provided by this embodiment may specifically include the following steps:

[0076] Step S301: Obtain the magnetic field strength collected by the magnetometer at multiple time points within a set time period, and obtain the positioning signal of the navigation satellite system currently received by the terminal device.

[0077] A set time window includes multiple time nodes, each corresponding to a specific moment. For each time window, the magnetic field strength collected by the magnetometer at multiple time nodes within that time window is acquired, such as the three-axis magnetic field strength observed by the magnetometer at multiple time nodes within the past 2 seconds, as well as the positioning signal from the navigation satellite system received by the terminal device within that time window.

[0078] Step S302: Obtain the peak-to-peak values ​​of the magnetic field strength collected by the magnetometer at multiple time points within the set time period on each coordinate axis.

[0079] Each coordinate axis refers to the coordinate axes of the magnetometer. Specifically, the peak-to-peak value of each coordinate axis is the peak-to-peak value of each of the three mutually perpendicular coordinate axes: x-axis, y-axis, and z-axis. In another possible implementation, it can also be the peak-to-peak value of each of the six coordinate axes.

[0080] For each time window, calculate the peak-to-peak value of the magnetic field strength index at each time node within that time window on each coordinate axis. The peak-to-peak value is the difference between the maximum and minimum values ​​of the magnetic field strength index on a certain coordinate axis within that time window.

[0081] Taking a time window comprising 5 time nodes as an example, the 5 time nodes within the i-th time window are denoted as t. i1 To t i5 The magnetic field strength collected by the magnetometer at the j-th time node in the i-th time window is (x ij ,y ij ,z ij Assume that the maximum and minimum values ​​of the magnetic field strength collected at the 5 time points within the i-th time window are respectively (x... i3 ,y i3 ,z i3 ) and (x i5 ,y i5 ,z i5 If the peak-to-peak values ​​of the magnetic field strength in the i-th time window on each coordinate axis are x, then the peak-to-peak values ​​of the magnetic field strength in the i-th time window are x. i3 -x i5 y i3 -yi5 z i3 -z i5 Both i and j are positive integers, and j is less than or equal to 5.

[0082] Step S303: If the peak-to-peak values ​​of the magnetic field strength on each coordinate axis are all less than the preset limit, then calculate the average value of the magnetic field strength collected by the magnetometer at multiple time points within a set time period to obtain the current magnetic field strength index.

[0083] The preset limits are configurable parameters that can be configured based on the characteristics of the magnetometer.

[0084] After obtaining the peak-to-peak values ​​of the magnetic field strength on each coordinate axis for the current time window (e.g., the past 2 seconds), determine whether the peak-to-peak values ​​of the magnetic field strength on each coordinate axis for the current time window are all less than preset limits. If so, it indicates that the magnetic field strength fluctuations in the current time window are not significant and the magnetic field strength is stable. Subsequent steps can be performed based on the magnetic field strength of the current time window to determine the current heading. If the peak-to-peak value of at least one coordinate axis is greater than or equal to the preset limit, it indicates that the magnetic field strength fluctuations in the current time window are large and unstable. In this case, it is not necessary to perform subsequent steps based on the magnetic field strength of the current time window, such as directly setting the current heading to empty.

[0085] In another possible approach, other indicators can be used to determine whether the magnetic field strength of the current time window is stable, such as the variance or standard deviation of the magnetic field strength of the current time window on each axis.

[0086] When multiple magnetic field strengths are stable within the current time window, calculate the average value of the magnetic field strength along each coordinate axis within the multiple magnetic field strengths of the current time window to obtain the current magnetic field strength index.

[0087] Step S304: If the positioning signal of the navigation satellite system currently received by the terminal device meets the availability conditions, the current heading of the terminal device is determined based on the positioning signal, and the corresponding relationship is updated based on the current heading and the current magnetic field strength index.

[0088] Optionally, the positioning signal meets the following conditions for usability: the signal strength of the positioning signal is higher than a preset strength; the number of satellites corresponding to the positioning signal is greater than a preset number; and the speed of the terminal device determined by the positioning signal is higher than a preset speed.

[0089] For example, the preset quantity can be at least 4, and the preset speed can be 3 m / s (Metre per Second), 5 m / s, or other values.

[0090] After obtaining the current magnetic field strength index, it is determined whether the current positioning signal meets the availability conditions. If so, the current heading of the terminal device is determined based on the positioning signal, and the correspondence is updated based on the current magnetic field strength index and the current heading. The current magnetic field strength index and current heading can be directly added to the correspondence, thus adding a set of historical magnetic field strength indices and historical headings to the correspondence. Alternatively, the current magnetic field strength index can be integerized, and the hash value of the corresponding integer can be calculated. This hash value and the current heading can then be stored as a key-value pair in the correspondence.

[0091] To avoid storing too much data in the correspondence, which would occupy too much storage space and slow down the matching speed, before storing a new set of magnetic field strength indicators and headings into the correspondence, it is possible to first determine whether a historical magnetic field strength indicator that matches the magnetic field strength indicator already exists in the correspondence. If so, then only one of the magnetic field strength indicator and its matching historical magnetic field strength indicator needs to be stored.

[0092] Optionally, based on the current heading and the current magnetic field strength index, the correspondence is updated, including: if there is no historical magnetic field strength index matching the current magnetic field strength index in the correspondence, then the current heading and its corresponding magnetic field strength index are added to the correspondence; wherein, the magnetic field strength index corresponding to the current heading is the current magnetic field strength index; if there is a historical magnetic field strength index matching the current magnetic field strength index in the correspondence, then the angular deviation between the current heading and the heading corresponding to the matching historical magnetic field strength index is calculated; if the angular deviation is greater than a preset deviation, then the matching magnetic field strength index and its corresponding heading are deleted from the correspondence.

[0093] Before storing the current magnetic field strength index and current heading in the correspondence, it is first determined whether there is a historical magnetic field strength index in the correspondence that matches the current magnetic field strength index. If not, the current magnetic field strength index and current heading are stored in the correspondence. If they do, it is further determined whether the angle deviation between the current heading and the heading corresponding to the matching historical magnetic field strength index is greater than a preset deviation. If not, the current magnetic field strength index and current heading are stored in the correspondence. If the angle deviation is greater than the preset deviation, it is not necessary to store the current magnetic field strength index and current heading in the correspondence. At the same time, the matching magnetic field strength index and its corresponding correspondence stored in the correspondence can also be deleted.

[0094] If the headings of the two matched magnetic field strength indices deviate significantly (i.e., the angle deviation is greater than the preset deviation), it indicates that the heading of at least one of the two magnetic field strength indices is inaccurate. To avoid determining the inaccurate heading as the current heading in the future, neither of the two magnetic field strength indices nor their corresponding headings need to be stored in the correspondence. In other words, the matched magnetic field strength indices and their corresponding headings need to be deleted from the correspondence.

[0095] By matching the deviation between the headings corresponding to the two sets of magnetic field strength indices, a self-consistent judgment between the existing and soon-to-be-stored magnetic field strength indices and headings in the correspondence is achieved, which improves the accuracy of the data stored in the correspondence. At the same time, by matching the existing and soon-to-be-stored magnetic field strength indices, data redundancy in the correspondence is avoided, and the memory space occupied by the correspondence is reduced.

[0096] For example, Figure 4 is a schematic diagram of the correspondence update process provided in this embodiment of the present disclosure. As shown in Figure 4, for a newly obtained set of magnetic field strength indicators (the average value of magnetic field strength indicators within a time window) and their corresponding GNSS headings (headings determined based on GNSS positioning signals), namely (x_new, y_new, z_new) and Ψ_new, it is determined from the magnetic field strength indicators already stored in the correspondence relationship (correspondence relationship 1 in Figure 4) whether there is a magnetic field strength indicator that matches the newly obtained magnetic field strength indicator, i.e., whether (x_new, y_new, z_new) and Ψ_new are successfully matched; if not, i.e., the match is unsuccessful, then (x_new, y_new, z_new) and Ψ_new are stored in the correspondence relationship, and the updated correspondence relationship is shown in correspondence relationship 2 in Figure 4; if they exist, the match is successful. If successful, such as (x_2,y_2,z_2) matching (x_new,y_new,z_new) in the correspondence, then the angular deviation between Ψ_new and Ψ_2 is further calculated as |Ψ_new-Ψ2|; and it is determined whether the angular deviation between Ψ_new and Ψ2 is greater than the preset deviation Δφ, that is, whether the relation |Ψ_new-Ψ2|>Δφ holds true; if it holds true, then there is no need to store (x_new,y_new,z_new) and Ψ_new in the correspondence, and at the same time, (x_2,y_2,z_2) and Ψ2 stored in the correspondence need to be deleted. The updated correspondence is shown as correspondence 3 in Figure 4; if the above relation does not hold true, then the correspondence is not updated, and the correspondence remains unchanged, that is, there is no need to store (x_new,y_new,z_new) and Ψ_new in the correspondence. When the relation |Ψ_new-Ψ2|>Δφ does not hold, the (x_2,y_2,z_2) and Ψ2 stored in the corresponding relation can be replaced with (x_new,y_new,z_new) and Ψ_new, or replaced with ((x_new+x2) / 2,(y_new+y2) / 2,(z_new+z2) / 2) and (Ψ_new+Ψ2) / 2.

[0097] Step S305: If the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions, then determine the historical magnetic field strength index that matches the current magnetic field strength index from the corresponding relationship.

[0098] Step S306: Determine the historical heading corresponding to the matched historical magnetic field strength index in the correspondence relationship as the current heading of the terminal device.

[0099] Taking navigation as an example, the mapping relationship can be generated and updated each time the terminal device starts navigation, and cleared when the terminal device ends the current navigation. That is, the mapping relationship used by the terminal device in different navigation processes is generated with each navigation process. After each navigation ends, the mapping relationship generated for that navigation is reset (deleted). This avoids storing too much data and improves the efficiency of magnetic field strength index matching. However, if the terminal device's posture remains fixed, such as when the terminal device is mounted in a vehicle in a fixed posture, it is not necessary to clear the mapping relationship. As long as the magnetic field strength characteristics of the geographical area the terminal device is traveling in are consistent with the magnetic field strength characteristics of the geographical area when the mapping relationship was generated, the terminal device's heading can be determined based on the mapping relationship generated during historical navigation. For example, if the terminal device's activity area is in city A and its posture on the vehicle remains fixed, the terminal device's heading in city A can be determined based on the mapping relationship generated during historical navigation in city A. It can be understood that geographical areas with consistent magnetic field strength characteristics may be geographical areas belonging to the same city in administrative divisions, or they may be geographical areas that do not belong to the same city in administrative divisions. Since magnetic field strength characteristics are natural attributes and have no necessary correspondence with artificially defined administrative divisions, the aforementioned examples are only for the purpose of illustrating the scheme disclosed herein and do not imply any limitation on the scheme disclosed herein.

[0100] In this embodiment, heading determination is achieved by combining GNSS and magnetometer data. When GNSS availability is high, the heading is determined based on the GNSS positioning signal. Simultaneously, the determined heading and the magnetometer's magnetic field strength index for the same time period are stored in a correspondence. Therefore, when GNSS availability is low, such as when a vehicle enters a tunnel, underground parking lot, or mountainous terrain, the heading is determined based on this correspondence and real-time magnetometer observation data. Using the average magnetic field strength collected by the magnetometer over a period of time as an indicator, a correspondence is generated or matched to determine the heading. This avoids the problem of poor heading determination stability due to the instability of data collected by the magnetometer at a single moment, thus improving the robustness of heading determination. Furthermore, by comparing the peak-to-peak value of the magnetic field strength index over a period of time with a preset limit, the stability of the magnetic field strength index is assessed. When the magnetic field strength index is stable, the heading is determined based on the magnetic field strength index, further improving the accuracy of heading determination. Real-time updates to the correspondence improve the adaptability of the stored data to the navigation scenario, providing sufficient data support when GNSS heading observations are unsatisfactory.

[0101] Figure 5 is a schematic diagram of another heading determination method provided in this embodiment. As shown in Figure 5, a terminal device (such as a smartphone) is placed on a vehicle. After navigation is turned on, data observed by the magnetometer on the terminal device is periodically acquired to obtain magnetometer data for each period, such as the magnetic field strength mentioned above. One period corresponds to one time window, and the duration is a set duration. The stability of the magnetometer data collected in each period is determined, that is, whether the magnetometer data is stable. If it is unstable, no operation is performed, and the system waits to acquire the magnetometer data for the next period. If it is stable, the average of the collected magnetometer data is taken to obtain the magnetic field strength index. Taking the k-th period as an example, its magnetic field strength index is represented as (x_k, y_k, z_k). If the heading observed by GNSS in the k-th period, such as Ψ_k, is available, (x_k, y_k, z_k) is... The Ψ_k is stored in the corresponding relation, where Ψ_k is the heading observed at a time node in the k-th cycle of the GNSS observation. If the heading of the GNSS observation, such as Ψ_k+i, is unavailable, and the data from the magnetometer observation in the (k+i)-th cycle is stable, then the magnetic field strength index of the (k+i)-th cycle, i.e., (x_k+i, y_k+i, z_k+i), is matched with the magnetic field strength index stored in the corresponding relation, where i is a positive integer. If the match is successful, such as (x_k, y_k, z_k) matching (x_k+i, y_k+i, z_k+i), then the Ψ_k corresponding to the matched heading (x_k, y_k, z_k) is used as the current heading, that is, the heading corresponding to the matched magnetic field strength index, such as Ψ_k, is used as the current heading. If the match fails, no operation is performed, and the system waits to obtain the magnetometer data for the next cycle.

[0102] Figure 6 is a schematic diagram of a heading determination device provided in an embodiment of this disclosure. As shown in Figure 6, the heading determination device includes: a magnetometer data acquisition module 610, a magnetic field strength matching module 620, and a heading determination module 630.

[0103] The magnetometer data acquisition module 610 is used to obtain the current magnetic field strength index based on the data collected in real time by the magnetometer on the terminal device within a set time period; the magnetic field strength matching module 620 is used to determine the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence between historical headings and historical magnetic field strength indices if the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions; the heading determination module 630 is used to take the historical heading corresponding to the matched historical magnetic field strength index in the correspondence as the current heading of the terminal device.

[0104] Optionally, the data collected by the magnetometer includes data from multiple coordinate axes, and the magnetic field strength index includes the strength index value corresponding to each coordinate axis of the magnetometer; the magnetic field strength matching module 620 is specifically used to: based on the strength index value corresponding to each coordinate axis of the magnetometer included in the current magnetic field strength index, determine the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence relationship.

[0105] Optionally, the magnetic field strength matching module 620 includes: a deviation calculation unit, used to calculate the deviation of the intensity index values ​​of the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis based on the intensity index values ​​of each of the current magnetic field strength index and the historical magnetic field strength index in the correspondence relationship, which are respectively included in each axis of the magnetometer; and a matching unit, used to determine the historical magnetic field strength index that matches the current magnetic field strength index based on the deviation of the intensity index values ​​of the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis.

[0106] Optionally, the matching unit is specifically used to: determine the absolute value of the deviation between the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis; and determine the historical magnetic field strength index whose absolute value of the intensity index on each coordinate axis is less than a preset deviation threshold as the historical magnetic field strength index that matches the current magnetic field strength index.

[0107] Optionally, the historical magnetic field strength index, which includes the strength index value corresponding to each axis of the magnetometer, is represented by a hash value. The heading determination device further includes a hash value calculation module, used to: integerize the strength index value corresponding to each axis of the magnetometer, which includes the current magnetic field strength index, to obtain an integer corresponding to each strength index value included in the current magnetic field strength index; and calculate the hash value of the integer corresponding to each strength index value included in the current magnetic field strength index.

[0108] Optionally, the magnetic field strength matching module 620 is specifically used to: based on the hash value corresponding to each strength index value included in the current magnetic field strength index, index out the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence.

[0109] Optionally, the magnetometer data acquisition module 610 includes: a magnetometer data acquisition unit, used to acquire the magnetic field strength collected by the magnetometer at multiple time points within the set time period; and an averaging unit, used to calculate the average value of the magnetic field strength collected by the magnetometer at the multiple time points to obtain the current magnetic field strength index.

[0110] Optionally, the averaging unit includes: a peak-to-peak value calculation subunit, used to obtain the peak-to-peak value of the magnetic field strength collected by the magnetometer at multiple time points within the set time period on each coordinate axis after obtaining the magnetic field strength collected by the magnetometer at multiple time points within the set time period; and an averaging subunit, used to calculate the average value of the magnetic field strength collected by the magnetometer at multiple time points if the peak-to-peak value of the magnetic field strength on each coordinate axis is less than a preset limit, to obtain the current magnetic field strength index.

[0111] Optionally, the heading determination device further includes: a satellite heading observation module, used to determine the current heading of the terminal device based on the positioning signal if the positioning signal of the navigation satellite system currently received by the terminal device meets the availability conditions; and a correspondence update module, used to update the correspondence based on the current heading and the current magnetic field strength index.

[0112] Optionally, the correspondence update module is specifically used for: if there is no historical magnetic field strength index matching the current magnetic field strength index in the correspondence, then adding the current heading and its corresponding magnetic field strength index to the correspondence; wherein, the magnetic field strength index corresponding to the current heading is the current magnetic field strength index; if there is a historical magnetic field strength index matching the current magnetic field strength index in the correspondence, then calculating the angular deviation between the current heading and the heading corresponding to the matching historical magnetic field strength index; if the angular deviation is greater than a preset deviation, then deleting the matching magnetic field strength index and its corresponding heading from the correspondence.

[0113] Optionally, the heading determination device further includes a reset module, used to reset or delete the correspondence when the terminal device ends navigation.

[0114] The heading determination device provided in this embodiment can be used to execute the heading determination method executed by the server in any of the above embodiments of this disclosure. The implementation principle and technical effect are similar, and will not be repeated here.

[0115] Figure 7 is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. As shown in Figure 7, the electronic device of this embodiment may include: at least one processor 701; and a memory 702 communicatively connected to the at least one processor; wherein, the memory 702 stores instructions executable by the at least one processor 701, and the instructions are executed by the at least one processor 701 to cause the electronic device to perform the method described in any of the above embodiments.

[0116] Optionally, the memory 702 can be either standalone or integrated with the processor 701.

[0117] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.

[0118] This disclosure also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any of the foregoing embodiments.

[0119] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in any of the foregoing embodiments.

[0120] In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.

[0121] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this disclosure.

[0122] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor. The memory may include RAM (Random Access Memory), and may also include NVM (Non-Volatile Memory), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk, or optical disc, etc.

[0123] The aforementioned storage media can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0124] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an application-specific integrated circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0125] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0126] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.

[0128] The above are merely preferred embodiments of this disclosure and do not limit the patent scope of this disclosure. Any equivalent structural or procedural transformations made using the content of this disclosure and its drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this disclosure.

Claims

1. A method for determining a course, wherein, include: The current magnetic field strength index is obtained based on the data collected in real time by the magnetometer on the terminal device within a set time period; If the positioning signal of the navigation satellite system currently received by the terminal device does not meet the availability conditions, then a historical magnetic field strength index that matches the current magnetic field strength index is determined from the correspondence between historical headings and historical magnetic field strength indices. The historical heading corresponding to the matched historical magnetic field strength index in the correspondence is determined as the current heading of the terminal device.

2. The method according to claim 1, wherein, The data collected by the magnetometer includes data from multiple coordinate axes, and the magnetic field strength index includes the strength index value corresponding to each coordinate axis of the magnetometer; The step of determining the historical magnetic field strength index that matches the current magnetic field strength index from the correspondence between historical headings and historical magnetic field strength indices includes: Based on the intensity index values ​​corresponding to each coordinate axis of the magnetometer included in the current magnetic field strength index, a historical magnetic field strength index that matches the current magnetic field strength index is determined from the correspondence.

3. The method according to claim 2, wherein, Based on the current magnetic field strength index, which includes the intensity index values ​​corresponding to each coordinate axis of the magnetometer, historical magnetic field strength indices matching the current magnetic field strength index are determined from the correspondence, including: Based on the intensity index values ​​corresponding to each axis of the magnetometer included in the current magnetic field strength index and the historical magnetic field strength index in the corresponding relationship, the deviation of the intensity index values ​​of the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis is calculated. Based on the deviation of the current magnetic field strength index from the historical magnetic field strength index on each coordinate axis, a historical magnetic field strength index that matches the current magnetic field strength index is determined.

4. The method according to claim 3, wherein, Based on the deviations between the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis, a historical magnetic field strength index matching the current magnetic field strength index is determined, including: Determine the absolute value of the deviation between the current magnetic field strength index and the historical magnetic field strength index on each coordinate axis; Historical magnetic field strength indices whose absolute values ​​of the intensity index values ​​on each coordinate axis are all less than a preset deviation threshold are determined as historical magnetic field strength indices that match the current magnetic field strength index.

5. The method according to claim 2, wherein, The historical magnetic field strength index, including the strength index value corresponding to each axis of the magnetometer, is represented by a hash value. The method further includes: The current magnetic field strength index includes the strength index values ​​corresponding to each axis of the magnetometer, which are then integerized to obtain the integer corresponding to each strength index value included in the current magnetic field strength index. Calculate the hash value of the integer corresponding to each intensity index value included in the current magnetic field strength index; The step of determining a historical magnetic field strength index that matches the current magnetic field strength index from the correspondence between the current magnetic field strength index and the strength index values ​​corresponding to each coordinate axis of the magnetometer includes: Based on the hash value corresponding to each intensity index value included in the current magnetic field strength index, historical magnetic field strength indices that match the current magnetic field strength index are indexed from the correspondence.

6. The method according to any one of claims 1-5, wherein, Based on data collected by the magnetometer on the terminal device within the current time window, the current magnetic field strength index is obtained, including: The magnetic field strength collected by the magnetometer at multiple time points within the set time period is obtained; The average value of the magnetic field strength collected by the magnetometer at multiple time points is calculated to obtain the current magnetic field strength index.

7. The method according to claim 6, wherein, After acquiring the magnetic field strength collected by the magnetometer at multiple time points within the set duration, the method further includes: The peak-to-peak values ​​of the magnetic field strength collected by the magnetometer at multiple time points within the set time period are obtained on each coordinate axis. If the peak-to-peak values ​​of the magnetic field strength on each coordinate axis are all less than the preset limit, then the step of calculating the average value of the magnetic field strength collected by the magnetometer at the multiple time points is executed to obtain the current magnetic field strength index.

8. The method according to any one of claims 1-7, wherein, The method further includes: If the positioning signal from the navigation satellite system currently received by the terminal device meets the availability conditions, then the current heading of the terminal device is determined based on the positioning signal; The correspondence is updated based on the current heading and the current magnetic field strength index.

9. The method according to claim 8, wherein, Based on the current heading and the current magnetic field strength index, update the correspondence, including: If there is no historical magnetic field strength index that matches the current magnetic field strength index in the correspondence, then the current course and its corresponding magnetic field strength index are added to the correspondence; wherein, the magnetic field strength index corresponding to the current course is the current magnetic field strength index. If there is a historical magnetic field strength index that matches the current magnetic field strength index in the correspondence, then calculate the angular deviation between the current heading and the heading corresponding to the matching historical magnetic field strength index; If the angular deviation is greater than the preset deviation, then delete the matched magnetic field strength index and its corresponding heading from the correspondence.

10. An electronic device, wherein, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, cause the electronic device to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium, wherein, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-9.

12. A program product, wherein, Includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-9.