Pedestrian trajectory generation method, device, electronic device and storage medium
By combining historical and real-time sensor data, the coordinate system is converted to generate pedestrian trajectories, the problem of inaccurate positioning of sensors in slow walking or blind spot environments is solved, and the reliability and accuracy of trajectory generation are improved.
Patent Information
- Application Number
- CN202011009098.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-23
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2040-09-23
AI Technical Summary
In places with weak monitoring blind spots and weak GPS signals, pedestrian trajectory positioning is difficult. Sanxuan acceleration sensor cannot output reliable pedestrian direction when walking slowly or moving in place, resulting in trajectory generation deviation.
Use the historical output heading of the previous step end point, the magnetometer output heading of the current step end point and the gyroscope output heading to determine the current output heading, and generate a pedestrian trajectory through the rotation matrix conversion from the carrier coordinate system to the geographical coordinate system. , avoid heading offset caused by single sensor errors.
It improves the reliability and accuracy of pedestrian trajectory generation, enhances positioning availability in various scenarios, and avoids errors caused by sensors caused by time, jitter and magnetic interference.
Smart Images

Figure CN114252068B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of trajectory generation, and in particular to a pedestrian trajectory generation method, device, electronic equipment and storage medium. Background Art
[0002] In recent years, with the rapid construction of video surveillance cameras on urban streets and the development of base station positioning technology, pedestrian positioning and tracking have become very common. However, for some monitoring blind spots and places with weak GPS signals, such as back streets, alleys, underground passages, and forest canyons, it is extremely difficult to quickly and accurately locate pedestrians, and better methods are needed to supplement them. As a necessity in people's lives today, mobile phones can use built-in sensors to reproduce pedestrian trajectories and supplement pedestrian trajectory generation.
[0003] In the related art, the data of the three-axis acceleration sensor is used to calculate the gait frequency, step length and direction, so as to locate the pedestrian. Since the maximum acceleration characteristic value is used as the basis for judging the heading, the output of the three-axis acceleration sensor does not change significantly when the pedestrian walks slowly or walks in place, so the three-axis acceleration sensor cannot output reliable pedestrian direction at any time. Summary of the invention
[0004] The purpose of the present invention is to provide a pedestrian trajectory generation method, device, electronic device and storage medium, which can improve the accuracy of pedestrian heading in pedestrian trajectory generation, improve the usability of generating pedestrian trajectories using internal sensors of electronic devices, and thus improve the user experience.
[0005] In order to solve the above technical problems, the present invention provides a pedestrian trajectory generation method, comprising:
[0006] If the stride end is detected, the historical output heading determined at the previous stride end point, the magnetometer output heading at the stride end point at this moment, and the gyroscope output heading at the stride end point at this moment are obtained;
[0007] Determine the current output heading of the stride end point at this moment by using the historical output heading, the magnetometer output heading and the gyroscope output heading;
[0008] The pedestrian trajectory is generated using the current output heading and stride distance.
[0009] Optionally, the using the historical output heading, the magnetometer output heading and the gyroscope output heading to determine the current output heading of the stride end point at this moment includes:
[0010] Using a rotation matrix from a carrier coordinate system to a geographic coordinate system, converting the heading output by the magnetometer and the heading output by the gyroscope to the geographic coordinate system;
[0011] The current output heading of the stride end point at this moment is determined by using the magnetometer output heading converted to the geographic coordinate system, the gyroscope output heading converted to the geographic coordinate system, and the historical output heading.
[0012] Optionally, before detecting the end of the stride, it also includes:
[0013] Using a three-axis acceleration sensor to obtain a first coordinate of the gravity acceleration in the carrier coordinate system;
[0014] Using a magnetometer to obtain a second coordinate of the magnetic intensity in the carrier coordinate system;
[0015] The rotation matrix is calculated using the first coordinates and the second coordinates.
[0016] Optionally, calculating a rotation matrix using the first coordinates and the second coordinates includes:
[0017] Calculate a pitch angle and a roll angle using the first coordinate and the coordinate of the gravity acceleration in the geographic coordinate system;
[0018] Calculate a heading angle using the second coordinate and the coordinate of the magnetic intensity in the geographic coordinate system;
[0019] The rotation matrix is calculated using the pitch angle, the roll angle and the heading angle.
[0020] Optionally, the obtaining a first coordinate of the gravity acceleration in the carrier coordinate system by using a three-axis acceleration sensor includes:
[0021] The three-axis acceleration sensor is used to obtain a first coordinate of the gravity acceleration in the carrier coordinate system under a preset condition; wherein the preset condition is that the device where the three-axis acceleration sensor is located is in a stationary state.
[0022] Optionally, the initial value of the historical output heading is a fixed value.
[0023] Optionally, the using the historical output heading, the magnetometer output heading and the gyroscope output heading to determine the current output heading of the stride end point at this moment includes:
[0024] Calculating a first absolute value of a difference between the heading output by the magnetometer and the heading output by the gyroscope;
[0025] Calculating a second absolute value of a difference between the magnetometer output heading and the historical output heading;
[0026] The current output heading of the stride end point at this moment is determined by using the first difference absolute value and the second difference absolute value.
[0027] Optionally, the determining the current output heading of the stride end point at this moment by using the first difference absolute value and the second difference absolute value includes:
[0028] When the absolute value of the first difference is less than a first threshold value, and the absolute value of the second difference is less than a second threshold value, weighted calculation is performed on the magnetometer output heading, the gyroscope output heading, and the historical output heading to obtain the current output heading; or,
[0029] When the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, weighted calculation is performed on the magnetometer output heading and the gyroscope output heading to obtain the current output heading; or,
[0030] When the absolute value of the first difference is greater than or equal to the first threshold value, and the absolute value of the second difference is less than the second threshold value, weighted calculation is performed on the magnetometer output heading and the historical output heading to obtain the current output heading; or,
[0031] When the absolute value of the first difference is greater than or equal to the first threshold, and the absolute value of the second difference is greater than or equal to the second threshold, a weighted calculation is performed on the gyroscope output heading and the historical output heading to obtain the current output heading.
[0032] The present invention also provides a pedestrian trajectory generating device, comprising:
[0033] An acquisition module, for acquiring, if a stride end is detected, a historical output heading determined at a previous stride end point, a magnetometer output heading at a current stride end point, and a gyroscope output heading at the current stride end point;
[0034] A calculation module, used for determining the current output heading of the stride end point at this moment by using the historical output heading, the magnetometer output heading and the gyroscope output heading;
[0035] The generation module is used to generate a pedestrian trajectory using the current output heading and stride distance.
[0036] The present invention also provides an electronic device, comprising:
[0037] Memory for storing computer programs;
[0038] A processor is used to implement the steps of the pedestrian trajectory generation method as described above when executing the computer program.
[0039] The present invention also provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the pedestrian trajectory generation method as described above are implemented.
[0040] The present invention provides a method for generating pedestrian trajectories, comprising: if a stride end is detected, obtaining a historical output heading determined at a previous stride end point, a magnetometer output heading at a current stride end point, and a gyroscope output heading at the current stride end point; using the historical output heading, the magnetometer output heading, and the gyroscope output heading to determine a current output heading at the current stride end point; and using the current output heading and the stride distance to generate a pedestrian trajectory.
[0041] It can be seen that in the pedestrian trajectory generation method, the historical output heading of the previous stride end point, as well as the magnetometer output heading and gyroscope output heading of the current stride end point are used to determine the current output heading of the current stride end point. When a sensor output heading or a historical output heading is unreliable, other output headings can be used for correction, effectively avoiding the heading output error problem caused by using only one sensor, such as the accumulated error of the acceleration sensor over time, the drift error of the gyroscope caused by jitter and the surrounding environment, and the error caused by magnetic interference of the magnetometer, etc., significantly improving the reliability of pedestrian positioning using the internal sensors of electronic devices. At the same time, since the pedestrian trajectory generation method uses the magnetometer output heading and the gyroscope output heading, and is not based on the maximum acceleration characteristic value, it can output the heading when the pedestrian walks slowly or walks in place. Therefore, it can further improve the usability of pedestrian positioning using the internal sensors of electronic devices in more scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A flowchart of a pedestrian trajectory generation method provided by an embodiment of the present invention;
[0044] Figure 2 A flowchart of another pedestrian trajectory generation method provided by an embodiment of the present invention;
[0045] Figure 3 A structural block diagram of a pedestrian trajectory generating device provided by an embodiment of the present invention;
[0046] Figure 4 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] In the related art, pedestrian trajectories are generated using sensors built into electronic devices. Generally, a three-axis acceleration sensor is used to generate the walking direction of pedestrians, and the maximum acceleration characteristic value is the basis for judging the pedestrian heading output by the three-axis acceleration sensor. Since the pedestrian heading generated based on the maximum acceleration characteristic value will not change significantly when the pedestrian walks slowly or walks in place, the heading is unreliable in this case. This shows that the three-axis acceleration sensor cannot generate a reliable pedestrian heading at any time, which causes deviations in the generated pedestrian trajectory, and ultimately affects the reliability of the pedestrian trajectory generated using the built-in sensors of the electronic device. The embodiment of the present application uses the historical output heading of the previous stride end point, as well as the magnetometer output heading and gyroscope output heading of the current stride point to determine the current output heading of the current stride point, which can effectively avoid the heading deviation caused by the erroneous output of a single sensor, thereby improving the accuracy of the pedestrian heading output by the built-in sensor of the electronic device, and ultimately improving the reliability of the pedestrian trajectory. For details, please refer to Figure 1 , Figure 1 A flowchart of a pedestrian trajectory generation method provided in an embodiment of the present application may include:
[0049] S100, if the stride end is detected, obtaining the historical output heading determined at the previous stride end point, the magnetometer output heading at the stride end point at this moment, and the gyroscope output heading at the stride end point at this moment;
[0050] In the related art, since only a three-axis acceleration sensor is used as the sole source of the pedestrian's heading, and since the maximum acceleration characteristic value is used as the basis for the heading output, it is impossible to produce a significant change in the change of the pedestrian's direction when the pedestrian walks slowly or walks in place, and therefore, the accuracy of the pedestrian's heading cannot be guaranteed. At the same time, it should also be considered that the gyroscope has a drift problem, and the heading angle obtained by the angular velocity integration mechanism will accumulate over time. Although the magnetometer does not produce accumulation errors, it is easily affected by the surrounding magnetic field. After research, it was found that the use of a single sensor to output the pedestrian's heading will inevitably produce a heading deviation, and the reliability of the output heading cannot be guaranteed. Therefore, the embodiment of the present application uses the historical output heading, the magnetometer output heading and the gyroscope output heading to jointly determine the output heading of the stride end point at this moment. When a single sensor has an output deviation, the output heading of the stride end point at this moment can be corrected using other output headings, thereby improving the heading deviation problem caused by the output error of a single sensor. At the same time, since the heading output by the magnetometer and the heading output by the gyroscope are not based on the maximum acceleration characteristic value, they can respond to the direction changes of pedestrians when they walk slowly or walk in place, which can further improve the accuracy and reliability of the output heading.
[0051] When the stride ends at this moment, the output heading of the magnetometer and the output heading of the gyroscope are obtained, and the pedestrian heading output by the sensor can be used to update the current output navigation of the stride end point at this moment. At the same time, the historical output heading determined at the previous stride end point is obtained as a reference and backup information for the output heading of the stride end point at this moment. When the sensor outputs the heading incorrectly under external interference, the output heading of the stride end point at this moment is corrected. At the same time, the current output heading of the stride end point at this moment will also be used as the historical output heading of the next round of heading determination process, providing reference and backup for the heading determination of the next stride end point to ensure the reliability of the output heading. It can be understood that the embodiment of the present application does not limit the detection method of the stride end, and the user can select a suitable detection method according to the existing scheme for detecting the stride end. At the same time, the embodiment of the present application does not limit the specific method of obtaining the output heading of the magnetometer and gyroscope, and the user can select a suitable acquisition method according to the working principle of the existing magnetometer and gyroscope. Generally speaking, a magnetometer models and calculates the heading by sensing changes in the magnetic field and outputs the heading angle, so the output result of the magnetometer can be directly obtained; while a gyroscope outputs the angular velocity of the carrier on which the gyroscope is located, so the output heading of the gyroscope can be obtained by integrating the angular velocity.
[0052] For the situation where the stride end is detected for the first time, since there is no calculation result of the previous stride end point, it is necessary to set the initial value of the historical output heading to calculate the output heading for the first time. The embodiment of the present application does not limit the setting method of the initial value of the historical output heading, as long as the initial value can participate in the subsequent process of determining the current output heading of the stride end point at this moment. For example, it can be directly set to a fixed value, or the output heading of a certain sensor can be read as the initial value. Since the initial value of the historical output heading has little effect on the output heading value of the first stride end point and the generation of the pedestrian trajectory, in the embodiment of the present application, the initial value of the historical output heading can be set to a fixed value. The embodiment of the present application also does not limit the specific numerical value of the fixed value, as long as the fixed value is a legal value that can participate in the subsequent process.
[0053] S101, using the historical output heading, the magnetometer output heading and the gyroscope output heading to determine the current output heading of the stride end point at this moment;
[0054] In the related art, since only a three-axis acceleration sensor is used to output the pedestrian's heading, when the output heading deviates, the three-axis acceleration sensor cannot judge and correct it in time. Therefore, the embodiment of the present application uses the historical output heading of the previous stride end point, as well as the magnetometer output heading and gyroscope output heading of the current stride end point to jointly determine the current output heading of the current stride end point. When the output heading of a single sensor or the historical output heading deviates, it can judge and correct it in time, thereby effectively avoiding the heading deviation problem caused by the wrong output heading of a single sensor, and can improve the reliability of pedestrian trajectory generated by the built-in sensor of the electronic device.
[0055] The embodiment of the present application does not limit the determination process of the current output heading. For example, the process can be to directly use the historical output heading, the magnetometer output heading and the gyroscope output heading for calculation to obtain the current output heading, or it can be to first judge the historical output heading, the magnetometer output heading and the gyroscope output heading, select a reliable output heading, and calculate these output headings to obtain the current output heading. Considering that when a certain output heading deviates, directly using the output heading and other output headings for calculation will directly bring the error value into the calculation result, thereby reducing the accuracy of the current output heading. Therefore, in order to improve the accuracy of the current output heading, in the embodiment of the present application, the determination process of the current output heading can be: first judge the historical output heading, the magnetometer output heading and the gyroscope output heading, select a reliable output heading, and finally calculate these output headings to obtain the current output heading.
[0056] Of course, the embodiment of the present application does not limit the judgment process of the reliability of the historical output heading, the magnetometer output heading and the gyroscope output heading. For example, the judgment process can be to use the size relationship of the absolute value of the difference between the output headings to select a pair with the smallest absolute value of the difference as a reliable output heading, or to use the relationship between the absolute value of the difference between the output headings and a preset threshold to determine the reliable output heading. Considering that the absolute value of the difference between the output headings may be large, even if a pair with the smallest absolute value of the difference is selected, there is still a large deviation. Therefore, in the embodiment of the present application, the judgment process of the reliability of the historical output heading, the magnetometer output heading and the gyroscope output heading can be: the first output heading and the second output heading are calculated to obtain a first absolute value of the difference, the first output heading and the third output heading are calculated to obtain a second absolute value of the difference, and the first absolute value of the difference and the second absolute value of the difference are used to determine the current output heading at the end point of the stride at this moment. It should be noted that the embodiment of the present application does not limit the output headings to which the first output heading, the second output heading and the third output heading specifically refer. As long as they can be distinguished from each other, they can be any one of the historical output headings, the magnetometer output heading and the gyroscope output heading.
[0057] After calculating the absolute value of the first difference and the absolute value of the second difference, the reliability of the three output headings can be judged using the preset threshold. It should be noted that the embodiment of the present application does not limit the specific value of the preset threshold, and the user can choose according to the actual situation. At the same time, the embodiment of the present application does not limit the situation where the absolute value of the difference is equal to the preset threshold. When the absolute value of the difference is equal to the preset threshold, the two output headings corresponding to the absolute value of the difference can be considered reliable or unreliable. In one possible situation, the judgment process of the three output headings in the embodiment of the present application is:
[0058] When the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is less than the second threshold value, the first output heading, the second output heading, and the third output heading are considered to be reliable, and the first output heading, the second output heading, and the third output heading are calculated; or,
[0059] When the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, the first output heading and the second output heading are considered reliable, and the first output heading and the second output heading are calculated; or,
[0060] When the absolute value of the first difference is greater than or equal to the first threshold, and the absolute value of the second difference is less than the second threshold, the first output heading and the third output heading are considered reliable, and the first output heading and the third output heading are calculated; or,
[0061] When the absolute value of the first difference is greater than or equal to the first threshold, and the absolute value of the second difference is greater than or equal to the second threshold, the second output heading and the third output heading are considered reliable, and the second output heading and the third output heading are calculated.
[0062] Through the above process, the reliability of the three output headings can be judged, and a pair of reliable output headings can be selected for calculation to obtain the current output heading.
[0063] It should be noted that the present embodiment of the application does not limit the calculation method of the current output heading, for example, it can be an average calculation or a weighted calculation. Considering that the historical output heading is the calculation result of the previous stride end point, it can only serve as a reference for the current output heading of the stride end point at this moment, and the weight should be lower than the magnetometer output heading and the gyroscope output heading. Therefore, in the present embodiment of the application, the calculation method of the current output heading can be a weighted calculation.
[0064] The following is an explanation of the process of determining the current output heading using a specific example:
[0065] The historical output heading at the end point of the previous step is ω p , the magnetometer output heading at the end of the step is ω m At this moment, the gyro output heading at the end of the step is ω g The absolute value of the difference between the heading output by the magnetometer and the heading output by the gyroscope is The reliable threshold is The absolute value of the difference between the magnetometer output heading and the historical output heading is The reliable threshold is The process of determining the current output heading at the stride end point is:
[0066] when The magnetometer output heading, gyroscope output heading and historical output heading are weighted and calculated as follows:
[0067] ω cons =α gmp (α g ω g +α m ω m +α p ω p )
[0068] where ω cons This is the current output heading of the step end point at this moment, α gmp is the weight coefficient when calculating the magnetometer output heading, gyroscope output heading and historical output heading together, α g is the weight coefficient of the gyroscope output heading, α mis the weight coefficient of the magnetometer output heading, α p is the weight coefficient for the historical output heading; or,
[0069] when Then the heading output by the magnetometer and the heading output by the gyroscope are weighted and calculated as follows:
[0070] ω cons =α gm (α g ω g +α m ω m )
[0071] where α gm The weight coefficient for calculating the heading output by the magnetometer and the heading output by the gyroscope; or,
[0072] when Then the magnetometer output heading and the historical output heading are weighted and calculated as follows:
[0073] ω cons =α pm (α m ω m +α p ω p )
[0074] where α pm The weight coefficient for calculating the magnetometer output heading and the historical output heading together; or,
[0075] when The gyroscope output heading and the historical output heading are weighted and calculated as follows:
[0076] ω cons =α gp (α g ω g +α p ω p )
[0077] where α gp The weight coefficient for calculating the gyroscope output heading and the historical output heading together.
[0078] After the above process, the current output heading can be determined.
[0079] Further, the embodiment of the present application does not limit the coordinate system based on which the historical output heading, the magnetometer output heading and the gyroscope output heading are based, for example, it can be the carrier coordinate system of the electronic device where the sensor is located, or it can be the geographic coordinate system relative to the earth. The user can select a suitable coordinate system according to actual needs. For example, when the electronic device where the sensor is located can maintain a fixed posture, such as always maintaining a horizontal or vertical state, the carrier coordinate system can be fixed relative to the ground. At this time, it can be considered that all headings output by the sensor based on the carrier coordinate system are on the same plane, and this plane is parallel to the ground. Therefore, it can meet the needs of outputting pedestrian headings parallel to the two-dimensional plane where the ground is located and generating pedestrian trajectories. Therefore, the coordinate system can be set to the carrier coordinate system; when the electronic device where the sensor is located cannot maintain a relatively fixed posture, since the carrier coordinate system will change with the change of the device posture, it cannot be guaranteed that all headings output by the sensor based on the carrier coordinate system are on the same plane parallel to the ground, which may lead to erroneous output of pedestrian headings and generate erroneous pedestrian trajectories. Therefore, the coordinate system can be set to the geographic coordinate system at this time. Since the geographic coordinate system is stationary relative to the ground, converting the output heading of the sensor to the geographic coordinate system can meet the requirements of outputting the pedestrian heading parallel to the two-dimensional plane where the ground is located and generating the pedestrian trajectory to ensure the accuracy of the output pedestrian trajectory.
[0080] Similarly, the embodiment of the present application does not limit whether the magnetometer output heading and the gyroscope output heading need to be converted to the geographic coordinate system, which is based on whether the user selects the geographic coordinate system as the coordinate system for outputting the heading. When the user chooses to output the heading in the carrier coordinate system, no coordinate system conversion is required; and when the user chooses to output the heading in the geographic coordinate system, since the original output of the magnetometer and gyroscope is based on the carrier coordinate system, the original output needs to be converted from the carrier coordinate system to the geographic coordinate system.
[0081] It is understandable that, since the historical output heading is a calculated result, it is mainly updated by the magnetometer output heading and the gyroscope output heading. Therefore, the form of the historical output heading is determined by the magnetometer output heading and the gyroscope output heading. That is, when the coordinate system based on the output headings of the two sensors is the geographic coordinate system, the coordinate system based on the historical output heading is also the geographic coordinate system. Therefore, when the coordinate system needs to be converted, it is only necessary to convert the magnetometer output heading and the gyroscope output heading, and there is no need to convert the coordinate system of the historical output heading.
[0082] S102: Generate a pedestrian trajectory using the current output heading and stride distance.
[0083] After determining the current output heading using the historical output heading, the magnetometer output heading at the stride end point, and the gyroscope output heading, a reliable pedestrian trajectory can be generated in combination with the stride distance. Therefore, the embodiment of the present application improves the reliability of the pedestrian trajectory by improving the accuracy of the output heading, thereby improving the reliability and usability of generating pedestrian trajectories using built-in sensors of electronic devices.
[0084] The embodiment of the present application does not limit the form and acquisition method of the stride distance. The user can select the appropriate form and acquisition method of the stride distance according to the existing stride distance acquisition method and principle. The embodiment of the present application also does not limit the method of generating the pedestrian trajectory when the pedestrian heading and the pedestrian stride distance have been obtained. The user can select the appropriate method according to the existing scheme. For example, it can be to first use the stride end point at the moment as the center of the circle, and draw a line segment with a length of the pedestrian stride distance in any direction, and then rotate the line segment to the direction corresponding to the pedestrian heading. It can also be to first calculate the position of the stride end point at the moment, and then connect the stride end point at the moment with the previous stride end point to form a pedestrian trajectory. Taking into account the generation efficiency, in the embodiment of the present application, the method of generating the pedestrian trajectory when the pedestrian heading and the pedestrian stride distance have been obtained can be: first calculate the position of the stride end point at the moment, and then connect the stride end point at the moment with the previous stride end point to form a pedestrian trajectory. Of course, the present embodiment does not limit the calculation method of the stride end point position at this moment, and the user can select an existing calculation method. For example, in one possible case, the coordinates of the pedestrian at the n-1th stride end point are (E n-1 , N n-1 ), the stride distance to the end point of the nth stride is L, then the coordinates of the pedestrian at the end point of the nth stride (E n , N n ) can be:
[0085] E n =E n-1 +L·sinω cons
[0086] N n =N n-1 +L·cosω cons
[0087] Among them, ω cons Indicates the current output heading at the end point of the stride at this moment.
[0088] It should be noted that the embodiments of the present application do not affect n, L, (E n-1 , N n-1 ) is limited to a specific value.
[0089] Based on the above embodiments, in the pedestrian trajectory generation method, the historical output heading of the previous stride end point, as well as the magnetometer output heading and gyroscope output heading of the stride end point at the moment, are used to determine the current output heading of the stride end point at the moment. The output heading deviation of the sensor can be judged in time, and corrected using other output headings to ensure the accuracy of the current output heading. This effectively solves the problem that when only a single sensor is used, the sensor generates a heading error due to time or external interference, and outputs an erroneous heading, such as the accumulated error of the acceleration sensor due to changes over time, the drift error of the gyroscope due to jitter and the influence of the surrounding environment, the error caused by magnetic interference of the magnetometer, etc., and the erroneous output heading cannot be judged and corrected in time, thereby significantly improving the reliability of pedestrian positioning using sensors inside electronic devices.
[0090] Based on the above embodiments, since pedestrians carry electronic devices in various ways, requiring users to carry electronic devices in the same electronic device posture every time is obviously not in line with actual application scenarios. Therefore, this embodiment adopts the method of transforming the coordinate system to allow users to carry electronic devices in different device postures. For details, please refer to Figure 2 , Figure 2 A flowchart of another pedestrian trajectory generation method provided in an embodiment of the present application, the method may include:
[0091] S200, if the stride end is detected, obtaining the historical output heading determined at the previous stride end point, the magnetometer output heading at the stride end point at this moment, and the gyroscope output heading at the stride end point at this moment;
[0092] S201, using the rotation matrix from the carrier coordinate system to the geographic coordinate system, converting the heading output by the magnetometer and the heading output by the gyroscope to the geographic coordinate system;
[0093] When the electronic device where the sensor is located cannot maintain a relatively fixed posture, the carrier coordinate system cannot be fixed relative to the ground, and thus cannot ensure that the heading output by the sensor based on the carrier coordinate system is always parallel to the two-dimensional plane where the ground is located, and cannot meet the requirements of outputting the pedestrian heading parallel to the two-dimensional plane where the ground is located and generating pedestrian trajectories. The geographic coordinate system is always fixed relative to the ground, so converting the output heading of the sensor from the carrier coordinate system to the geographic coordinate system can ensure that the output heading is parallel to the two-dimensional plane where the ground is located, and thus output the correct pedestrian heading and generate the correct pedestrian trajectory.
[0094] The embodiment of the present application does not limit the form of the rotation matrix. The user can refer to the existing rotation matrix of the three-dimensional coordinate system transformation. At the same time, the embodiment of the present application does not limit the calculation process of using the rotation matrix to transform the coordinate system. The user can refer to the existing calculation process of using the rotation matrix to transform the vector coordinate system. For example, in one possible case, is the rotation matrix, O is the output heading of the sensor based on the carrier coordinate system, and the output heading O′ based on the geographic coordinate system is:
[0095]
[0096] It should be noted that the embodiment of the present application does not limit the location of the step of setting the rotation matrix, and the setting step can be located at any position in the scheme provided in the present embodiment. In order to avoid overlapping with the steps of pedestrian trajectory generation and affecting the output heading calculation of the stride end point at this moment, in the embodiment of the present application, the step of setting the rotation matrix can be located before step S200. At the same time, the embodiment of the present application does not limit the timing of setting the rotation matrix. For example, the rotation matrix can be set all the time, or the rotation matrix can be set at fixed intervals. The user can choose the appropriate setting time according to the actual situation. For example, when the electronic device where the sensor is located is always in motion, the rotation matrix needs to be updated in real time to ensure the accuracy of the output heading. At this time, the rotation matrix can be set all the time. When the electronic device where the sensor is located is not in motion, the rotation matrix can be set at fixed intervals. Of course, the embodiment of the present application does not limit the specific value of the fixed time.
[0097] The embodiment of the present application does not limit the setting process of the rotation matrix. For example, the setting process may be to use a three-axis acceleration sensor and a gyroscope to obtain two postures respectively, and fuse the two postures to obtain a rotation matrix. It may also be to use a three-axis acceleration sensor and a magnetometer to obtain the coordinates of gravity acceleration and magnetic intensity in the carrier coordinate system respectively, and then use these coordinates to calculate the rotation matrix. In order to set the rotation matrix more efficiently, in the embodiment of the present application, the setting process of the rotation matrix may be:
[0098] Using a three-axis acceleration sensor to obtain a first coordinate of the gravity acceleration in the carrier coordinate system;
[0099] Using a magnetometer to obtain a second coordinate of the magnetic intensity in the carrier coordinate system;
[0100] Computes a rotation matrix using the first and second coordinates.
[0101] It should be noted that the embodiments of the present application do not limit the specific method of using a three-axis acceleration sensor to obtain the first coordinate of gravity acceleration in the carrier coordinate system and a magnetometer to obtain the second coordinate of magnetic intensity in the carrier coordinate system. Users can refer to related technologies.
[0102] The embodiments of the present application also do not limit the timing when the three-axis acceleration sensor obtains the first coordinate of the gravity acceleration in the carrier coordinate system. For example, the three-axis acceleration sensor can always obtain the coordinates of the gravity acceleration in the carrier coordinate system, or it can obtain the coordinates of the gravity acceleration in the carrier coordinate system under preset conditions. In order to further improve the accuracy of the coordinates, in the embodiments of the present application, the coordinates of the gravity acceleration in the carrier coordinate system can be obtained under preset conditions. The embodiments of the present application do not limit specific preset conditions. For example, it can be when the device where the three-axis sensor is located is in a stationary state, or when the device where the three-axis sensor is located is moving at a uniform speed. In order to simplify the process of obtaining coordinates, in the embodiments of the present application, the preset condition can be when the device where the three-axis sensor is located is in a stationary state.
[0103] The embodiment of the present application does not limit the process of calculating the rotation matrix using the first coordinate and the second coordinate. For example, the first coordinate and the second coordinate can be used to calculate any unit vector perpendicular to the origin, the plane where the first coordinate and the second coordinate are located, and obtain the third coordinate, and then the first coordinate, the second coordinate and the third coordinate are used to calculate the rotation matrix. It can also be that the pitch angle, the roll angle and the heading angle are calculated from the first coordinate and the second coordinate, and then the pitch angle, the roll angle and the heading angle are used to calculate the rotation matrix. In order to improve the calculation efficiency, in the embodiment of the present application, the process of calculating the rotation matrix using the first coordinate and the second coordinate can be:
[0104] Using the first coordinate and the coordinate of the gravitational acceleration in the geographic coordinate system, the pitch angle and the roll angle are calculated;
[0105] Calculate the heading angle using the second coordinate and the coordinate of the magnetic intensity in the geographic coordinate system;
[0106] Using the pitch, roll and heading angles, calculate the rotation matrix.
[0107] The following is an explanation of the setting process of the above rotation matrix with a specific example:
[0108] The first coordinate of the gravity acceleration obtained by the triaxial acceleration sensor in the carrier coordinate system is (a x , a y , a z ), the second coordinate of the magnetic intensity obtained by the magnetometer in the carrier coordinate system is (m x , m y , m z The coordinates of gravity acceleration in the geographic coordinate system are (a e , a n , a u ), the coordinates are (0, 0, g) in a stationary state. Therefore, when the electronic device where the triaxial acceleration sensor is located is in a stationary state, equation 1 can be obtained:
[0109]
[0110] in, is the unknown rotation matrix. Solving this equation can calculate the pitch angle θ and the roll angle The coordinates of magnetic intensity in the geographic coordinate system are (m e , m n , m d ), so we can get equation 2:
[0111]
[0112] Solving this equation yields the heading angle Finally, solve equation 1 and equation 2 together to get the rotation matrix
[0113] S202 , using the magnetometer output heading converted to the geographic coordinate system, the gyroscope output heading converted to the geographic coordinate system, and the historical output headings to determine the current output heading of the stride end point at this moment.
[0114] S203: Generate a pedestrian trajectory using the current output heading and stride distance.
[0115] Based on the above embodiments, the pedestrian trajectory generation method uses a rotation matrix to convert the magnetometer output heading and the gyroscope output heading from the carrier coordinate system to the geographic coordinate system, so as to ensure that the pedestrian heading parallel to the ground can be output to the geographic coordinate system under various electronic device postures, and the pedestrian trajectory can be generated, thereby avoiding the difficulties brought to users by fixing electronic devices and improving the user experience.
[0116] The following is an introduction to a pedestrian trajectory generation device, an electronic device, and a storage medium provided in an embodiment of the present invention. The pedestrian trajectory generation device, electronic device, and storage medium described below can correspond to the pedestrian trajectory generation method described above.
[0117] Please refer to Figure 3 , Figure 3 A structural block diagram of a pedestrian trajectory generation device provided in an embodiment of the present application, the device may include
[0118] The acquisition module 100 is used to acquire the historical output heading determined at the previous stride end point, the magnetometer output heading at the stride end point at the current stride end point, and the gyroscope output heading at the current stride end point if the stride end is detected;
[0119] The calculation module 200 is used to determine the current output heading of the stride end point at this moment by using the historical output heading, the magnetometer output heading and the gyroscope output heading;
[0120] The generation module 300 is used to generate a pedestrian trajectory using the current output heading and stride distance.
[0121] Based on any of the above embodiments, the calculation module 200 may further include:
[0122] A conversion module, used for converting the heading output by the magnetometer and the heading output by the gyroscope to the geographic coordinate system by using a rotation matrix from the carrier coordinate system to the geographic coordinate system;
[0123] The second calculation module is used to determine the current output heading of the stride end point at this moment by using the magnetometer output heading converted to the geographic coordinate system, the gyroscope output heading converted to the geographic coordinate system, and the historical output heading.
[0124] Based on any of the above embodiments, the device may further include:
[0125] A second acquisition module, used for acquiring a first coordinate of the gravity acceleration in the carrier coordinate system by using a three-axis acceleration sensor;
[0126] A third acquisition module, used for acquiring a second coordinate of the magnetic intensity in the carrier coordinate system by using a magnetometer;
[0127] The third calculation module is used to calculate the rotation matrix using the first coordinates and the second coordinates.
[0128] Based on any of the above embodiments, the third calculation module may further include:
[0129] A fourth calculation module, used to calculate the pitch angle and the roll angle using the first coordinate and the coordinate of the gravitational acceleration in the geographic coordinate system;
[0130] A fifth calculation module, used to calculate the heading angle using the second coordinate and the coordinate of the magnetic intensity in the geographic coordinate system;
[0131] The sixth calculation module is used to calculate the rotation matrix using the pitch angle, the roll angle and the heading angle.
[0132] Based on any of the above embodiments, the fourth calculation module is used to obtain the first coordinate of the gravity acceleration in the carrier coordinate system under preset conditions using the three-axis acceleration sensor; wherein the preset condition is that the device where the three-axis acceleration sensor is located is in a stationary state.
[0133] Based on any of the above embodiments, the calculation module 200 may further include:
[0134] A seventh calculation module, used for calculating a first absolute value of a difference between a heading output by the magnetometer and a heading output by the gyroscope;
[0135] An eighth calculation module, used for calculating a second absolute value of a difference between a heading output by the magnetometer and a heading output by a history;
[0136] The ninth calculation module is used to determine the current output heading of the stride end point at this moment by using the first difference absolute value and the second difference absolute value.
[0137] Based on any of the above embodiments, the ninth calculation module is used to perform weighted calculation on the magnetometer output heading, the gyroscope output heading and the historical output heading to obtain the current output heading when the absolute value of the first difference is less than the first threshold and the absolute value of the second difference is less than the second threshold; or,
[0138] When the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, weighted calculation is performed on the magnetometer output heading and the gyroscope output heading to obtain the current output heading; or,
[0139] When the absolute value of the first difference is greater than or equal to the first threshold value, and the absolute value of the second difference is less than the second threshold value, weighted calculation is performed on the magnetometer output heading and the historical output heading to obtain the current output heading; or,
[0140] When the absolute value of the first difference is greater than or equal to the first threshold, and the absolute value of the second difference is greater than or equal to the second threshold, a weighted calculation is performed on the gyroscope output heading and the historical output heading to obtain the current output heading.
[0141] It should be noted that, based on any of the above embodiments, the device may be implemented based on a programmable logic device, which includes an FPGA, a CPLD, a single-chip microcomputer, a processor, etc. These programmable logic devices may be arranged in an electronic device.
[0142] Please refer to Figure 4 , Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of the present application; the electronic device 400 may include a processor 401 and a memory 402, and of course, may further include a multimedia component 403, an information input / information output (I / O) interface 404, and one or more of a communication component 405.
[0143] The processor 401 is used to control the overall operation of the electronic device 400 to complete all the steps in the pedestrian trajectory generation described above; the memory 402 is used to store various types of data to support various operations that the processor 401 needs to perform, and these data may include, for example, instructions for any application or method used to operate on the electronic device 400, and data related to the application. The memory 402 can be implemented by 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 memory, flash memory, magnetic disk or optical disk. One or more.
[0144] The I / O interface 404 provides an interface between the processor 401 and other interface modules, and the above-mentioned other interface modules can be a keyboard, a mouse. The communication component 405 is used for wired or wireless communication between the electronic device 400 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 405 may include: Wi-Fi module, Bluetooth module, NFC module.
[0145] In an exemplary embodiment, the electronic device 400 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the pedestrian trajectory generation method given in the above embodiment.
[0146] Based on the above embodiments, in order to further improve the efficiency of the electronic device in acquiring sensor data, in this embodiment, the electronic device may further include a magnetometer, a gyroscope, and a three-axis acceleration sensor.
[0147] Of course, this embodiment does not limit other components required for the electronic device, and specific reference may be made to the configuration of existing electronic devices.
[0148] The present application also provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the pedestrian trajectory generation method described in any of the above embodiments are implemented. For example, when the computer program is executed by a processor, if the end of a stride is detected, the historical output heading of the previous stride end point, the magnetometer output heading of the stride end point at this moment, and the gyroscope output heading of the stride end point at this moment are obtained; the current output heading of the stride end point at this moment is determined by using the historical output heading, the magnetometer output heading, and the gyroscope output heading; and the pedestrian trajectory is generated by using the current output heading and the stride distance.
[0149] The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0150] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0151] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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 invention.
[0152] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0153] The above is a detailed introduction to a pedestrian trajectory generation method, device, electronic device and storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A pedestrian trajectory generation method, characterized in that: include: If the stride end is detected, the historical output heading determined at the previous stride end point, the magnetometer output heading at the stride end point at this moment, and the gyroscope output heading at the stride end point at this moment are obtained; Determine the current output heading of the stride end point at this moment by using the historical output heading, the magnetometer output heading and the gyroscope output heading; Generate a pedestrian trajectory using the current output heading and stride distance; The method of using the historical output heading, the magnetometer output heading and the gyroscope output heading to determine the current output heading of the stride end point at this moment includes: Calculating a first absolute value of the difference between the magnetometer output heading and the gyroscope output heading; calculating a second absolute value of the difference between the magnetometer output heading and the historical output heading; determining the current output heading of the stride end point at this moment by using the first absolute value of the difference and the second absolute value of the difference; The determining the current output heading of the stride end point at this moment by using the first difference absolute value and the second difference absolute value comprises: When the absolute value of the first difference is less than a first threshold value, and the absolute value of the second difference is less than a second threshold value, the magnetometer output heading, the gyroscope output heading and the historical output heading are weightedly calculated to obtain the current output heading; or, when the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, the magnetometer output heading and the gyroscope output heading are weightedly calculated to obtain the current output heading; or, when the absolute value of the first difference is greater than or equal to the first threshold value, and the absolute value of the second difference is less than the second threshold value, the magnetometer output heading and the historical output heading are weightedly calculated to obtain the current output heading; or, when the absolute value of the first difference is greater than or equal to the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, the gyroscope output heading and the historical output heading are weightedly calculated to obtain the current output heading.
2. The pedestrian trajectory generation method according to claim 1, characterized in that: The method of using the historical output heading, the magnetometer output heading and the gyroscope output heading to determine the current output heading of the stride end point at this moment includes: Using a rotation matrix from a carrier coordinate system to a geographic coordinate system, converting the heading output by the magnetometer and the heading output by the gyroscope to the geographic coordinate system; The current output heading of the stride end point at this moment is determined by using the magnetometer output heading converted to the geographic coordinate system, the gyroscope output heading converted to the geographic coordinate system, and the historical output heading.
3. The pedestrian trajectory generation method according to claim 2, characterized in that: Before the end of the stride is detected, it also includes: Using a three-axis acceleration sensor to obtain a first coordinate of the gravity acceleration in the carrier coordinate system; Using a magnetometer to obtain a second coordinate of the magnetic intensity in the carrier coordinate system; The rotation matrix is calculated using the first coordinates and the second coordinates.
4. The pedestrian trajectory generation method according to claim 3, characterized in that: The calculating the rotation matrix using the first coordinate and the second coordinate includes: Calculate a pitch angle and a roll angle using the first coordinate and the coordinate of the gravity acceleration in the geographic coordinate system; Calculate a heading angle using the second coordinate and the coordinate of the magnetic intensity in the geographic coordinate system; The rotation matrix is calculated using the pitch angle, the roll angle and the heading angle.
5. The pedestrian trajectory generation method according to claim 3, characterized in that: The method of obtaining a first coordinate of the gravity acceleration in the carrier coordinate system by using a three-axis acceleration sensor includes: The three-axis acceleration sensor is used to obtain a first coordinate of the gravity acceleration in the carrier coordinate system under a preset condition; wherein the preset condition is that the device where the three-axis acceleration sensor is located is in a stationary state.
6. The pedestrian trajectory generation method according to claim 1, characterized in that: The initial value of the historical output heading is a fixed value.
7. A pedestrian trajectory generating device, characterized in that: include: An acquisition module, for acquiring, if a stride end is detected, a historical output heading determined at a previous stride end point, a magnetometer output heading at a current stride end point, and a gyroscope output heading at the current stride end point; A calculation module, used for determining the current output heading of the stride end point at this moment by using the historical output heading, the magnetometer output heading and the gyroscope output heading; A generation module, used to generate a pedestrian trajectory using the current output heading and stride distance; Wherein, the calculation module includes: A seventh calculation module, used for calculating a first absolute value of a difference between a heading output by the magnetometer and a heading output by the gyroscope; An eighth calculation module, used for calculating a second absolute value of a difference between a heading output by the magnetometer and a heading output by a historical source; A ninth calculation module, used for determining a current output heading of the stride end point at this moment by using the first difference absolute value and the second difference absolute value; The ninth calculation module is used for performing weighted calculation on the magnetometer output heading, the gyroscope output heading and the historical output heading to obtain the current output heading when the absolute value of the first difference is less than the first threshold value and the absolute value of the second difference is less than the second threshold value; or, When the absolute value of the first difference is less than the first threshold value, and the absolute value of the second difference is greater than or equal to the second threshold value, weighted calculation is performed on the magnetometer output heading and the gyroscope output heading to obtain the current output heading; or, When the absolute value of the first difference is greater than or equal to the first threshold value, and the absolute value of the second difference is less than the second threshold value, weighted calculation is performed on the magnetometer output heading and the historical output heading to obtain the current output heading; or, When the absolute value of the first difference is greater than or equal to the first threshold, and the absolute value of the second difference is greater than or equal to the second threshold, a weighted calculation is performed on the gyroscope output heading and the historical output heading to obtain the current output heading.
8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the pedestrian trajectory generation method as described in any one of claims 1 to 6 when executing the computer program.
9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the pedestrian trajectory generation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Course angle obtaining method based on inertial sensor
CN104121905A
Positioning method and device and mobile terminal
CN109470238A
Positioning method and system based on Kalman filtering, equipment and storage medium
CN109883423A
Indoor pedestrian course fusion constraint algorithm based on inertial system
CN110686682A
