Data processing method and device and electronic equipment
By acquiring and processing the rotation vector data of electronic devices, determining and compensating for the singular angle in the Euler angle, the problem of inaccurate attitude data of the Euler angle in the area near the rolling angle is solved, and a more accurate attitude of electronic devices is achieved express.
Patent Information
- Application Number
- CN202410968466.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-07-18
AI Technical Summary
The Euler angle has singularity when describing the attitude of an electronic device, which leads to the indefinite value of the pitch angle and yaw angle when the rolling angle is ±90 degrees. The solution error is large in the vicinity of the singularity area, resulting in inaccurate attitude data of the calculated electronic device.
By acquiring the first rotation vector data of the electronic device, the first Euler angle is determined, and when the absolute value of the singular angle is greater than a certain value, the compensation rotation vector data is determined based on the singular angle, and the compensation process is performed to offset the rotation of the singular angle pair. The influence of vector data is obtained by obtaining the second rotation vector data.
It effectively solves the problem of inaccurate posture data caused by Euler angle singularity, provides accurate posture representation in the area near ±90 degrees of rolling angle, and improves navigation accuracy.
Smart Images

Figure CN118916583A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a data processing method, device and electronic equipment. Background Art
[0002] At present, the compass and map navigation functions of electronic devices are widely used. Among these functions, Euler angles are usually used to describe the orientation information. Among them, Euler angles are obtained by solving the Euler equation.
[0003] Because the Euler equation has singularities, that is, when the roll angle is ±90 degrees, the pitch angle and yaw angle cannot be determined, and the solution error in the area near the singularity is too large. The area near the singularity refers to the critical area where the roll angle is close to ±90 degrees. In this area, the Euler angle representation method will have singularities and numerical solution distortion problems. In the above usage scenario, the data used to describe the posture of the electronic device is wrong.
[0004] Therefore, there is currently a situation where the calculated data describing the posture of the electronic device is inaccurate. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a data processing method, device and electronic device, which can solve the problem that the currently calculated data describing the posture of the electronic device is inaccurate.
[0006] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0007] Acquire first rotation vector data of the electronic device;
[0008] Determine a first Euler angle according to the first rotation vector data;
[0009] When the absolute value of the singular angle in the first Euler angle is greater than the first value, the compensation rotation vector data is determined according to the singular angle in the first Euler angle; wherein the singular angle is an angle of rotation around the first rotation axis when the rotation is performed based on a preset rotation sequence;
[0010] The first rotating vector data is compensated according to the compensated rotating vector data to obtain second rotating vector data.
[0011] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0012] An acquisition module, used to acquire first rotation vector data of the electronic device;
[0013] A first determining module, used for determining a first Euler angle according to first rotation vector data;
[0014] A second determination module is used to determine the compensation rotation vector data according to the singular angle in the first Euler angle when the absolute value of the singular angle in the first Euler angle is greater than the first value; wherein the singular angle is an angle of rotation around the first rotation axis when rotating based on a preset rotation sequence;
[0015] The processing module is used to perform compensation processing on the first rotating vector data according to the compensation rotating vector data to obtain second rotating vector data.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0018] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0019] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0020] In an embodiment of the present application, first rotation vector data of an electronic device is obtained, and a first Euler angle is determined based on the first rotation vector data. When the absolute value of the singular angle in the first Euler angle is greater than the first value, it indicates that a "singularity" appears in the Euler equation at this time, and compensation rotation vector data is determined based on the singular angle in the first Euler angle; wherein the singular angle is an angle of rotation around a first rotation axis when rotating based on a preset rotation sequence. Since the compensation rotation vector data is determined based on the singular angle in the first Euler angle, the compensation rotation vector data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data. Therefore, compensating the first rotation vector data based on the compensation rotation quantity data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and obtain second rotation vector data. Thus, the second rotation vector data can accurately represent the posture of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of the Euler angles corresponding to the posture of a current electronic device;
[0022] Figure 2 is a schematic diagram of a posture of an electronic device provided in an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a device coordinate system of an electronic device provided in an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of a world coordinate system provided in an embodiment of the present application;
[0025] Figure 5 is a flow chart of a data processing method provided in an embodiment of the present application;
[0026] Figure 6 is a schematic diagram of Euler angles provided in an embodiment of the present application;
[0027] Figure 7 is a schematic diagram of a posture of an electronic device provided in an embodiment of the present application;
[0028] Figure 8 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0029] Fig. 9 It is one of the hardware structure diagrams of the electronic device according to the embodiment of the present application;
[0030] Fig.10 This is the second schematic diagram of the hardware structure of the electronic device according to the embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings of the embodiments of the present application to clearly describe the technical solutions of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present application belong to the scope of protection of this application.
[0032] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0033] The data processing method provided in the embodiment of the present application can be applied to at least the following application scenarios, which are described below.
[0034] At present, the compass and map navigation functions of electronic devices are widely used. The compass application of electronic devices often uses Euler angles to describe the orientation information. Among them, the Euler angle is obtained by solving the Euler equation.
[0035] The Euler equation was proposed by the Swiss mathematician Euler in 1755. It is one of the most important basic equations in inviscid fluid dynamics. However, the Euler equation has a singularity, that is, the Euler equation has a "singularity". The "singularity" refers to the point where the Euler equation begins to fail and produces infinity. When it appears, the equation will suddenly become chaotic without any warning.
[0036] In the attitude estimation of electronic devices, three concepts are often mentioned, namely yaw angle, pitch angle and roll angle. Attitude estimation is the representation of the direction of an object in three-dimensional space. When converting the world coordinate system to the scene coordinate system, the angles that the object rotates around the three coordinate axes of the scene coordinate system are the three-dimensional attitude angles yaw angle, pitch angle and roll angle.
[0037] Due to the singularity of the Euler equation, that is, when the roll angle is ±90 degrees, the pitch angle and yaw angle cannot be determined. At the same time, the solution error in the area near the singularity is too large, resulting in distorted solution.
[0038] At the same time, at the singular point, the pitch angle and yaw angle will also jump, causing discontinuity. Near the singular point, due to the existence of non-unique solutions and discontinuities in the pitch angle and yaw angle at the singular point, the Euler angle cannot accurately describe the orientation information of the electronic device, and ultimately provides the user with the wrong direction for navigation near the singular point, which has a great impact on the user's navigation experience.
[0039] like Figure 1 As shown, the three curves in the figure represent the roll angle roll, the pitch angle pitch and the yaw angle yaw, respectively. The horizontal axis represents the roll angle from 0 to 360 degrees, and the vertical axis represents the changes of the pitch angle pitch and the yaw angle yaw.
[0040] like Figure 1 The figure shows the Euler angles when the electronic device is rolled 360° from the default flat starting position and pointing to the north, that is, the electronic device is rolled upward from the screen until it returns to the starting position after one circle. The roll angle reaches 90°, and then the roll angle begins to decrease smoothly without interruption until the roll angle reaches –90°, and then the roll angle begins to increase smoothly. Among them, when the yaw angle and pitch angle are 90° and –90°, the corresponding roll angle flips 180° and the roll angle flips one circle, respectively.
[0041] Figure 1 Point A and point B in the figure are the singular points of the Euler angle involved in the embodiments of the present application. At this time, the pitch angle and the yaw angle cannot be fixed. The pitch angle and the yaw angle jump by 180 degrees from point A to point B, which does not match the pitch angle and the yaw angle of the real electronic device.
[0042] When the roll angle of the electronic device is equal to 90 degrees, that is, Figure 2 Point A in the figure corresponds to the actual posture of the electronic device. Figure 2 As shown, at this time, the screen of the electronic device flips downward 90 degrees, and its corresponding pitch angle and yaw angle jump 180 degrees, which does not match the actual position. That is, in this case, it is wrong to use Euler angles to describe the posture of the electronic device.
[0043] Depend on Figure 1 It can be clearly seen that when the roll angle of the electronic device moves from point A to point B, its corresponding pitch angle and yaw angle jump by 180 degrees, which does not match the actual position. In other words, it is wrong to use Euler angles to describe the posture of the electronic device in this case.
[0044] Electronic device coordinate system Figure 3 As shown, the X axis is horizontal and points to the right, the Y axis is vertical and points upward, and the Z axis points outward from the screen surface. In this coordinate system, coordinates behind the screen have negative Z values.
[0045] The world coordinate system is Figure 4 As shown, the X axis is horizontal and points to the east, the Y axis is horizontal and points to the north, and the Z axis is perpendicular to the horizontal plane and points to the sky. The embodiment of the present application selects EUN (Northeastern Sky) as the world reference coordinate system.
[0046] Taking the rotation sequence of ZYX for an electronic device as an example, the corresponding rotation expression is shown in formula (1), and the corresponding specific rotation matrix is shown in formula (2).
[0047]
[0048] Formula (3) shows that for a given rotation matrix, there are two solutions for the Euler angles representing the orientation information of the electronic device. If φ, θ and is a set of solutions for the roll angle, pitch angle and yaw angle of a given rotation matrix, then the roll angle π-φ, pitch angle θ+π and yaw angle This is another set of solutions for Euler angles.
[0049]
[0050] The regulations for electronic devices include limiting the roll angle φ to the range of -90° to +90°, the pitch angle θ to the range of -180° to +180°, and the yaw angle Limited to the range 0° to +360°.
[0051] When the roll angle φ = 90°, substitute the rotation matrix into formula (2) to obtain the specific rotation matrix R zyx , as shown in formula (4):
[0052]
[0053] When the roll angle φ = -90°, substitute the rotation matrix into formula (2) to obtain the specific rotation matrix R zyx , as shown in formula (5):
[0054]
[0055] It is easy to derive from formula (4) and formula (5): The rotation matrix R zyx The number of degrees of freedom in the description is reduced from three to two, wherein the number of degrees of freedom in formula (4) includes 0 and 1, and the number of degrees of freedom in formula (5) includes 0 and -1.
[0056] So by the rotation matrix R zyx The pitch angle θ and yaw angle obtained There are multiple solutions, namely the pitch angle θ and the yaw angle is not the only solution, and this situation is called singular.
[0057] In response to the problems arising in the related art, the embodiments of the present application provide a data processing method, device and electronic device, which can solve the problem of inaccurate data calculated to describe the posture of the electronic device in the related art.
[0058] The data processing method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0059] Figure 5 A flowchart of a data processing method provided in an embodiment of the present application.
[0060] like Figure 1 As shown, the data processing method may include steps 110 to 140, and the method is applied to a data processing device, as shown below:
[0061] Step 110: Acquire first rotation vector data of the electronic device.
[0062] The electronic device is provided with a rotation vector sensor, which is used to collect rotation vector data, and the elements of the rotation vector are unitless.
[0063] The x, y, and z axes are defined the same as for the accelerometer. The reference coordinate system is defined as a direct orthonormal basis. This coordinate system has the following characteristics: X is defined as the vector product Y x Z. It is tangent to the ground at the device's current location and points approximately east. Y is tangent to the ground at the device's current location and points to the magnetic north pole. Z points to the sky and is perpendicular to the ground plane.
[0064] Get the first rotation vector data q collected by the rotation vector sensor in .
[0065] Step 120: Determine a first Euler angle according to the first rotation vector data.
[0066] Specifically, the first rotation vector data is converted into the first Euler angle. The Euler angle is a group of three independent angle parameters used to determine the position of a fixed-point rotating rigid body, and is named after Euler who first proposed it. The Euler angle includes: roll angle, yaw angle and pitch angle.
[0067] Yaw angle, the angle between the actual direction and the planned direction, is positive if it is to the right.
[0068] Pitch angle is the angle between the axis of the electronic equipment and the ground plane. It is positive when the head is up.
[0069] Roll angle is the angle at which an electronic device rotates around its front-to-back axis, with rotation to the right being positive.
[0070] Step 130, when the absolute value of the singular angle in the first Euler angle is greater than the first value, determine the compensation rotation vector data according to the singular angle in the first Euler angle; wherein the singular angle is the angle of rotation around the first rotation axis when rotating based on a preset rotation order.
[0071] When the singular angle is the roll angle, that is, when the roll angle is equal to ±90 degrees, the pitch angle (Pitch) and the yaw angle (Yaw) will merge, resulting in uncertainty in the rotation state. The rotation state of the object cannot be uniquely represented by Euler angles because the combination of pitch angle and yaw angle is indistinguishable at this time.
[0072] When the singular angle is the pitch angle, that is, when the pitch angle is equal to ±90 degrees, the roll angle and the yaw angle are also combined, resulting in uncertainty in the rotation state. In this case, the rotation state of the object cannot be uniquely represented by the Euler angle.
[0073] When the singular angle is the yaw angle, that is, when the yaw angle is equal to ±90 degrees, the yaw angle and the pitch angle are coupled and cannot be controlled independently. A small change in attitude will cause drastic changes in the yaw and pitch angles. The rotation state of the object cannot be uniquely represented by the Euler angle, and the numerical calculation related to the attitude of the electronic equipment will also be distorted and unstable.
[0074] The first value may be 45 degrees.
[0075] The following is an example of the singular angle being the rolling angle:
[0076] The singular angle is the angle of rotation around the first rotation axis when rotating based on a preset rotation sequence of the northeast celestial coordinate system (ZYX coordinate system). Accordingly, the rotation vector sensor can collect the first rotation vector data of the electronic device relative to the northeast celestial coordinate system.
[0077] The singular angle is the angle of rotation around the first rotation axis when rotating based on the preset rotation order, and the first rotation axis is the middle rotation axis of the northeast celestial coordinate system, that is, the Y axis. In other words, the singular angle is the angle of rotation around the Y axis when the ZYX coordinate system rotates.
[0078] When the absolute value of the roll angle in the first Euler angle is greater than 45 degrees, determining the compensation rotation vector data according to the roll angle in the first Euler angle;
[0079] When the absolute value of the rolling angle in the first Euler angle is not greater than 45 degrees, there is no "singularity" in the Euler equation for the time being, and the orientation information can be directly output according to the first Euler angle.
[0080] When the absolute value of the roll angle in the first Euler angle is greater than 45 degrees, a "singularity" may appear in the Euler equation, and compensation rotation vector data needs to be determined based on the roll angle in the first Euler angle.
[0081] The case where the singular angle is a pitch angle or a yaw angle can be obtained in the same way, which will not be described here.
[0082] In a possible embodiment, step 130 may specifically include the following steps:
[0083] Step 210, when the absolute value of the singular angle in the first Euler angle is greater than the first value, rotating the first rotation axis vector according to the first rotation vector data to obtain a rotated first rotation axis vector;
[0084] Step 220 , using the rotated first rotation axis vector as the rotation axis and the singular angle in the first Euler angle as the axis angle, to determine the compensation rotation vector data in the device coordinate system.
[0085] The following is an example in which the singular angle is the roll angle, the first value is 45 degrees, and the preset rotation order is the rotation order based on the ZYX coordinate system:
[0086] The first rotation axis vector is the Y axis vector, and the first rotation axis vector after rotation is the vector of the -Y axis.
[0087] That is, when the absolute value of the rolling angle in the first Euler angle is greater than 45 degrees, the Y-axis vector is rotated according to the first rotation vector data to obtain the rotated Y-axis vector; the Y-axis vector is the vector of the -Y axis in the device coordinate system of the electronic device.
[0088] The Y-axis vector is the vector of the -Y axis in the device coordinate system of the electronic device, as shown in formula (6):
[0089] b y=[0-10] (6)
[0090] As shown in formula (6), the vector of the Y axis in the device coordinate system of the electronic device is [0, 1, 0], and the vector of the -Y axis in the device coordinate system of the electronic device is a vector in the opposite direction of the Y axis in the device coordinate system of the electronic device. The compensated rotation vector data in the device coordinate system is determined by taking the rotated Y axis vector as the rotation axis and the roll angle in the first Euler angle as the axis angle.
[0091] Since the Y-axis vector involved in the embodiment of the present application is the vector of the -Y axis, the compensated rotation vector data is equivalent to the rotation vector data obtained by characterizing that the electronic device rotates with the -Y axis as the rotation axis and the roll angle in the first Euler angle as the axis angle.
[0092] In fact, the electronic device does not rotate with the -Y axis as the rotation axis and the roll angle in the first Euler angle as the axis angle. The compensation rotation vector data is to assume that the electronic device rotates with the -Y axis as the rotation axis and the roll angle in the first Euler angle as the axis angle. The purpose of the above assumption is to use the compensation rotation vector data to offset the influence of the roll angle in the first Euler angle on the first rotation vector data.
[0093] Therefore, the compensation rotation vector data is used to offset the influence of the roll angle on the first rotation vector data. Taking 45 degrees as the dividing point, the compensation rotation vector data is used to offset the increase of the roll angle in the first Euler angle.
[0094] For example, the roll angle in the first Euler angle is 50 degrees, and the increment of the roll angle in the first Euler angle relative to 45 degrees is 5 degrees. The compensation rotation vector data is used to offset the influence of 5 degrees on the first rotation vector data.
[0095] Correspondingly, the first rotation vector data is subsequently compensated according to the compensation rotation quantity data to obtain second rotation vector data. The roll angle in the second Euler angle converted based on the second rotation vector data is 40 degrees, which offsets the 5-degree increment of the roll angle in the first Euler angle relative to 45 degrees.
[0096] In a possible embodiment, step 210 may specifically include the following steps:
[0097] The first rotation axis vector, the first rotation vector data, and the conjugate data of the first rotation vector data are multiplied to obtain the rotated first rotation axis vector.
[0098] The step of multiplying the first rotation axis vector, the first rotation vector data and the conjugate data of the first rotation vector data to obtain the rotated first rotation axis vector can be specifically calculated by formula (7):
[0099] b vy= n q in · b y·( n q in ) * (7)
[0100] in, b vy is used to represent the first rotation axis vector after rotation;
[0101] n q in , used to represent the first rotation vector data;
[0102] b y, used to represent the first rotation axis vector;
[0103] ( n q in ) * , used to represent the conjugate data of the first rotation vector data.
[0104] The superscript b identifies the device coordinate system of the electronic device, and the superscript n identifies the world coordinate system.
[0105] The first rotation vector data is used to indicate the rotation axis and the rotation direction, and the data format of the first rotation vector data may be a quaternion.
[0106] Therefore, by multiplying the first rotation axis vector, the first rotation vector data and the conjugate data of the first rotation vector data, the first rotation axis vector can be rotated based on the rotation axis and rotation direction indicated by the first rotation vector data to quickly and accurately obtain the rotated first rotation axis vector.
[0107] In a possible embodiment, step 220 may specifically include the following steps:
[0108] Use the first rotation axis vector after rotation as the rotation axis and the roll angle in the first Euler angle as the axis angle to create a rotation quaternion:
[0109] Determines the rotation quaternion as compensated rotation vector data in the device coordinate system.
[0110]
[0111] A rotation quaternion, comprising: a cosine value of a roll angle of 0.5 in a first Euler angle, a product of a sine value of a roll angle of 0.5 in the first Euler angle and a first rotation axis, a product of a sine value of a roll angle of 0.5 in the first Euler angle and a second rotation axis, and a product of a sine value of a roll angle of 0.5 in the first Euler angle and a third rotation axis; the first rotation axis, the second rotation axis, and the third rotation axis are respectively components of the vector of the first rotation axis after rotation.
[0112] α, used to represent the rolling angle in the first Euler angle;
[0113] b vy x , used to represent the first rotation axis;
[0114] b vy y , used to represent the second rotation axis;
[0115] b vy z , used to represent the third rotation axis;
[0116] The compensated rotation vector data is used to represent: a roll angle in the first Euler angle rotated around a first rotation axis, a roll angle in the first Euler angle rotated around a second rotation axis, and a roll angle in the first Euler angle rotated around a third rotation axis.
[0117] Therefore, by determining the rotation quaternion established with the rotated first rotation axis vector as the rotation axis and the roll angle in the first Euler angle as the axis angle as the compensation rotation vector data in the device coordinate system, the rotation axis and rotation direction indicated in the compensation rotation vector data can be accurately expressed through the established rotation quaternion.
[0118] Step 140 , performing compensation processing on the first rotation vector data according to the compensation rotation quantity data to obtain second rotation vector data.
[0119] Since the compensated rotation vector data is determined based on the roll angle in the first Euler angle, the compensated rotation vector data can offset the influence of the roll angle in the first Euler angle on the first rotation vector data. Therefore, compensating the first rotation vector data according to the compensated rotation quantity data can offset the influence of the roll angle in the first Euler angle on the first rotation vector data, thereby obtaining second rotation vector data, which can accurately represent the posture of the electronic device.
[0120] In a possible embodiment, step 140 may specifically include the following steps:
[0121] Convert the compensation rotation vector data into compensation rotation vector data in the world coordinate system;
[0122] The first rotation vector data is multiplied by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
[0123] The step of converting the compensation rotation vector data into the compensation rotation vector data in the world coordinate system can be specifically implemented by formula (9):
[0124] n qy=( b qy) * (9)
[0125] n qy, used to represent the compensation rotation vector data in the world coordinate system;
[0126] b qy, used to represent the compensation rotation vector data in the device coordinate system;
[0127] Formula (9) indicates that the compensation rotation vector data in the device coordinate system is conjugate calculated to obtain the compensation rotation vector data in the world coordinate system.
[0128] The step of multiplying the first rotation vector data by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data can be specifically implemented by formula (10):
[0129] n q out = n qy· n q in (10)
[0130] n q out , used to represent the second rotation vector data;
[0131] n q in , used to represent the first rotation vector data.
[0132] Therefore, by converting the compensated rotation vector data into the compensated rotation vector data in the world coordinate system, it is convenient to compensate the first rotation vector data in the world coordinate system, and then, the first rotation vector data is multiplied by the compensated rotation vector data in the world coordinate system to obtain the second rotation vector data, so that the compensated second rotation vector data can be quickly calculated.
[0133] In a possible embodiment, after step 140, the following steps may also be included:
[0134] Convert the second rotation vector data into a second Euler angle;
[0135] Determine a third Euler angle according to the singular angle in the first Euler angle and the second Euler angle;
[0136] The orientation information is determined according to the third Euler angle.
[0137] The second rotation vector data is obtained by offsetting the influence of the singular angle in the first Euler angle on the first rotation vector data by the compensation rotation vector data, and the second Euler angle converted by the second rotation vector data is also obtained by offsetting the influence of the singular angle in the first Euler angle on the first rotation vector data. Therefore, the two angles in the second Euler angle other than the singular angle are not abnormal values.
[0138] The following is an example of the singular angle being the rolling angle:
[0139] The second rotating vector data is obtained by offsetting the influence of the roll angle in the first Euler angle on the first rotating vector data through the compensation rotating vector data, and the second Euler angle converted from the second rotating vector data is also obtained by offsetting the influence of the roll angle in the first Euler angle on the first rotating vector data. Therefore, the yaw angle in the second Euler angle and the pitch angle in the second Euler angle are not abnormal values.
[0140]
[0141] As shown in formula (10), the third Euler angle includes: the roll angle in the first Euler angle, the yaw angle in the second Euler angle, and the pitch angle in the second Euler angle. In other words, while retaining the roll angle under the real posture of the electronic device, the abnormal conditions of the yaw angle and the pitch angle are solved.
[0142] like Figure 6 As shown in the figure, the three curves represent the roll angle, pitch angle and yaw angle respectively. The horizontal axis represents the roll angle from 0 to 360 degrees, and the vertical axis represents the change of pitch angle and yaw angle. When the roll angle of the electronic device is from point C to point D, its corresponding pitch angle and yaw angle also jump 180 degrees, but their position is 45 degrees downward on the screen.
[0143] The horizontal coordinate of point C is 135 degrees, the horizontal coordinate of point D is 225 degrees, and the range between the rolling angle corresponding to point C and the rolling angle corresponding to point D is 90 degrees.
[0144] like Figure 7As shown, when the roll angle of the electronic device is at the position corresponding to point C to point D, the user cannot see the screen information and therefore cannot use the electronic device normally. In other words, the roll angle of the electronic device at the position corresponding to point C to point D is an area that the user cannot actually use.
[0145] Through the embodiments of the present application, the abnormal value of the original roll angle between point A and point B is shortened to between point C and point D.
[0146] Therefore, through the embodiments of the present application, the singularity problem of the Euler angle and the discontinuity problem during the flipping process can be effectively solved, thereby outputting accurate orientation information.
[0147] In an embodiment of the present application, first rotation vector data of an electronic device is obtained, and a first Euler angle is determined according to the first rotation vector data. When the absolute value of the singular angle in the first Euler angle is greater than the first value, it indicates that a "singular point" appears in the Euler equation at this time, and compensation rotation vector data is determined according to the singular angle in the first Euler angle; wherein the singular angle is the angle of rotation around the first rotation axis when rotating based on a preset rotation sequence. Since the compensation rotation vector data is determined according to the singular angle in the first Euler angle, the compensation rotation vector data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data. Therefore, the first rotation vector data is compensated according to the compensation rotation quantity data, which can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and obtain the second rotation vector data, thereby, the second rotation vector data can accurately represent the posture of the electronic device. The data processing method provided in the embodiment of the present application can be executed by a data processing device. In the embodiment of the present application, the data processing device provided in the embodiment of the present application is described by taking the data processing method executed by the data processing device as an example.
[0148] Figure 8 800 is a block diagram of a data processing device provided in an embodiment of the present application, and the device 800 includes:
[0149] An acquisition module 810 is used to acquire first rotation vector data of an electronic device;
[0150] A first determination module 820, configured to determine a first Euler angle according to the first rotation vector data;
[0151] A second determination module 830 is configured to determine compensation rotation vector data according to the singular angle in the first Euler angle when the absolute value of the singular angle in the first Euler angle is greater than the first value; wherein the singular angle is an angle of rotation around the first rotation axis when the rotation is performed based on a preset rotation sequence;
[0152] The processing module 840 is used to perform compensation processing on the first rotating vector data according to the compensated rotating vector data to obtain second rotating vector data.
[0153] In a possible embodiment, the second determining module 830 is specifically configured to:
[0154] When the absolute value of the singular angle in the first Euler angle is greater than the first value, the first rotation axis vector is rotated according to the first rotation vector data to obtain the rotated first rotation axis vector;
[0155] The first rotation axis vector after rotation is used as the rotation axis, and the singular angle in the first Euler angle is used as the axis angle to determine the compensation rotation vector data in the device coordinate system.
[0156] In a possible embodiment, the second determining module 830 is specifically configured to:
[0157] The first rotation axis vector, the first rotation vector data, and the conjugate data of the first rotation vector data are multiplied to obtain the rotated first rotation axis vector.
[0158] In a possible embodiment, the second determining module 830 is specifically configured to:
[0159] Use the first rotation axis vector after rotation as the rotation axis and the singular angle in the first Euler angle as the axis angle to create a rotation quaternion:
[0160] Determines the rotation quaternion as compensated rotation vector data in the device coordinate system.
[0161] In a possible embodiment, the processing module 840 is specifically configured to:
[0162] Convert the compensation rotation vector data into compensation rotation vector data in the world coordinate system;
[0163] The first rotation vector data is multiplied by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
[0164] In a possible embodiment, the device 800 may further include:
[0165] A conversion module, used for converting the second rotation vector data into a second Euler angle;
[0166] A third determining module is used to determine a third Euler angle according to the singular angle in the first Euler angle and the second Euler angle;
[0167] The fourth determination module is used to determine the orientation information according to the third Euler angle.
[0168] In an embodiment of the present application, first rotation vector data of an electronic device is obtained, and a first Euler angle is determined according to the first rotation vector data. When the absolute value of the singular angle in the first Euler angle is greater than the first value, it indicates that a "singular point" appears in the Euler equation at this time, and compensation rotation vector data is determined according to the singular angle in the first Euler angle; wherein the singular angle is the angle of rotation around the first rotation axis when rotating based on a preset rotation sequence. Since the compensation rotation vector data is determined according to the singular angle in the first Euler angle, the compensation rotation vector data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data. Therefore, the first rotation vector data is compensated according to the compensation rotation quantity data, and the influence of the singular angle in the first Euler angle on the first rotation vector data can be offset, and the second rotation vector data can be obtained, so that the second rotation vector data can accurately represent the posture of the electronic device. The data processing device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It may also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiments of the present application are not specifically limited.
[0169] The data processing device of the embodiment of the present application may be a device having an action system. The action system may be an Android action system, an iOS action system, or other possible action systems, which are not specifically limited in the embodiment of the present application.
[0170] The data processing device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0171] Alternatively, if Fig. 9As shown, an embodiment of the present application also provides an electronic device 910, including a processor 911, a memory 912, and a program or instruction stored in the memory 912 and executable on the processor 911. When the program or instruction is executed by the processor 911, each step of any of the above-mentioned data processing method embodiments is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0172] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0173] Fig.10 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0174] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0175] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0176] The processor 1010 is used to obtain first rotation vector data of the electronic device;
[0177] The processor 1010 is further configured to determine a first Euler angle according to the first rotation vector data;
[0178] The processor 1010 is further configured to determine compensation rotation vector data according to the singular angle in the first Euler angle when the absolute value of the singular angle in the first Euler angle is greater than a first value; wherein the singular angle is an angle of rotation around the first rotation axis when the rotation is performed based on a preset rotation order;
[0179] The processor 1010 is further configured to perform compensation processing on the first rotating vector data according to the compensated rotating vector data to obtain second rotating vector data.
[0180] Optionally, the processor 1010 is further configured to, when an absolute value of a singular angle in the first Euler angle is greater than a first value, rotate the first rotation axis vector according to the first rotation vector data to obtain a rotated first rotation axis vector;
[0181] The processor 1010 is further configured to determine the compensation rotation vector data in the device coordinate system by taking the rotated first rotation axis vector as the rotation axis and taking the singular angle in the first Euler angle as the axis angle.
[0182] Optionally, the processor 1010 is further configured to multiply the first rotation axis vector, the first rotation vector data and conjugate data of the first rotation vector data to obtain the rotated first rotation axis vector.
[0183] Optionally, the processor 1010 is further configured to establish a rotation quaternion using the rotated first rotation axis vector as the rotation axis and using the singular angle in the first Euler angle as the axis angle:
[0184] The processor 1010 is further configured to determine the rotation quaternion as compensation rotation vector data in the device coordinate system.
[0185] Optionally, the processor 1010 is further configured to convert the compensated rotation vector data into compensated rotation vector data in a world coordinate system;
[0186] The processor 1010 is further configured to multiply the first rotation vector data by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
[0187] Optionally, the processor 1010 is further configured to convert the second rotation vector data into a second Euler angle;
[0188] The processor 1010 is further configured to determine a third Euler angle according to a singular angle in the first Euler angle and the second Euler angle;
[0189] The processor 1010 is further configured to determine the orientation information according to the third Euler angle.
[0190] In an embodiment of the present application, first rotation vector data of an electronic device is obtained, and a first Euler angle is determined based on the first rotation vector data. When the absolute value of the singular angle in the first Euler angle is greater than the first value, it indicates that a "singularity" appears in the Euler equation at this time, and compensation rotation vector data is determined based on the singular angle in the first Euler angle; wherein the singular angle is an angle of rotation around a first rotation axis when rotating based on a preset rotation sequence. Since the compensation rotation vector data is determined based on the singular angle in the first Euler angle, the compensation rotation vector data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data. Therefore, compensating the first rotation vector data based on the compensation rotation quantity data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and obtain second rotation vector data. Thus, the second rotation vector data can accurately represent the posture of the electronic device. It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video image obtained by the image capture device (such as a camera) in the video image capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and an action rod, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and action systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes the action system, user pages and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.
[0191] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0192] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.
[0193] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0194] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0195] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0196] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0197] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned data processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0198] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0199] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0200] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire first rotation vector data of the electronic device; Determine a first Euler angle according to the first rotation vector data; When the absolute value of the singular angle in the first Euler angle is greater than a first value, determining the compensation rotation vector data according to the singular angle in the first Euler angle; wherein the singular angle is an angle of rotation around the first rotation axis when rotating based on a preset rotation sequence; The first rotating vector data is compensated according to the compensated rotating vector data to obtain second rotating vector data.
2. The method according to claim 1, characterized in that The method of determining the compensation rotation vector data according to the singular angle in the first Euler angle when the absolute value of the singular angle in the first Euler angle is greater than a first value includes: When the absolute value of the singular angle in the first Euler angle is greater than a first value, rotating the first rotation axis vector according to the first rotation vector data to obtain a rotated first rotation axis vector; The first rotation axis vector after rotation is used as the rotation axis, and the singular angle in the first Euler angle is used as the axis angle to determine the compensation rotation vector data in the device coordinate system.
3. The method according to claim 2, characterized in that The step of rotating the first rotation axis vector according to the first rotation vector data to obtain the rotated first rotation axis vector includes: The first rotation axis vector, the first rotation vector data and the conjugate data of the first rotation vector data are multiplied to obtain the rotated first rotation axis vector.
4. The method according to claim 2, characterized in that: The method of determining the compensation rotation vector data in the device coordinate system by taking the rotated first rotation axis vector as the rotation axis and taking the singular angle in the first Euler angle as the axis angle includes: A rotation quaternion is established with the first rotation axis vector after rotation as the rotation axis and the singular angle in the first Euler angle as the axis angle: The rotation quaternion is determined as compensated rotation vector data in the device coordinate system.
5. The method according to claim 1, characterized in that The compensating the first rotating vector data according to the compensated rotating vector data to obtain second rotating vector data includes: Converting the compensation rotation vector data into compensation rotation vector data in a world coordinate system; The first rotation vector data is multiplied by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
6. The method according to claim 1, characterized in that After the first rotating vector data is compensated according to the compensated rotating vector data to obtain second rotating vector data, the method further includes: Convert the second rotation vector data into a second Euler angle; Determine a third Euler angle according to the singular angle in the first Euler angle and the second Euler angle; The orientation information is determined according to the third Euler angle.
7. A data processing device, characterized in that: The device comprises: An acquisition module, used to acquire first rotation vector data of the electronic device; A first determining module, configured to determine a first Euler angle according to the first rotation vector data; a second determination module, configured to determine compensation rotation vector data according to the singular angle in the first Euler angle when the absolute value of the singular angle in the first Euler angle is greater than a first value; wherein the singular angle is an angle of rotation around a first rotation axis when rotating based on a preset rotation sequence; A processing module is used to perform compensation processing on the first rotating vector data according to the compensated rotating vector data to obtain second rotating vector data.
8. The device according to claim 7, characterized in that The second determining module is specifically used to: When the absolute value of the singular angle in the first Euler angle is greater than a first value, rotating the first rotation axis vector according to the first rotation vector data to obtain a rotated first rotation axis vector; The first rotation axis vector after rotation is used as the rotation axis, and the singular angle in the first Euler angle is used as the axis angle to determine the compensation rotation vector data in the device coordinate system.
9. The device according to claim 8, characterized in that The second determining module is specifically used to: The first rotation axis vector, the first rotation vector data and the conjugate data of the first rotation vector data are multiplied to obtain the rotated first rotation axis vector.
10. The device according to claim 8, characterized in that The second determining module is specifically used to: A rotation quaternion is established with the first rotation axis vector after rotation as the rotation axis and the singular angle in the first Euler angle as the axis angle: The rotation quaternion is determined as compensated rotation vector data in the device coordinate system.
11. The device according to claim 7, characterized in that Processing module, specifically used for: Converting the compensation rotation vector data into compensation rotation vector data in a world coordinate system; The first rotation vector data is multiplied by the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
12. The device according to claim 7, characterized in that The device also includes: A conversion module, used for converting the second rotation vector data into a second Euler angle; A third determining module, configured to determine a third Euler angle according to a singular angle in the first Euler angle and the second Euler angle; The fourth determination module is used to determine the orientation information according to the third Euler angle.
13. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the data processing method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Unmanned aerial vehicle navigation method and system based on double-Euclidean method and quaternion hybrid arrangement
CN111707268A
Method for converting large-attitude quaternion into Euler angle in full-angle domain
CN111966954A
Horizontal five-axis turntable semi-physical simulation system and control method thereof
CN115421398A
Aircraft attitude determination method and device, electronic equipment and storage medium
CN116182839A
Method and system for initial quaternion and attitude estimation
US20120166082A1
