Data processing method and apparatus, and electronic device
By acquiring the rotation vector data of the electronic device, determining the singular angles in the Euler angles and performing compensation processing, the problem of inaccurate attitude description caused by the singularity of the Euler equation is solved, and accurate attitude output near the singular point is achieved.
Patent Information
- Application Number
- CN202410968466.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-07-18
AI Technical Summary
Euler's equations exhibit singularity at roll angles of ±90 degrees, resulting in undetermined pitch and yaw angles. The solution error is too large in the region near the singularity, leading to inaccurate attitude descriptions of electronic equipment.
By acquiring the rotation vector data of the electronic device, the singular angles in the Euler angles are determined, and the compensation rotation vector data is determined based on the singular angles for compensation processing to counteract the influence of the Euler singular angles on the rotation vector data, thereby obtaining accurate second rotation vector data.
It effectively solves the Euler angle singularity problem, outputs accurate electronic device attitude information, avoids attitude description errors near singular points, and improves navigation accuracy.
Smart Images

Figure CN118916583B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of communication, and particularly relates to a data processing method and device and electronic equipment. BACKGROUND
[0002] At present, the functions such as compass and map navigation of electronic equipment are widely used. In these functions, Euler angles are usually used to describe the azimuth information. The Euler angles are obtained by solving Euler equations.
[0003] However, the Euler equations have singularity, that is, when the roll angle is ±90 degrees, the pitch angle and the yaw angle cannot be determined, and the solving error in the region close to the singularity is too large. The region close to the singularity refers to the critical region in which the roll angle is close to ±90 degrees. In this region, the Euler angle representation method has the problems of singularity and numerical solution distortion. In the above use scenarios, the data used to describe the posture of the electronic equipment is incorrect.
[0004] Therefore, the data used to describe the posture of the electronic equipment is inaccurate. SUMMARY
[0005] The embodiments of the present application provide a data processing method, device and electronic equipment, and can solve the problem that the data used to describe the posture of the electronic equipment is inaccurate.
[0006] In a first aspect, the embodiments of the present application provide a data processing method, which comprises the following steps.
[0007] Obtaining first rotation vector data of an electronic equipment;
[0008] Determining first Euler angles according to the first rotation vector data;
[0009] In a case where the absolute value of a singular angle in the first Euler angles is greater than a first value, determining compensation rotation vector data according to the singular angle in the first Euler angles; the singular angle is an angle of rotation around a first rotation axis when rotation is performed based on a preset rotation sequence;
[0010] Compensating the first rotation vector data according to the compensation rotation vector data to obtain second rotation vector data.
[0011] In a second aspect, the embodiments of the present application provide a data processing device, which comprises the following modules.
[0012] An obtaining module, configured to obtain first rotation vector data of an electronic equipment;
[0013] A first determining module, configured to determine first Euler angles according to the first rotation vector data;
[0014] The second determining module is configured 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 is greater than the first numerical value; the singular angle is an angle of rotation around the first rotation axis when rotation is performed based on the preset rotation sequence.
[0015] The processing module is configured to perform compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain second rotation vector data.
[0016] In a third aspect, an electronic device is provided, which includes a processor and a memory. The memory stores programs or instructions executable on the processor. When the programs or instructions are executed by the processor, the steps of the method according to the first aspect are implemented.
[0017] In a fourth aspect, a readable storage medium is provided, which stores programs or instructions. When the programs or instructions are executed by a processor, the steps of the method according to the first aspect are implemented.
[0018] In a fifth aspect, a chip is provided, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to execute programs or instructions to implement the method according to the first aspect.
[0019] In a sixth aspect, a computer program product is provided, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the method according to the first aspect.
[0020] In the embodiments of the present application, the first rotation vector data of the electronic device is obtained. According to the first rotation vector data, the first Euler angle is determined. When the absolute value of the singular angle in the first Euler angle is greater than the first numerical value, it indicates that the Euler equation may have a "singular point" at this time. The compensation rotation vector data is determined according to the singular angle in the first Euler angle. The singular angle is an angle of rotation around the first rotation axis when rotation is performed based on the 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 vector data, which can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and the second rotation vector data is obtained. Thus, the second rotation vector data can accurately represent the attitude of the electronic device. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 is a schematic diagram of the Euler angle corresponding to the attitude of the current electronic device.
[0022] Figure 2 is a schematic diagram of a pose of an electronic device provided by an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a device coordinate system of an electronic device provided by an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of a world coordinate system provided by an embodiment of the present application;
[0025] Figure 5 is a flowchart of a data processing method provided by an embodiment of the present application;
[0026] Figure 6 is a schematic diagram of Euler angles provided by an embodiment of the present application;
[0027] Figure 7 is a schematic diagram of a pose of an electronic device provided by an embodiment of the present application;
[0028] Figure 8 is a structural diagram of a data processing apparatus provided by an embodiment of the present application;
[0029] Figure 9 is a schematic diagram of a hardware structure of an electronic device of an embodiment of the present application;
[0030] Figure 10 is a schematic diagram of a hardware structure of an electronic device of an embodiment of the present application. DETAILED DESCRIPTION
[0031] The technical solutions of the embodiments of the present application will be described clearly below with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art belong to the scope of protection of the present application.
[0032] The terms “first”, “second”, etc. in the specification and claims of the present 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 interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by “first”, “second”, etc. are generally of a kind and do not limit the number of objects, for example, the first object can be one or more. In addition, “and / or” in the specification and claims indicates at least one of the connected objects, and the character “ / ” generally indicates that the objects before and after are in an “or” relationship.
[0033] The data processing method provided in this application embodiment can be applied to at least the following application scenarios, which will be described below.
[0034] Currently, compass and map navigation functions are widely used on electronic devices. Compass applications on electronic devices often use Euler angles to describe orientation information. Euler angles are obtained by solving Euler's equations.
[0035] Euler's equations, proposed in 1755 by the Swiss mathematician Euler, are among the most important fundamental equations in inviscid fluid dynamics. However, Euler's equations exhibit singularities, specifically "singularities," which are points where the equations begin to break down and become infinitely large. When a singularity occurs, the equations can suddenly become disordered without any warning.
[0036] In attitude estimation for electronic devices, three concepts are frequently mentioned: yaw angle, pitch angle, and roll angle. Attitude estimation is the representation of an object's orientation in three-dimensional space. The angles through which an object rotates about the three coordinate axes of the scene coordinate system when transforming from the world coordinate system to the scene coordinate system are the three-dimensional attitude angles: yaw angle, pitch angle, and roll angle.
[0037] Because of the singularity of the Euler equations, when the roll angle is ±90 degrees, the pitch and yaw angles cannot be determined. At the same time, the solution error is too large in the region near the singularity, resulting in distorted solution.
[0038] At singularities, pitch and yaw angles also abruptly change, causing discontinuities. Because solutions are not unique near singularities, and because pitch and yaw angles are discontinuous at singularities, Euler angles cannot accurately describe the orientation of electronic devices. This ultimately leads to incorrect directions being provided to users near singularities, significantly impacting the user navigation experience.
[0039] like Figure 1 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 changes in pitch angle and yaw angle.
[0040] like Figure 1 The diagram shows the Euler angles for an electronic device that is rolled 360° from its default flat starting position and pointing north. This means the device is rolled upwards from the screen until it returns to its starting position after one full rotation. The roll angle reaches 90°, then smoothly decreases without interruption until it reaches -90°, after which it smoothly increases again. Specifically, yaw and pitch angles at 90° and -90° correspond to a 180° roll and a full rotation of the roll angle, respectively.
[0041] Figure 1 Points A and B in the embodiments of this application are singular points of Euler angles. At this time, the pitch angle and yaw angle cannot be fixed. The pitch angle and yaw angle jump by 180 degrees from point A to point B, which does not match the actual pitch angle and yaw angle of the electronic device.
[0042] When the roll angle of the electronic device is equal to 90 degrees, that is Figure 2 Point A in the diagram corresponds to the actual posture of the electronic device as follows: Figure 2 As shown, when the screen of the electronic device is flipped down 90 degrees, its corresponding pitch and yaw angles jump by 180 degrees, which does not match the actual position. In other words, it is incorrect to describe the attitude of the electronic device using Euler angles under these circumstances.
[0043] Depend on Figure 1 It is clear that when the roll angle of the electronic device changes from point A to point B, its corresponding pitch and yaw angles jump by 180 degrees, which does not match the actual position. In other words, it is incorrect to describe the attitude of the electronic device using Euler angles in this case.
[0044] Electronic device coordinate system, such as 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 to the outside of the screen surface. In this coordinate system, coordinates behind the screen have negative Z values.
[0045] World coordinate system, such as Figure 4 As shown, the X-axis is horizontal and points eastward, the Y-axis is horizontal and points northward, and the Z-axis is perpendicular to the horizontal plane and points towards the sky. In this embodiment, EUN (East-North Sky) is chosen as the world reference coordinate system.
[0046] Taking the rotation sequence ZYX as an example, the corresponding rotation expression of the electronic device is shown in formula (1), and the corresponding specific rotation matrix is shown in formula (2).
[0047]
[0048] Equation (3) shows that for a given rotation matrix, the Euler angles representing the orientation information of the electronic device have two solutions. If φ, θ and Given a set of solutions for the roll, pitch, and yaw angles of a rotation matrix, then the roll angle π-φ, pitch angle θ+π, and yaw angle... This is also another solution for Euler angles.
[0049]
[0050] Regulations for electronic equipment 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... The range is limited to 0° to +360°.
[0051] When the roll angle φ = 90°, the specific rotation matrix R is obtained by substituting the rotation matrix as shown in formula (2). zyx As shown in formula (4):
[0052]
[0053] When the roll angle φ = -90°, the specific rotation matrix R is obtained by substituting the rotation matrix as shown in formula (2). zyx As shown in formula (5):
[0054]
[0055] It is easy to obtain the rotation matrix R from formula (4) and formula (5): 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] Therefore, the pitch angle θ and the yaw angle ψ are obtained by the rotation matrix R zyx The pitch angle θ and the yaw angle ψ are obtained by solving the rotation matrix R There are multiple solutions, that is, the pitch angle θ and the yaw angle ψ It is not a unique solution, and at this time this case is called singular.
[0057] In view of the problems in the related art, the embodiment of the application provides a data processing method, device and electronic equipment, which can solve the problem that the data describing the posture of the electronic equipment calculated in the related art is inaccurate.
[0058] The data processing method provided by the embodiment of the application will be described in detail in combination with the drawings, specific embodiments and application scenarios.
[0059] Figure 5 A flowchart of the data processing method provided by the embodiment of the application.
[0060] As shown in formula (4): Figure 1 The data processing method can include steps 110-140, and the method is applied to a data processing device, as shown below:
[0061] Step 110, obtaining first rotation vector data of an electronic device.
[0062] The electronic device is provided with a rotation vector sensor, and the rotation vector sensor is used to collect rotation vector data. The elements of the rotation vector are unitless.
[0063] The definitions of the x, y and z axes are the same as the acceleration sensor. The reference coordinate system is defined as a direct standard orthogonal 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 current location of the device, and the point is about east. Y is tangent to the ground at the current location of the device and points to the magnetic north pole. Z points to the sky and is perpendicular to the ground.
[0064] Obtaining first rotation vector data q in .
[0065] Step 120, determining first Euler angles according to the first rotation vector data.
[0066] Specifically, the first rotation vector data is converted into the first Euler angles. Euler angles are used to determine three independent angular parameters of a point rotation rigid body position, named after Euler who first proposed them. The Euler angles include: roll angle, yaw angle and pitch angle.
[0067] Yaw angle, the included angle between the actual direction and the planned direction, positive to the right.
[0068] Pitch angle, the included angle between the axis of the electronic device and the ground plane, positive to the head.
[0069] Roll angle, the angle of rotation of the electronic device around the front-back axis, positive to the right.
[0070] Step 130, in the case where the absolute value of the singular angle in the first Euler angle is greater than the first value, determining 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 sequence.
[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 be combined, resulting in uncertainty of the rotation state. The rotation state of the object cannot be uniquely represented by Euler angles, because the combination of the pitch angle and the yaw angle cannot be distinguished 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 will also be combined, resulting in uncertainty of the rotation state. In this case, the rotation state of the object cannot be uniquely represented by Euler angles.
[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 will be coupled and cannot be controlled independently. Small changes in attitude will cause the yaw angle and the pitch angle to change dramatically, and the rotation state of the object cannot be uniquely represented by Euler angles, and the value calculation related to the attitude of the electronic device will also appear distortion and instability.
[0074] The first value can be 45 degrees.
[0075] The singular angle is taken as an example to illustrate the roll angle as follows:
[0076] The singular angle is rotated based on a preset rotation sequence of the northeast sky coordinate system (ZYX coordinate system), and the angle of rotation around the first rotation axis is determined. Correspondingly, the rotation vector sensor can collect the first rotation vector data of the electronic device relative to the direction of the northeast sky coordinate system.
[0077] The singular angle is rotated based on a preset rotation sequence, and the angle of rotation around the first rotation axis is determined. The first rotation axis is the middle rotation axis of the northeast sky coordinate system, that is, the Y axis. That is, the singular angle is rotated based on the ZYX coordinate system, and the angle of rotation around the Y axis is determined.
[0078] In the case where the absolute value of the roll angle in the first Euler angle is greater than 45 degrees, the compensation rotation vector data is determined according to the roll angle in the first Euler angle.
[0079] In the case where the absolute value of the roll angle in the first Euler angle is not greater than 45 degrees, there is no "singular point" of the Euler equation, and the azimuth information can be directly output according to the first Euler angle.
[0080] In the case where the absolute value of the roll angle in the first Euler angle is greater than 45 degrees, there is a "singular point" of the Euler equation, and the compensation rotation vector data is determined according to the roll angle in the first Euler angle.
[0081] The singular angle is the pitch angle or the yaw angle, and the same reasoning can be obtained, which is not repeated here.
[0082] In one possible embodiment, step 130 can specifically include the following steps:
[0083] Step 210, in the case where 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 a rotated first rotation axis vector;
[0084] Step 220, taking the rotated first rotation axis vector as the rotation axis and the singular angle in the first Euler angle as the axis angle, the compensation rotation vector data in the device coordinate system is determined.
[0085] The singular angle is taken as an example to illustrate the roll angle, the first value is 45 degrees, and the preset rotation sequence is based on the ZYX coordinate system as follows:
[0086] The first rotation axis vector is the Y axis vector, and the rotated first rotation axis vector is the -Y axis vector.
[0087] In other words, in the case that the absolute value of the roll 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 a rotated Y-axis vector; the Y-axis vector is a vector of the -Y axis in the device coordinate system of the electronic device.
[0088] The Y-axis vector is a vector of the -Y axis in the device coordinate system of the electronic device, as shown in equation (6):
[0089] b y = [0 -1] (6)
[0090] As shown in equation (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 opposite to the vector of the Y axis in the device coordinate system of the electronic device in the Y axis direction. The compensated rotation vector data is determined with 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 embodiments of the present application is the -Y axis vector, the compensated rotation vector data is equivalent to representing the rotation vector data obtained by rotating the electronic device 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, and the compensated rotation vector data is the result of assuming 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 offset the influence of the roll angle in the first Euler angle on the first rotation vector data with the compensated rotation vector data.
[0093] Therefore, the compensated rotation vector data is used to offset the influence of the roll angle on the first rotation vector data. With 45 degrees as the dividing point, the more degrees the roll angle in the first Euler angle increases, the more the compensated rotation vector data is used to offset.
[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 compensated rotation vector data is used to offset the influence of 5 degrees on the first rotation vector data.
[0095] Correspondingly, subsequent compensation processing of the first rotation vector data according to the compensated rotation vector data obtains second rotation vector data, and the roll angle in the second Euler angle obtained based on the second rotation vector data is 40 degrees, offsetting the increment of 5 degrees of the roll angle in the first Euler angle relative to 45 degrees.
[0096] In one possible embodiment, step 210 can specifically include the following steps:
[0097] The first rotation axis vector, the first rotation vector data, and conjugate data of the first rotation vector data are multiplied to obtain a rotated first rotation axis vector.
[0098] The step of multiplying the first rotation axis vector, the first rotation vector data, and conjugate data of the first rotation vector data to obtain a rotated first rotation axis vector can be calculated by formula (7):
[0099] b vy= n q in · b y·( n q in ) * (7)
[0100] wherein, b vy is used to represent the rotated first rotation axis vector;
[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 conjugate data of the first rotation vector data.
[0104] wherein, the superscript b represents a device coordinate system of the electronic device, and the superscript n represents a world coordinate system.
[0105] The first rotation vector data is used to indicate a rotation axis and a rotation direction, and the data form of the first rotation vector data can 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 the rotation direction indicated by the first rotation vector data, and the rotated first rotation axis vector can be quickly and accurately obtained.
[0107] In a possible embodiment, the step 220 can specifically include the following steps:
[0108] The rotated first rotation axis vector is taken as a rotation axis, and a roll angle in the first Euler angle is taken as an axis angle to establish a rotation quaternion:
[0109] The rotation quaternion is determined as a compensation rotation vector data in the device coordinate system.
[0110]
[0111] The rotation quaternion comprises: a cosine value of 0.5 of a roll angle in the first Euler angle, a product of a sine value of 0.5 of the roll angle in the first Euler angle and a first rotation axis, a product of the sine value of 0.5 of the roll angle in the first Euler angle and a second rotation axis, and a product of the sine value of 0.5 of the roll angle 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 rotated first rotation axis vector.
[0112] α, used for representing the roll angle in the first Euler angle;
[0113] b vy x , used for representing the first rotation axis;
[0114] b vy y , used for representing the second rotation axis;
[0115] b vy z , used for representing the third rotation axis;
[0116] The compensation rotation vector data is used for representing: rotating the roll angle in the first Euler angle around the first rotation axis, rotating the roll angle in the first Euler angle around the second rotation axis, and rotating the roll angle in the first Euler angle around the third rotation axis.
[0117] Therefore, by determining the rotation quaternion established by taking the rotated first rotation axis vector as a rotation axis and taking the roll angle in the first Euler angle as an axis angle as the compensation rotation vector data under the device coordinate system, the rotation axis and the rotation direction indicated in the compensation rotation vector data can be accurately expressed by the established rotation quaternion.
[0118] In step 140, the first rotation vector data is compensated according to the compensation rotation quantity data, to obtain second rotation vector data.
[0119] Since the compensation rotation vector data is determined according to the roll angle in the first Euler angle, the compensation rotation vector data can offset the influence of the roll angle in the first Euler angle on the first rotation vector data, and therefore, the first rotation vector data is compensated according to the compensation rotation quantity data, so as to offset the influence of the roll angle in the first Euler angle on the first rotation vector data, to obtain the second rotation vector data, which can accurately represent the posture of the electronic device.
[0120] In a possible embodiment, in step 140, the following steps can be specifically included:
[0121] The compensation rotation vector data is converted into compensation rotation vector data in a world coordinate system.
[0122] The first rotation vector data is multiplied by the compensation rotation vector data in the world coordinate system to obtain second rotation vector data.
[0123] The step of converting the compensation rotation vector data into compensation rotation vector data in the world coordinate system can be 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 conjugate calculation is performed on the compensation rotation vector data in the device coordinate system 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 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 compensation rotation vector data into compensation rotation vector data in the world coordinate system, the first rotation vector data is compensated in the world coordinate system, and then 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, so that the compensated second rotation vector data can be quickly calculated.
[0133] In a possible embodiment, after step 140, the following steps can also be included:
[0134] convert the second rotation vector data into second Euler angles;
[0135] determine third Euler angles according to the singular angle in the first Euler angles and the second Euler angles;
[0136] determine orientation information according to the third Euler angles.
[0137] The second rotation vector data is obtained by offsetting the influence of the singular angle in the first Euler angles on the first rotation vector data through compensation of the rotation vector data. The second Euler angles converted from the second rotation vector data are also obtained by offsetting the influence of the singular angle in the first Euler angles on the first rotation vector data. Therefore, the two angles in the second Euler angles except the singular angle are not abnormal values.
[0138] The singular angle is taken as an example of the roll angle for illustration as follows:
[0139] The second rotation vector data is obtained by offsetting the influence of the roll angle in the first Euler angles on the first rotation vector data through compensation of the rotation vector data. The second Euler angles converted from the second rotation vector data are also obtained by offsetting the influence of the roll angle in the first Euler angles on the first rotation vector data. Therefore, the yaw angle in the second Euler angles and the pitch angle in the second Euler angles are not abnormal values.
[0140]
[0141] As shown in formula (10), the third Euler angles include the roll angle in the first Euler angles, the yaw angle in the second Euler angles and the pitch angle in the second Euler angles. That is, the roll angle in the real attitude of the electronic device is retained, and the abnormal situations of the yaw angle and the pitch angle are solved.
[0142] As shown in formula (10), the third Euler angles include the roll angle in the first Euler angles, the yaw angle in the second Euler angles and the pitch angle in the second Euler angles. That is, the roll angle in the real attitude of the electronic device is retained, and the abnormal situations of the yaw angle and the pitch angle are solved. Figure 6 As shown in formula (10), the third Euler angles include the roll angle in the first Euler angles, the yaw angle in the second Euler angles and the pitch angle in the second Euler angles. That is, the roll angle in the real attitude of the electronic device is retained, and the abnormal situations of the yaw angle and the pitch angle are solved.
[0143] The horizontal coordinate of the C point is 135 degrees, and the horizontal coordinate of the D point is 225 degrees. The range between the roll angle corresponding to the C point and the roll angle corresponding to the D point is 90 degrees.
[0144] As shown in formula (10), the third Euler angles include the roll angle in the first Euler angles, the yaw angle in the second Euler angles and the pitch angle in the second Euler angles. That is, the roll angle in the real attitude of the electronic device is retained, and the abnormal situations of the yaw angle and the pitch angle are solved. Figure 7As shown, since the user cannot see the screen information at the position corresponding to the roll angle of the electronic device at point C to point D, the user cannot normally use the electronic device at all, that is, the position corresponding to the roll angle of the electronic device at point C to point D is an area that the user actually does not use.
[0145] By the embodiment of the present application, the original abnormal value of the roll angle at point A to point B is shortened to point C to point D.
[0146] Therefore, by the embodiment of the present application, the problem of singularity of Euler angles and the discontinuity problem in the flipping process can be effectively solved, so that accurate orientation information can be output.
[0147] In the embodiment of the present application, the first rotation vector data of the electronic device is obtained, and the first Euler angle is determined according to the first rotation vector data. In the case where the absolute value of the singular angle in the first Euler angle is greater than the first value, it is indicated that the Euler equation will appear "singular point" at this time. The compensation rotation vector data is determined according to the singular angle in the first Euler angle. The singular angle is the angle of rotation around the first rotation axis when rotation is performed based on the 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 vector data, so that 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 is obtained. Thus, the second rotation vector data can accurately represent the attitude 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 is taken as an example to illustrate the data processing device provided in the embodiment of the present application.
[0148] Figure 8 is a block diagram of a data processing device provided in the embodiment of the present application. The device 800 includes:
[0149] The acquisition module 810 is configured to acquire the first rotation vector data of the electronic device.
[0150] The first determination module 820 is configured to determine the first Euler angle according to the first rotation vector data.
[0151] The second determination module 830 is configured to determine the compensation rotation vector data according to the singular angle in the first Euler angle in the case where the absolute value of the singular angle in the first Euler angle is greater than the first value. The singular angle is the angle of rotation around the first rotation axis when rotation is performed based on the preset rotation sequence.
[0152] The processing module 840 is configured to perform compensation processing on the first rotation vector data according to the compensation rotation vector data, to obtain second rotation vector data.
[0153] In a possible implementation, the second determining module 830 is specifically configured to:
[0154] In a case where an absolute value of the singular angle in the first Euler angle is greater than the first numerical value, performing rotation on the first rotation axis vector according to the first rotation vector data, to obtain a rotated first rotation axis vector;
[0155] determining the compensation rotation vector data in the device coordinate system, with the rotated first rotation axis vector as a rotation axis and with the singular angle in the first Euler angle as an axis angle.
[0156] In a possible implementation, the second determining module 830 is specifically configured to:
[0157] multiplying 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.
[0158] In a possible implementation, the second determining module 830 is specifically configured to:
[0159] establishing a rotation quaternion with the rotated first rotation axis vector as a rotation axis and with the singular angle in the first Euler angle as an axis angle.
[0160] determining the rotation quaternion as the compensation rotation vector data in the device coordinate system.
[0161] In a possible implementation, the processing module 840 is specifically configured to:
[0162] convert the compensation rotation vector data into compensation rotation vector data in a world coordinate system;
[0163] multiplying the first rotation vector data and the compensation rotation vector data in the world coordinate system, to obtain the second rotation vector data.
[0164] In a possible implementation, the apparatus 800 can further include:
[0165] The conversion module is configured to convert the second rotation vector data into a second Euler angle;
[0166] The third determining module is configured to determine a third Euler angle according to the singular angle in the first Euler angle and the second Euler angle.
[0167] The fourth determining module is configured to determine the orientation information according to the third Euler angle.
[0168] In the embodiments of the present application, the first rotation vector data of the electronic device is acquired, the first Euler angle is determined according to the first rotation vector data, and in the case that the absolute value of the singular angle in the first Euler angle is greater than the first numerical value, it is indicated that the situation of "singular point" of Euler equation will exist at this time. The compensation rotation vector data is determined according to the singular angle in the first Euler angle. The singular angle is the angle of rotation around the first rotation axis when rotation is performed based on the 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 compensation processing of the first rotation vector data according to the compensation rotation vector data can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and the second rotation vector data is obtained. Thus, the second rotation vector data can accurately represent the attitude of the electronic device. The data processing apparatus in the embodiments of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than the terminal. For example, the electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted 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), and the like. The electronic device can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like. The embodiments of the present application are not limited in this regard.
[0169] The data processing apparatus of the embodiments of the present application can be an apparatus having a motion system. The motion system can be an Android motion system, an iOS motion system, or other possible motion systems, and the embodiments of the present application are not limited in this regard.
[0170] The data processing apparatus provided by the embodiments of the present application can implement each process implemented by the method embodiments, and thus repeated descriptions are not given here.
[0171] Optionally, as Figure 9As shown, the embodiments of the present application further provide an electronic device 910, comprising a processor 911, a memory 912, a program or instruction stored in the memory 912 and executable on the processor 911, which, when executed by the processor 911, implements each step of any of the above data processing method embodiments and achieves the same technical effects. To avoid repetition, details are not described here.
[0172] It should be noted that the electronic device of the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0173] Figure 10 To achieve the hardware structure of an electronic device of the embodiments 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, etc.
[0175] Those skilled in the art can understand that the electronic device 1000 can also include a power supply (such as a battery) for powering each component, and the power supply can be logically connected to the processor 1010 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management through the power management system. Figure 10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than the figure, or combine certain components, or different component arrangements, which are not described here.
[0176] The processor 1010 is configured to obtain first rotation vector data of the electronic device.
[0177] The processor 1010 is further configured to determine first Euler angles according to the first rotation vector data.
[0178] The processor 1010 is further configured to, in a case where an absolute value of a singular angle in the first Euler angles is greater than a first numerical value, determine compensation rotation vector data according to the singular angle in the first Euler angles; the singular angle is an angle of rotation around a first rotation axis when rotation is performed based on a preset rotation sequence.
[0179] The processor 1010 is further configured to perform compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain second rotation vector data.
[0180] Optionally, the processor 1010 is further configured to rotate the first rotation axis vector according to the first rotation vector data to obtain a rotated first rotation axis vector, when an absolute value of a singular angle in the first Euler angle is greater than a first numerical value.
[0181] The processor 1010 is further configured to determine compensation rotation vector data in the device coordinate system with the rotated first rotation axis vector as a rotation axis and the singular angle in the first Euler angle as an 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 with the rotated first rotation axis vector as a rotation axis and the singular angle in the first Euler angle as an axis angle.
[0184] The processor 1010 is further configured to determine the rotation quaternion as the compensation rotation vector data in the device coordinate system.
[0185] Optionally, the processor 1010 is further configured to convert the compensation rotation vector data into compensation rotation vector data in a world coordinate system.
[0186] The processor 1010 is further configured to multiply the first rotation vector data and 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 the 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 the embodiments of the present application, the first rotation vector data of the electronic device is acquired, the first Euler angle is determined according to the first rotation vector data, and in the case that the absolute value of the singular angle in the first Euler angle is greater than the first numerical value, it is indicated that the Euler equation will appear "singular point" at this time. The compensation rotation vector data is determined according to the singular angle in the first Euler angle. The singular angle is the angle of rotation around the first rotation axis when rotation is performed based on the 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 vector data, which can offset the influence of the singular angle in the first Euler angle on the first rotation vector data, and the second rotation vector data is obtained. Thus, the second rotation vector data can accurately represent the attitude of the electronic device. It should be understood that in the embodiments of the present application, the input unit 1004 can include a graphics processing unit (GPU) 10041 and a microphone 10042. The graphics processing unit 10041 processes image data of a still picture or a video image obtained by an image capture device (such as a camera) in a video image capture mode or an image capture mode. The display unit 1006 can include a display panel 10061, which can 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 can include a touch detection device and a touch controller. The other input devices 10072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a motion stick, etc., which will not be described here. The memory 1009 can be used to store software programs and various data, including but not limited to application programs and action systems. The processor 1010 can integrate an application processor and a modem processor, wherein the application processor mainly processes action systems, user pages and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1010.
[0191] The memory 1009 can be used to store software programs and various data. The memory 1009 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, etc.), etc. In addition, the memory 1009 can include a volatile memory or a non-volatile memory, or the memory 1009 can include both volatile and non-volatile memories. The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 1009 in the embodiments of the present application includes but is not limited to these and any other suitable types of memories.
[0192] The processor 1010 can 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 an application program, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1010.
[0193] The embodiments of the present application also provide a readable storage medium, the readable storage medium stores programs or instructions, the programs or instructions are executed by a processor to realize various processes of the above-mentioned data processing method embodiments, and the same technical effects can be achieved. To avoid repetition, details are not described here.
[0194] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0195] The embodiment of the present application further provides a chip, which comprises a processor and a communication interface, the communication interface is coupled with the processor, the processor is used for running programs or instructions to realize the processes of the above data processing method embodiments and achieve the same technical effects. To avoid repetition, details are not described here.
[0196] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system level chip, a system chip, a chip system or a system on chip, etc.
[0197] The 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 realize the processes of the above data processing method embodiments and achieve the same technical effects. To avoid repetition, details are not described here.
[0198] It should be noted that in this document, the term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. Without more limitations, the element defined by the statement "comprises a" does not exclude the presence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to the order of performing the functions as shown or discussed, but can also include performing the functions in a substantially simultaneous manner or in the opposite order, for example, the described method can be performed in an order different from that described, and various steps can also be added, omitted or combined. In addition, the features described with reference to some examples can be combined in other examples.
[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned example methods can be realized by means of software and a necessary general hardware platform, and of course, can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a computer software product in essence or in the form of a part that contributes to the prior art, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application.
[0200] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative and not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.
Claims
1. A data processing method, characterized by, The method comprises: obtaining first rotation vector data of an electronic device; determining first Euler angles according to the first rotation vector data; in a case where an absolute value of a singular angle in the first Euler angles is greater than a first numerical value, multiplying a first rotation axis vector, the first rotation vector data and conjugate data of the first rotation vector data to obtain a rotated first rotation axis vector; determining compensation rotation vector data in a device coordinate system with the rotated first rotation axis vector as a rotation axis and the singular angle in the first Euler angles as an axis angle, wherein the singular angle is an angle of rotation around the first rotation axis when rotation is performed based on a preset rotation sequence; performing compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain second rotation vector data.
2. The method of claim 1, wherein, The determination of the compensation rotation vector data in the device coordinate system with the rotated first rotation axis vector as the rotation axis and the singular angle in the first Euler angles as the axis angle comprises: establishing a rotation quaternion with the rotated first rotation axis vector as the rotation axis and the singular angle in the first Euler angles as the axis angle; determining the rotation quaternion as the compensation rotation vector data in the device coordinate system.
3. The method of claim 1, wherein, The compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain the second rotation vector data comprises: converting the compensation rotation vector data into compensation rotation vector data in a world coordinate system; multiplying the first rotation vector data and the compensation rotation vector data in the world coordinate system to obtain the second rotation vector data.
4. The method of claim 1, wherein, After the compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain the second rotation vector data, the method further comprises: converting the second rotation vector data into second Euler angles; determining third Euler angles according to the singular angle in the first Euler angles and the second Euler angles; determining orientation information according to the third Euler angles.
5. A data processing apparatus, characterized by, The device comprises: an obtaining module configured to obtain first rotation vector data of an electronic device; a first determining module configured to determine first Euler angles according to the first rotation vector data; a second determining module configured to, in a case where an absolute value of a singular angle in the first Euler angles is greater than a first numerical value, multiply a first rotation axis vector, the first rotation vector data and conjugate data of the first rotation vector data to obtain a rotated first rotation axis vector; the second determining module is further configured to determine compensation rotation vector data in a device coordinate system with the rotated first rotation axis vector as a rotation axis and the singular angle in the first Euler angles as an axis angle; wherein the singular angle is an angle of rotation around the first rotation axis when rotation is performed based on a preset rotation sequence; a processing module configured to perform compensation processing on the first rotation vector data according to the compensation rotation vector data to obtain second rotation vector data.
6. The apparatus of claim 5, wherein, The second determining module is specifically configured to: establish a rotation quaternion with the rotated first rotation axis vector as the rotation axis and the singular angle in the first Euler angles as the axis angle; The rotation quaternion is determined as compensation rotation vector data under the device coordinate system.
7. The apparatus of claim 5, wherein, The processing module is specifically configured to: convert the compensation rotation vector data into compensation rotation vector data under a world coordinate system; multiply the first rotation vector data and the compensation rotation vector data under the world coordinate system to obtain the second rotation vector data.
8. The apparatus of claim 5, wherein, The device further includes: a conversion module configured to convert the second rotation vector data into second Euler angles; a third determination module configured to determine third Euler angles according to the singular angles in the first Euler angles and the second Euler angles; a fourth determination module configured to determine orientation information according to the third Euler angles.
9. An electronic device, comprising: The device includes a processor and a memory, the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the data processing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method for converting large-attitude quaternion into Euler angle in full-angle domain
CN111966954A
Aircraft attitude determination method and device, electronic equipment and storage medium
CN116182839A