1. Field of the Invention
The present invention relates to an azimuth computing device, an azimuth computing method, an azimuth computing program, and an electronic device each computing an azimuth obtained by using an output from a magnetic sensor.
2. Description of the Related Art
A geomagnetic sensor is a device that calculates an azimuth based on a reference direction by using an output from a magnetic sensor. In recent years, a mobile terminal such as a mobile phone with the geomagnetic sensor is being developed. Japanese Unexamined Patent Application Publication No. 2005-291934 (hereinafter, referred to as document '934) discloses a mobile terminal capable of performing azimuth computation in an environment that likely causes a geomagnetic sensor to have a detection error. The document '934 discloses a method for correcting azimuth information if a detection value of the geomagnetic sensor becomes a predetermined abnormal state and if the predetermined abnormal state lasts for a predetermined time.
There are various magnetic fields in the environment where the mobile terminal with the geomagnetic sensor is used. A magnetic field may be largely distorted, for example, in an area located near a railroad crossing or a pole (see reference sign X in
In light of the situation, the present invention provides an azimuth computing device, an azimuth computing method, an azimuth computing program, and an electronic device each being capable of preventing an azimuth from being shifted until the azimuth becomes stable.
According to an aspect of the present invention, an azimuth computing device includes an azimuth computing unit for computing azimuth data by using an output from a magnetic sensor; a buffer unit for storing the azimuth data; a control unit for outputting azimuth data if the azimuth data stored in the buffer unit by a predetermined number of pieces is within a predetermined range; and a storage unit for storing the output azimuth data as a reference azimuth. The control unit outputs azimuth data if the azimuth data stored in the buffer unit is within a predetermined angle from the reference azimuth, and discards at least part of the azimuth data stored in the buffer unit if the azimuth data stored in the buffer unit is not within the predetermined range.
With this device, since azimuth entries are buffered during a predetermined period, even if an azimuth is shifted during the predetermined period, an azimuth before it is shifted can be continuously output, and the azimuth can be prevented from being shifted until the azimuth becomes stable. Accordingly, when azimuth computation is performed by using a detection value of the geomagnetic sensor and the display control for the display is performed in accordance with the resulting azimuth information, for example, if a user having the geomagnetic sensor moves straight and approaches the subject that causes the magnetostriction, the display control is prevented from being performed with the result containing the magnetostriction caused by the subject.
Also, with this device, only the angle from the reference azimuth can be calculated without making a judgment whether the respective azimuth data stored in the buffer unit is within the predetermined angle or not. Accordingly, a load of computation can be decreased.
In the azimuth computing device, if the azimuth data stored in the buffer unit is not within the predetermined range, the control unit may discard azimuth data not within a predetermined range with reference to azimuth data that has been stored last from among the azimuth data stored in the buffer unit.
With this device, azimuth data close to the azimuth data that has been stored last is retained, and the number of buffers that have to store data again is decreased. Accordingly, a new azimuth can be output fast at timing when a temporarily changed azimuth becomes stable.
In the azimuth computing device, if the azimuth data stored in the buffer unit is not within the predetermined range, the control unit may store in the storage unit azimuth data that has been stored last from among the azimuth data stored in the buffer unit, as a new reference azimuth.
With this device, a stable azimuth can be output faster than a case in which the reference azimuth is not updated.
According to another aspect of the present invention, an azimuth computing method includes the steps of computing azimuth data by using an output from a magnetic sensor; storing the azimuth data; outputting azimuth data if the azimuth data stored by a predetermined number of pieces is within a predetermined range; storing the output azimuth data as a reference azimuth; outputting azimuth data if the azimuth data is within a predetermined angle from the reference azimuth; and discarding at least part of the azimuth data if the azimuth data is not within the predetermined range.
With this method, only the angle from the reference azimuth can be calculated without making a judgment whether the respective azimuth data stored in the buffer unit is within the predetermined angle or not. Accordingly, a load of computation can be decreased.
In the azimuth computing method, if the azimuth data is not within the predetermined range, azimuth data not within a predetermined range with reference to azimuth data that has been stored last from among the azimuth data may be discarded.
With this method, azimuth data close to the azimuth data that has been stored last is retained, and the number of buffers that have to store data again is decreased. Accordingly, a new azimuth can be output fast at timing when a temporarily changed azimuth becomes stable.
In the azimuth computing method, if the azimuth data is not within the predetermined range, azimuth data that has been stored last from among the azimuth data may be stored as a new reference azimuth.
With this method, a stable azimuth can be output faster than a case in which the reference azimuth is not updated.
According to still another aspect of the present invention, provided is an azimuth computing program capable of being executed by a computer and outputs azimuth information by using an output from a magnetic sensor. The program includes the steps of buffering a reference azimuth entry in a buffer; buffering a newly obtained azimuth entry in a buffer; if azimuth entries are stored in all buffers and if differences in angle between all azimuth entries stored in the buffers and the reference azimuth are within a predetermined angle, outputting azimuth information; and if the azimuth entries are stored in all buffers and if a difference in angle between an azimuth entry stored in a buffer and the reference azimuth exceeds the predetermined angle, discarding all azimuth entries stored in the buffers and buffering the newly obtained azimuth in the buffer as a reference azimuth.
The azimuth computing program may further include the steps of if the azimuth entries are stored in all buffers and if a difference in angle between an azimuth entry stored in a buffer and the reference azimuth exceeds the predetermined angle, retaining an azimuth entry having a difference in angle within the predetermined angle with respect to the newly obtained azimuth from among the azimuth entries stored in the buffers; discarding the other azimuth entries; and buffering the newly obtained azimuth in the buffer as a reference azimuth.
With this program, since the azimuth entries are buffered during a predetermined period, even if an azimuth is shifted during the predetermined period, an azimuth before it is shifted is continuously output, and the azimuth can be prevented from being shifted until the azimuth becomes stable.
According to yet another aspect of the present invention, an electronic device includes a geomagnetic sensor including a plurality of magnetic sensors; and the above-mentioned azimuth computing unit for performing the azimuth computation by using the output from the geomagnetic sensor.
The electronic device may further include a display; and a display control unit for controlling an image on the display in accordance with azimuth information from the azimuth computing unit.
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
The geomagnetic sensor 1 mainly includes a geomagnetic sensor unit 11 and a control unit 12. The geomagnetic sensor unit 11 includes a geomagnetic sensor portion 111 having an X-axis magnetic sensor, a Y-axis magnetic sensor, and a Z-axis magnetic sensor. The control unit 12 includes an azimuth calculating program 121 that obtains an azimuth by using an output from the magnetic sensor portion 111, a calibration program 122 that obtains a reference point for outputs of the magnetic sensors by using the output from the magnetic sensor portion 111, and an azimuth computing program 123 that performs filtering for the azimuth information obtained by the azimuth calculating program 121.
The magnetic sensors included in the magnetic sensor portion 111 of the geomagnetic sensor unit 11 correspond to at least three axes for magnetic detection. The type of a sensor element for each of the magnetic sensors is not particularly limited. For example, the sensor element may be a magnetoresistive element, such as a giant magnetoresistive (GMR) element, an anisotropic magnetoresistive (AMR) element, a tunnel magnetoresistive (TMR) element, or a granular in gap (GIG) element; or other magnetic detector element, such as a hole element or an MI element. The geomagnetic sensor unit 11 also includes a processor that applies a voltage and a magnetic field to the magnetic sensor portion 111, and a processor that converts analog signals from the magnetic sensor portion 111 into digital signals.
The control unit 12 includes at least the azimuth calculating program 121, the calibration program 122, and the azimuth computing program 123, as driver software for driving the geomagnetic sensor unit 11. The azimuth calculating program 121 is a program that obtains an azimuth by using the outputs of the X-axis, Y-axis, and Z-axis magnetic sensors. The method for obtaining an azimuth is not particularly limited. The calibration program 122 is a program that obtains a reference point for the outputs of the X-axis, Y-axis, and Z-axis magnetic sensors. The method for obtaining a reference point is not particularly limited.
The azimuth computing program 123 is capable of being executed by a computer. The program 123 performs filtering for the azimuth information obtained by using the outputs of the magnetic sensors. The program 123 includes the steps of buffering a reference azimuth entry in a buffer; buffering an azimuth entry of a newly obtained azimuth if a difference in angle between the azimuth entry and the reference azimuth is within a predetermined angle with respect to the reference azimuth; and outputting azimuth information if azimuth entries are stored in all buffers.
First, parameters for the azimuth computation are designated. The parameters may include an azimuth stable width (for example, 0 to ±90°), an azimuth stabilization period (the number of sensor outputs), and a buffering mode if a value is not within the azimuth stable width. The azimuth stable width and the azimuth stabilization period may be appropriately set with regard to response of an azimuth output and stability of azimuth information. For example, to make the azimuth stability high, the azimuth stabilization period is increased, and to make the response of the azimuth output fast, the azimuth stabilization period is decreased.
Application or non-application of the azimuth computation may be determined by user's setting. For example, if the user sets the number of sensor outputs during the azimuth stabilization period to “0,” the azimuth computation is not applied. To simplify the explanation, it is assumed that azimuth stable width W=10, and azimuth stabilization period (the number of sensor outputs) N=8.
It is judged whether or not an azimuth (current azimuth) calculated by the azimuth calculating program 121 is within the azimuth stable width ±W (±10) from the reference azimuth (S11). If the current azimuth is within ±10 from the reference azimuth, the azimuth is buffered in a buffer as an azimuth entry (S12). Referring to
Referring to
When the buffers become full, it is judged whether or not the azimuth (current azimuth) calculated by the azimuth calculating program 121 is within the azimuth stable width ±10 from the reference azimuth (S15). If the azimuth is within ±10 from the reference azimuth, the azimuth is buffered in a buffer as an azimuth entry, and the oldest azimuth entry is discarded (S16). Even in this case, the value “4” continuously serves as the reference azimuth. In contrast, if the azimuth exceeds the azimuth stable width ±10 from the reference azimuth, the buffered azimuth entry is discarded and a new azimuth entry is assigned to the reference azimuth.
Discarding a buffered azimuth entry and assigning a new azimuth entry to a reference azimuth may be performed by two methods. A method (mode 1) includes discarding all azimuth entries stored in buffers and buffering a newly obtained azimuth in a buffer as a reference azimuth. With this method, azimuth data close to the azimuth data that has been stored last is retained, and the number of buffers that have to store data again is decreased. Accordingly, a new azimuth can be output fast at timing when a temporarily changed azimuth becomes stable. Another method (mode 2) includes retaining an azimuth entry if a difference in angle between the azimuth entry and a newly obtained azimuth entry is within a predetermined angle, discarding the other azimuth entry, and buffering the newly obtained azimuth in a buffer as a reference azimuth. With this method, a stable azimuth can be output faster than a case in which the reference azimuth is not updated.
Therefore, if the azimuth exceeds the azimuth stable width ±10 from the reference azimuth, it is judged whether the mode is the mode 1 or 2 (S17). If the mode is the mode 1, referring to
The steps performed by the azimuth computing program may be performed by hardware. In particular, an azimuth computing device may be provided, the device including an azimuth computing unit for computing azimuth data by using an output from a magnetic sensor, a buffer unit for storing the azimuth data, and a control unit for outputting azimuth data if the azimuth data stored in the buffer unit by a predetermined number of pieces is within a predetermined range.
In this case, the azimuth computing device may include a storage unit for storing the output azimuth data as a reference azimuth. The control unit may output azimuth data if the azimuth data stored in the buffer unit is within a predetermined angle from the reference azimuth. The storage unit may be part of the buffer unit.
If the azimuth data stored in the buffer unit is not within the predetermined range, the control unit may discard at least part of the azimuth data stored in the buffer unit, or the control unit may discard azimuth data not within a predetermined range with reference to azimuth data that has been stored last from among the azimuth data stored in the buffer unit. If the azimuth data stored in the buffer unit is not within the predetermined range, the control unit may store in the storage unit azimuth data that has been stored last from among the azimuth data stored in the buffer unit, as a new reference azimuth.
Next, an example that was performed to clarify advantages of the present invention will be described.
A geomagnetic sensor including the azimuth computing program according to the embodiment of the present invention and a geomagnetic sensor not including the azimuth computing program according to the embodiment of the present invention were mounted on a vehicle, and azimuth calculation was performed with the geomagnetic sensors while the vehicle moved straight toward a railroad crossing and passed through the railroad crossing.
Also, changes in output were studied when a magnet was brought close to the geomagnetic sensor including the azimuth calculating program according to the embodiment of the present invention and when a magnet was brought close to the geomagnetic sensor not including the azimuth calculating program according to the embodiment of the present invention.
In this environment, with the geomagnetic sensor not including the azimuth computing program according to the embodiment of the present invention, the azimuth was slightly shifted at the time B, was largely shifted at the time C, and followed the rotation at the time D and was changed as shown in
As described above, with the azimuth computing program according to the embodiment of the present invention, since azimuth entries are buffered during a predetermined period, even if an azimuth is shifted during the predetermined period, an azimuth before it is shifted can be continuously output, and hence the azimuth can be prevented from being shifted until the azimuth becomes stable. Accordingly, if the azimuth computation is performed by using the detection value of the geomagnetic sensor and the display control is performed in accordance with the resulting azimuth information, when the vehicle moves straight toward a subject causing magnetostriction and approaches the subject, the display control is not performed with the result containing magnetostriction.
The present invention is not limited to the above-described embodiment and may be appropriately modified in various ways upon implementation. For example, in the above-described embodiment, the three-axis geomagnetic sensor including the X-axis, Y-axis, and Z-axis magnetic sensors is used; however, the present invention may use a geomagnetic sensor corresponding to two or more axes. Also, in the above-described embodiment, the geomagnetic sensor unit and the control unit are separately arranged; however, in the present invention, the geomagnetic sensor unit may be integrally arranged with the control unit. The other configurations can be also appropriately modified within the scope of the present invention.
The azimuth computing device and the azimuth computing method according to the present invention can be applied to a mobile device such as a mobile phone, and an electronic device.
Number | Date | Country | Kind |
---|---|---|---|
2008-177525 | Jul 2008 | JP | national |
This application is a Continuation of International Application No. PCT/JP2009/061492 filed on Jun. 24, 2009, which claims benefit of Japanese Patent Application No. 2008-177525 filed on Jul. 8, 2008. The entire contents of each application noted above are hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/JP2009/061492 | Jul 2009 | US |
Child | 12982039 | US |