Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method and an apparatus for detecting a turning angle, which are used for detecting a user turning in indoor navigation, and improve navigation accuracy.
In a first aspect, an embodiment of the present invention provides a rotation angle detection method, where the method is applied to a mobile terminal device, and the method includes: at a first moment, when the mobile terminal is carried on a user, acquiring a first walking direction of the user; acquiring a second walking direction of the user at a second moment after the first moment; and acquiring a judgment result for representing whether the user turns or not based on the first walking direction and the second walking direction.
Further, before acquiring a second walking direction of the user at a second time after the first time, the method further includes: and acquiring a plurality of walking directions of the user between the first time and the second time.
Further, the obtaining a determination result representing whether the user turns based on the first walking direction and the second walking direction includes: acquiring a first walking angle difference value between the first walking direction and a walking direction at a third moment after the first moment on the basis of the first walking direction, the second walking direction and the plurality of walking directions; and acquiring a judgment result for representing whether the user turns or not based on the first walking angle difference value and a first preset condition.
Further, after obtaining a judgment result for representing whether the user turns or not based on the first travel angle difference and a first preset condition, the method further includes: when the judgment result is negative, acquiring a second walking angle difference value between the first walking direction and the walking direction at a fourth moment after the third moment; and acquiring a judgment result for representing whether the user turns or not based on the first preset condition and the second walking angle difference value.
Further, after obtaining a judgment result for representing whether the user turns or not based on the first travel angle difference and a first preset condition, the method further includes: and when the judgment result is yes, judging whether the user turns left or not based on a second preset condition.
In a second aspect, an embodiment of the present invention provides a rotation angle detecting apparatus, where the apparatus is applied to a mobile terminal device, and the apparatus includes: the first acquisition module is used for acquiring a first walking direction of a user at a first moment when the mobile terminal is carried on the body of the user; the second acquisition module is used for acquiring a second walking direction of the user at a second moment after the first moment; and the third obtaining module is used for obtaining a judgment result for representing whether the user turns or not based on the first walking direction and the second walking direction.
Further, the apparatus further comprises: and the fourth acquisition module is used for acquiring a plurality of walking directions of the user between the first moment and the second moment.
Further, the third obtaining module includes: a first angle difference obtaining module, configured to obtain a first walking angle difference between the first walking direction and a walking direction at a third time after the first time based on the first walking direction, the second walking direction, and the multiple walking directions; and the first judgment result acquisition module is used for acquiring a judgment result used for representing whether the user turns or not based on the first walking angle difference value and a first preset condition.
Further, the apparatus further comprises: a second angle difference obtaining module, configured to obtain, when the determination result is negative, a second walking angle difference between the first walking direction and a walking direction at a fourth time after the third time; and the second judgment result acquisition module is used for acquiring a judgment result for representing whether the user turns or not based on the first preset condition and the second walking angle difference value.
Further, the apparatus comprises: and the judging module is used for judging whether the user turns left or not based on a second preset condition when the judging result is yes.
The method and the device for detecting the rotation angle provided by the embodiment of the invention are applied to mobile terminal equipment, and the method comprises the following steps: at a first moment, when the mobile terminal is carried on a user, acquiring a first walking direction of the user; acquiring a second walking direction of the user at a second moment after the first moment; and acquiring a judgment result for representing whether the user turns or not based on the first walking direction and the second walking direction. The embodiment of the invention can realize the user turning detection in the indoor navigation and improve the indoor navigation precision.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flowchart of a corner detection method according to an embodiment of the present invention, where the method is applied to a mobile terminal device, and the corner detection method specifically includes the following steps:
step S100: and acquiring a first walking direction of a user when the mobile terminal is carried on the user at a first moment.
For example: at 20 minutes and 14 seconds at 8 am, when the mobile terminal is carried on a user, specifically, the user holds the mobile terminal, where in this embodiment, the mobile terminal may be a terminal device such as a Personal Computer (PC), a tablet PC, a smartphone, a Personal Digital Assistant (PDA), and a wearable device, in other embodiments, the mobile terminal may also be another device, and an acceleration sensor and a magnetic sensor are embedded in the mobile terminal carried on the user, in this embodiment, the acceleration sensor may be a three-axis acceleration sensor, the magnetic sensor may be a three-axis magnetic sensor, and in other embodiments, the acceleration sensor and the magnetic sensor may also be another sensor device. Since the geomagnetic field is a vector, for a fixed place, the vector can be decomposed into two components parallel to the local horizontal plane and one component perpendicular to the local horizontal plane, if the mobile terminal and the local horizontal plane are kept parallel, three axes of the magnetic sensor in the sent terminal correspond to the three components, actually, the vector sum of the two components in the horizontal direction always points to magnetic north, and the heading angle in the mobile terminal is the included angle between the current direction and the magnetic north, if the mobile terminal is kept horizontal, only the detection data of two axes (usually the X axis and the Y axis) in the horizontal direction of the magnetic sensor is needed to calculate the heading angle, and then the first walking direction of the user at 8 o' clock 20 min 14 sec is obtained through the calculated heading angle.
However, in practical applications, the mobile terminal carried on the hand of the user is not always horizontal to the ground, and usually has a certain angle with the ground, however, the angle will beAccuracy of the heading angle is affected, and therefore, tilt compensation by the acceleration sensor is required. For the attitude of an object in the air, an angle phi is defined as an included angle between an X axis and a horizontal plane, an angle theta is defined as an included angle between a y axis and the horizontal plane, components of gravity acceleration on three axes are detected through a three-axis acceleration sensor, then phi and theta are calculated, and then three-axis data (X) measured by a three-axis magnetic sensor are usedM,YM,ZM) Substituting the previously obtained phi and theta into equation 1, and calculating the angle alpha between the current direction and magnetic northyAnd Hx。
Hy=YMcos(θ)+XMsin(θ)cos(φ)-ZMcos(φ)sin(θ)
Hx=XMcos(φ)+ZMsin(φ) (1)
Followed by reacting HyAnd HxSubstituting into equation 2, α is calculated.
Step S200: and acquiring a second walking direction of the user at a second moment after the first moment.
20 minutes 18 seconds at 8 am, and when mobile terminal was carried on one's body, specifically, the user was handheld mobile terminal obtains based on above-mentioned principle user's second walking direction, current walking direction and the contained angle of magnetic north direction promptly.
Step S300: and acquiring a judgment result for representing whether the user turns or not based on the first walking direction and the second walking direction.
Calculating an absolute value of an angle difference between a first walking direction of the user at 8 am for 20 minutes and 14 seconds and a walking direction of the user at 8 am for 20 minutes and 18 seconds based on the first walking direction and the second walking direction, then judging whether the user turns or not based on the absolute value of the angle difference between the two directions and a preset condition, and judging that the user turns between 20 minutes and 14 seconds at 8 am and 20 minutes and 18 seconds at 8 am when the absolute value of the angle difference between the first walking direction and the second walking direction meets the preset condition. In this embodiment, the preset condition is equal to or greater than 90 degrees, and in other embodiments, the preset condition may be other conditions, that is, it is determined that the user has turned the vehicle only when the angle difference between the first walking direction and the second walking direction is equal to or greater than 90 degrees.
Referring to fig. 2, as an embodiment, before acquiring the second walking direction of the user at a second time after the first time, the method further includes:
s400: and acquiring a plurality of walking directions of the user between the first time and the second time.
Specifically, when the mobile terminal is carried on a user between 20 minutes and 14 seconds at 8 am and 20 minutes and 18 seconds at 8 am, the user holds the mobile terminal, and obtains a plurality of walking directions of the user in the period of time based on the above principle, in this embodiment, the plurality of walking directions may be 3 walking directions, 4 walking directions, 5 walking directions, 6 walking directions, and the like, and the more walking directions obtained in the period of time, the more accurate the user can be determined whether to turn at a certain time.
As an embodiment, the obtaining a determination result for representing whether the user turns or not based on the first walking direction and the second walking direction includes:
s500: and acquiring a first walking angle difference value between the first walking direction and a walking direction at a third moment after the first moment on the basis of the first walking direction, the second walking direction and the plurality of walking directions.
Specifically, an absolute value of an angle difference between a first walking direction of the user at 20 minutes and 14 seconds at 8 am and a third walking direction of the user at 20 minutes and 14 seconds 500 milliseconds at 8 am after 20 minutes and 14 seconds at 8 am is calculated, wherein the third walking direction is a walking direction at a third time after the first time.
S600: and acquiring a judgment result for representing whether the user turns or not based on the first walking angle difference value and a first preset condition.
Specifically, it is determined whether the user turns or not within a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 14 seconds at 8 am and 500 milliseconds at 20 minutes and 14 seconds at 8 am based on the first absolute value of the travel angle difference and a first preset condition, and it is determined whether the user turns or not within a period of 500 milliseconds at 20 minutes and 14 seconds at 8 am when the first absolute value of the travel angle difference satisfies the first preset condition, and it is determined that the user turns or turns within a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 14 seconds at 8 am and 500 milliseconds at 8 am, in this embodiment, the first preset condition is 90 degrees or more, in other embodiments, the first preset condition may be other, that is, the absolute value of the angle difference between the first travel direction and the third travel direction is 90 degrees or more, and it is determined that the user turns or turns within a period of 500 milliseconds at 20 minutes and 14 seconds at 8 am to 20 minutes and 14 seconds at 8 am, otherwise, it is determined that the user has not made a turn during this period of time.
As an embodiment, after obtaining a determination result representing whether the user turns or not based on the first travel angle difference and a first preset condition, the method further includes:
and when the judgment result is negative, acquiring a second walking angle difference value between the first walking direction and the walking direction at a fourth moment after the third moment.
Specifically, when it is determined that the user does not make a turn in the period of 20 minutes 14 seconds at 8 am to 20 minutes 14 seconds at 8 am for 500 milliseconds based on the first travel angle difference absolute value and the first preset condition, a second travel angle difference absolute value between the first travel direction of the user and a fourth travel direction of 8 o 'clock 20 minutes 15 seconds after 500 milliseconds at 8 o' clock 20 minutes 14 seconds at 8 am is calculated, where the fourth travel direction is a travel direction at a fourth time after the third time.
And acquiring a judgment result for representing whether the user turns or not based on the first preset condition and the second walking angle difference value.
Specifically, whether the user turns in a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 15 seconds at 8 am and whether the user turns in a period of 20 minutes and 15 seconds at 8 am are determined based on the second absolute value of the walking angle difference and a first preset condition, and when the second absolute value of the walking angle difference satisfies the first preset condition, it is determined that the user turns in a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 15 seconds at 8 am, in this embodiment, the first preset condition is 90 degrees or more, in other embodiments, the first preset condition may be other, that is, the absolute value of the angle difference between the first walking direction and the third walking direction is 90 degrees or more, and it is determined that the user turns in a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 15 seconds at 8 am, otherwise, it is determined that the user has not made a turn during this period of time.
As an embodiment, when the determination result is yes, that is, when the first travel angle difference satisfies a first preset condition, it is determined that the user has made a turn in a period of 20 minutes 14 seconds at 8 am to 20 minutes 14 seconds at 8 am, and the time of the first turn is recorded, and then a third travel angle difference between the travel direction at the third time and the travel direction at a fourth time after the third time is acquired, and when the third travel angle difference satisfies the first preset condition, it is determined and recorded that the user has made a second turn in a period of 20 minutes 14 seconds at 8 am to 500 minutes 15 seconds at 8 am.
As an embodiment, after obtaining a determination result representing whether the user turns or not based on the first travel angle difference and a first preset condition, the method further includes:
and when the judgment result is yes, judging whether the user turns left or not based on a second preset condition.
Specifically, when it is determined that the user makes a turn in a period of 20 minutes 14 seconds at 8 am to 20 minutes 14 seconds at 8 am based on the absolute value of the first travel angle difference and a first preset condition, and then it is determined whether the first travel angle difference satisfies a second preset condition, wherein the first travel angle difference is a difference between the user's travel direction at 20 minutes 14 seconds at 8 am and 500 seconds at 20 minutes 14 seconds at 8 am minus the user's travel direction at 20 minutes 14 seconds at 8 am, and when the first travel angle difference satisfies the second preset condition, it is determined that the user makes a left turn in a period of 20 minutes 14 seconds at 8 am to 20 minutes 14 seconds at 8 am and 500 seconds at 20 minutes 14 seconds at 14 am, and recording is performed, otherwise, when the first travel angle difference does not satisfy the second preset condition, it is determined that the user makes a right turn in a period of 20 minutes 14 seconds at 8 am to 20 minutes 14 seconds at 8 am and 500 seconds at 20 minutes 14 ms at 14 am, and recording, wherein in this embodiment, the second preset condition is an integer, that is, it is determined whether the first travel angle difference is a positive number, when the first travel angle difference is the positive number, it is determined that the user makes a left turn in a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 14 seconds at 8 am for 500 milliseconds, otherwise, it is determined that the user makes a right turn in a period of 20 minutes and 14 seconds at 8 am to 20 minutes and 14 seconds at 8 am for 500 milliseconds.
To implement the above-mentioned corner detection method, an embodiment of the present invention provides a corner detection device, please refer to fig. 3, where fig. 3 is a schematic block diagram of the corner detection device provided in the embodiment of the present invention, and the corner detection device includes: a first acquisition module 210, a second acquisition module 220, and a third acquisition module 230.
The first obtaining module 210 is configured to obtain a first walking direction of a user at a first time when the mobile terminal is carried on the user.
A second obtaining module 220, configured to obtain a second walking direction of the user at a second time after the first time.
A third obtaining module 230, configured to obtain a determination result used for representing whether the user turns based on the first walking direction and the second walking direction.
As an embodiment, the apparatus further comprises: and the fourth acquisition module is used for acquiring a plurality of walking directions of the user between the first moment and the second moment.
As an implementation, the third obtaining module 230 includes: the device comprises a first angle difference acquisition module and a first judgment result acquisition module.
A first angle difference obtaining module, configured to obtain, based on the first walking direction, the second walking direction, and the multiple walking directions, a first walking angle difference between the first walking direction and a walking direction at a third time after the first time.
And the first judgment result acquisition module is used for acquiring a judgment result used for representing whether the user turns or not based on the first walking angle difference value and a first preset condition.
As an embodiment, the apparatus further comprises: a second angle difference obtaining module and a second judgment result obtaining module.
And the second angle difference obtaining module is used for obtaining a second walking angle difference value between the first walking direction and the walking direction at a fourth moment after the third moment when the judgment result is negative.
And the second judgment result acquisition module is used for acquiring a judgment result for representing whether the user turns or not based on the first preset condition and the second walking angle difference value.
As an embodiment, the apparatus further comprises: and the judging module is used for judging whether the user turns left or not based on a second preset condition when the judging result is yes.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a device for implementing rotation angle detection according to an embodiment of the present invention, which adopts a general computer system structure, and includes a bus, a processor 401, a memory 402 and a communication interface 403, wherein a program code for executing the scheme of the present invention is stored in the memory 402 and is controlled by the processor 401 to be executed.
A bus may include a path that transfers information between the various components of a computer.
The memory 402 may store various software programs and units, such as program instructions/units corresponding to the rotation angle detection method and apparatus provided in the embodiments of the present application. The processor 401 executes various functional applications and data processing by executing software programs and units stored in the memory 402, that is, implements the rotation angle detection method in the embodiment of the present application. The Memory 402 may include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read Only Memory (PROM), Erasable Read Only Memory (EPROM), electrically Erasable Read Only Memory (EEPROM), and the like.
The processor 401 may be an integrated circuit chip having signal processing capabilities. The Processor 401 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), a microprocessor, an Application-Specific Integrated Circuit (ASIC), or one or more Integrated circuits for controlling the execution of programs according to the present invention. The one or more memories 402 included in the computer system may be Read-only memories (ROMs) or other types of static storage devices that may store static information and instructions, Random Access Memories (RAMs) or other types of dynamic storage devices that may store information and instructions, or disk memories. These memories 402 are connected to the processor 401 through a bus.
The communication interface 403 may use any transceiver or the like for communicating with other devices or communication networks, such as ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
The embodiment of the present invention further provides a computer-readable storage medium, configured to store the computer software instructions used in fig. 3 or fig. 4, which include a program for executing the method according to the embodiment of the present invention. By executing the stored program, the user turns in the indoor navigation to detect, and the indoor navigation precision is improved.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described corner detection apparatus may refer to the corresponding process in the above-described corner detection method, and will not be described in detail herein.
In summary, the method and the apparatus for detecting a rotation angle provided in the embodiments of the present invention are applied to a mobile terminal device, and the method includes: at a first moment, when the mobile terminal is carried on a user, acquiring a first walking direction of the user; acquiring a second walking direction of the user at a second moment after the first moment; and acquiring a judgment result for representing whether the user turns or not based on the first walking direction and the second walking direction. The embodiment of the invention can realize the user turning detection in the indoor navigation and improve the indoor navigation precision.
The functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.