Disclosure of Invention
The application provides a six-axis IMU gesture resolving method, a six-axis IMU gesture resolving device, six-axis IMU gesture resolving equipment and a storage medium, and aims to solve the technical problems.
In order to solve the technical problem, in a first aspect, the present application provides a pose resolving method of a six-axis IMU, where the six-axis IMU includes a three-axis accelerometer and a three-axis gyroscope, the method includes:
determining whether the six-axis IMU is in a stationary state;
if the six-axis IMU is in a static state, performing first preset processing on first original measurement data to generate first processing data, and performing gesture calculation based on the first processing data and second original measurement data, wherein the first original measurement data is original measurement data of the three-axis gyroscope, the second original measurement data is original measurement data of the three-axis accelerometer, and the first preset processing is used for eliminating zero offset errors and noise errors of the first original measurement data in the static state;
And if the six-axis IMU is in a motion state, performing second preset processing on the first original measurement data to generate second processing data, and performing gesture calculation based on the second processing data and the second original measurement data, wherein the second preset processing is used for eliminating zero offset errors and noise errors of the first original measurement data in the motion state.
When the gesture resolving method of the six-axis IMU is used for gesture resolving, firstly determining whether the six-axis IMU is in a static state, if so, performing first preset processing on first original measurement data to generate first processing data, performing gesture resolving based on the first processing data and second original measurement data, and if so, performing second preset processing on the first original measurement data to generate second processing data, and performing gesture resolving based on the second processing data and the second original measurement data. The first preset processing can eliminate zero offset errors and noise errors of the first original measurement data in the static state, and the second preset processing can eliminate zero offset errors and noise errors of the first original measurement data in the moving state, so that the result of gesture calculation is not influenced by the zero offset errors and the noise errors in the first original measurement data no matter the six-axis IMU is in the static state or the moving state, and the accuracy of gesture calculation of an object in the static state and the moving state can be effectively improved.
In one embodiment, the determining whether the six-axis IMU is in a stationary state includes:
generating a first array [ a x,k,ax,k-1,ax,k-2,ax,k-3, ], a second array [ a y,k,ay,k-1,ay,k-2,ay,k-3, ], a third array [ a z,k,az,k-1,az,k-2,az,k-3, ], a fourth array [ g x,k,gx,k-1,gx,k-2,gx,k-3, ], a fifth array [ g y,k,gy,k-1,gy,k-2,gy,k-3, ], a fourth array [ g z,k,gz,k-1,gz,k-2,gz,k-3, ], and a sixth array [ g z,k,gz,k-1,gz,k-2,gz,k-3, ] corresponding to the current time k according to the second raw measurement data [ a x,k,ay,k,az,k ] and the first raw measurement data [ g x,k,gy,k,gz,k ] of the current time k;
Calculating head-tail data differences da x、day、daz、dgx、dgy and dg z corresponding to the first array, the second array, the third array, the fourth array, the fifth array and the sixth array respectively;
If the absolute value of da x is less than the first threshold and the absolute value of da y is less than the second threshold and the absolute value of da z is less than the third threshold and the absolute value of dg x is less than the fourth threshold and the absolute value of dg y is less than the fifth threshold and the absolute value of dg z is less than the sixth threshold, then determining that the six-axis IMU is in a stationary state, otherwise determining that the six-axis IMU is in a moving state.
In one embodiment, the method further comprises:
Calculating variances va x、vay、vaz、vgx、vgy and vg z corresponding to the data in the first array, the second array, the third array, the fourth array, the fifth array and the sixth array respectively;
If the absolute value of da x is less than the first threshold and the absolute value of da y is less than the second threshold and the absolute value of da z is less than the third threshold and the absolute value of dg x is less than the fourth threshold and the absolute value of dg y is less than the fifth threshold and the absolute value of dg z is less than the sixth threshold and the absolute value of va x is less than the seventh threshold and the absolute value of va y is less than the eighth threshold and the absolute value of va z is less than the ninth threshold and the absolute value of vg x is less than the tenth threshold and the absolute value of vg y is less than the eleventh threshold, the absolute value of vg z is less than the twelfth threshold, then determining that the six-axis IMU is in a stationary state, otherwise determining that the six-axis IMU is in motion.
In one embodiment, the first raw measurement data includes a measurement of an x-axis angular velocity, a measurement of a y-axis angular velocity, and a measurement of a z-axis angular velocity;
The first pre-setting processing of the first original measurement data to generate first processing data comprises zero setting of the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity, wherein the first processing data comprises the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity after zero setting processing.
In one embodiment, the method further comprises:
And after the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity are set to zero, respectively compensating the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity according to the rotation angular velocity of the earth, wherein the first processing data comprise the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity after compensation processing.
In one embodiment, the performing a second preset process on the first raw measurement data to generate second processed data includes:
determining a first error value corresponding to the x-axis angular velocity, a second error value corresponding to the y-axis angular velocity and a third error value corresponding to the z-axis angular velocity at the current moment;
And determining a calibration value corresponding to the x-axis angular velocity, a calibration value corresponding to the y-axis angular velocity and a calibration value corresponding to the z-axis angular velocity according to the first error value, the second error value and the third error value, respectively, wherein the second processing data comprises the calibration value corresponding to the x-axis angular velocity, the calibration value corresponding to the y-axis angular velocity and the calibration value corresponding to the z-axis angular velocity, the calibration value corresponding to the x-axis angular velocity is equal to the difference value between the measured value of the x-axis angular velocity and the first error value, the calibration value corresponding to the y-axis angular velocity is equal to the difference value between the measured value of the y-axis angular velocity and the second error value, and the calibration value corresponding to the z-axis angular velocity is equal to the difference value between the measured value of the z-axis angular velocity and the third error value.
In one embodiment, the method comprises:
when the six-axis IMU is in a static state, timing the duration of the static state, and respectively determining the accumulated sum of frames before and after the measured value of the x-axis angular velocity, the accumulated sum of frames before and after the measured value of the y-axis angular velocity and the accumulated sum of frames before and after the measured value of the z-axis angular velocity from the timing moment;
When the timing duration is longer than a first preset duration and not longer than a second preset duration, determining the first error value according to the accumulated sum of frames before and after the measured value of the x-axis angular velocity, updating and storing the first error value in real time, determining the second error value according to the accumulated sum of frames before and after the measured value of the y-axis angular velocity, updating and storing the second error value in real time, determining the third error value according to the accumulated sum of frames before and after the measured value of the z-axis angular velocity, and updating and storing the third error value in real time;
And when the timing duration is longer than a second preset duration, starting to reckon the duration of the static state of the six-axis IMU, regenerating the first error value, the second error value and the third error value, and updating and storing the first error value, the second error value and the third error value in real time.
In a second aspect, the present application provides a pose solving apparatus of a six-axis IMU including a three-axis accelerometer and a three-axis gyroscope, the apparatus comprising:
The determining module is used for determining whether the six-axis IMU is in a static state or not;
The first resolving module is used for performing first preset processing on first original measurement data to generate first processing data if the six-axis IMU is in a static state, and performing gesture resolving on the first processing data and second original measurement data, wherein the first original measurement data is original measurement data of the three-axis gyroscope, the second original measurement data is original measurement data of the three-axis accelerometer, and the first preset processing is used for eliminating zero offset errors and noise errors of the first original measurement data in the static state;
and the second resolving module is used for carrying out second preset processing on the first original measurement data to generate second processing data if the six-axis IMU is in a motion state, and carrying out gesture resolving on the basis of the second processing data and the second original measurement data, wherein the second preset processing is used for eliminating zero offset errors and noise errors of the first original measurement data in the motion state.
In a third aspect, the present application provides a computer device, including a processor and a memory, where the memory is configured to store a computer program, where the computer program, when executed by the processor, implements the method for resolving a pose of a six-axis IMU described above.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements the pose resolving method of a six-axis IMU described above.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, fig. 1 is a flow chart of a method for resolving a six-axis IMU according to an embodiment of the application. The six-axis IMU includes a three-axis accelerometer and a three-axis gyroscope. As shown in fig. 1, the method for resolving the pose of the six-axis IMU of the present embodiment includes steps S11 to S13, which are described in detail below:
In step S11 to step S13, the first raw measurement data is the raw measurement data of the three-axis gyroscope, the second raw measurement data is the raw measurement data of the three-axis accelerometer, the first preset process is used for eliminating the zero offset error and the noise error of the first raw measurement data in the static state, and the second preset process is used for eliminating the zero offset error and the noise error of the first raw measurement data in the moving state.
And S11, determining whether the six-axis IMU is in a static state.
In this step, it may be determined whether the six-axis IMU is in a stationary state based on raw measurement data of the three-axis accelerometer and the three-axis gyroscope. When the six-axis IMU is in a static state, the measured data of the first original measured data and the second original measured data under different time sequences do not change greatly, and when the six-axis IMU is in a moving state, the measured data of the first original measured data and the second original measured data under different time sequences do not change greatly.
Therefore, when determining whether the six-axis IMU is in a stationary state, a first array [ a x,k,ax,k-1,ax,k-2,ax,k-3, ], corresponding to the current time k, may be first generated from the second raw measurement data [ a x,k,ay,k,az,k ] and the first raw measurement data [ g x,k,gy,k,gz,k ] of the current time k Second array [ a y,k,ay,k-1,ay,k-2,ay,k-3, ], third array [ a z,k,az,k-1,az,k-2,az,k-3, ], fourth array [ g x,k,gx,k-1,gx,k-2,gx,k-3, ], fifth array [ g y,k,gy,k-1,gy,k-2,gy,k-3, ] and sixth array [ g z,k,gz,k-1,gz,k-2,gz,k-3, ], then calculating the first array, the second array, the third array, the fourth array, the fifth array, and the fourth array, and the fifth array, respectively a second array, a third array, a fourth array, And if the absolute value of da x is smaller than a first threshold value, the absolute value of da y is smaller than a second threshold value, the absolute value of da z is smaller than a third threshold value, the absolute value of dg x is smaller than a fourth threshold value, the absolute value of dg y is smaller than a fifth threshold value, and the absolute value of dg z is smaller than a sixth threshold value, the six-axis IMU is determined to be in a static state, otherwise, the six-axis IMU is determined to be in a motion state.
It can be understood that the first array contains linear accelerations that correspond in sequence with the x-axis of space at time k, time k-1, and time k-2, the second array contains linear accelerations that correspond in sequence with the y-axis of space at time k, time k-1, and time k-2, the third array contains linear accelerations that correspond in sequence with the z-axis of space at time k, time k-1, and time k-2, the fourth array contains angular velocities that correspond in sequence with the x-axis of space at time k, time k-1, and time k-2, and the fifth array contains angular velocities that correspond in sequence with the y-axis of space at time k, time k-1, and time k-2.
Further, in determining whether the six-axis IMU is in a stationary state, the first, second, third, fourth, and third arrays can also be calculated, And if the absolute value of da x is smaller than the first threshold, the absolute value of da y is smaller than the second threshold, the absolute value of da z is smaller than the third threshold, the absolute value of dg x is smaller than the fourth threshold, the absolute value of dg y is smaller than the fifth threshold, the absolute value of dg z is smaller than the sixth threshold, the absolute value of va x is smaller than the seventh threshold, the absolute value of va y is smaller than the eighth threshold, the absolute value of va z is smaller than the ninth threshold, the absolute value of vg x is smaller than the tenth threshold, the absolute value of vg y is smaller than the eleventh threshold, the absolute value of vg z is smaller than the twelfth threshold, and otherwise, the six-axis IMU is determined to be in a stationary state. whether the six-axis IMU is in a static state or not is determined based on variances va x、vay、vaz、vgx、vgy and vg z corresponding to data in the first array, the second array, the third array, the fourth array, the fifth array and the sixth array respectively, so that the six-axis IMU is more accurately detected in the static state.
And step S12, if the six-axis IMU is in a static state, performing first preset processing on the first original measurement data to generate first processing data, and performing gesture calculation based on the first processing data and the second original measurement data.
In this step, the first raw measurement data includes a measurement of the x-axis angular velocity, a measurement of the y-axis angular velocity, and a measurement of the z-axis angular velocity. If the six-axis IMU is in a stationary state, the measured value of the x-axis angular velocity, the measured value of the y-axis angular velocity, and the measured value of the z-axis angular velocity are all 0 in theory, however, due to the zero offset error and the noise error, the measured value of the x-axis angular velocity, the measured value of the y-axis angular velocity, and the measured value of the z-axis angular velocity are not 0. Therefore, when the first original measurement data is subjected to the first preset process to generate first processed data, the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity can be set to zero, and the first processed data includes the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity after the zero setting process.
In order to further improve the accuracy of the attitude calculation, the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity may be compensated for angles according to the rotation angular velocity of the earth after the x-axis angular velocity, the y-axis angular velocity and the z-axis angular velocity are all zeroed. For example, after the x-axis angular velocity, the y-axis angular velocity, and the z-axis angular velocity are all zeroed, the x-axis angular velocity, the y-axis angular velocity, and the z-axis angular velocity are compensated according to the rotation angular velocity of the earth, respectively, and the first processing data includes the x-axis angular velocity, the y-axis angular velocity, and the z-axis angular velocity after the compensation processing.
And step S13, if the six-axis IMU is in a motion state, performing second preset processing on the first original measurement data to generate second processing data, and performing gesture calculation based on the second processing data and the second original measurement data.
In the step, when the first original measurement data is subjected to second preset processing to generate second processing data, first a first error value corresponding to the x-axis angular velocity, a second error value corresponding to the y-axis angular velocity and a third error value corresponding to the z-axis angular velocity at the current moment are determined, and then a calibration value corresponding to the x-axis angular velocity, a calibration value corresponding to the y-axis angular velocity and a calibration value corresponding to the z-axis angular velocity are respectively determined according to the first error value, the second error value and the third error value, wherein the second processing data comprises the calibration value corresponding to the x-axis angular velocity, the calibration value corresponding to the y-axis angular velocity and the calibration value corresponding to the z-axis angular velocity. The calibration value corresponding to the x-axis angular velocity is equal to the difference between the measured value of the x-axis angular velocity and the first error value, the calibration value corresponding to the y-axis angular velocity is equal to the difference between the measured value of the y-axis angular velocity and the second error value, and the calibration value corresponding to the z-axis angular velocity is equal to the difference between the measured value of the z-axis angular velocity and the third error value. It can be seen that the accuracy of the gesture calculation can be effectively improved by performing the gesture calculation through the calibration value corresponding to the x-axis angular velocity, the calibration value corresponding to the y-axis angular velocity, and the calibration value corresponding to the z-axis angular velocity.
When the six-axis IMU is in a static state, the magnitudes of the first error value, the second error value and the third error value can be determined. Further, when the six-axis IMU is in a static state, the duration of the static state can be timed, the accumulated sum of frames before and after the measured value of the x-axis angular velocity, the accumulated sum of frames before and after the measured value of the y-axis angular velocity and the accumulated sum of frames before and after the measured value of the z-axis angular velocity are respectively determined from the timing moment, when the timing duration is longer than a first preset duration and not longer than a second preset duration, the first error value is determined according to the accumulated sum of frames before and after the measured value of the x-axis angular velocity and updated and stored in real time, the second error value is determined according to the accumulated sum of frames before and after the measured value of the y-axis angular velocity and updated and stored in real time, the third error value is determined according to the accumulated sum of frames before and after the measured value of the z-axis angular velocity, and when the timing is longer than the second preset duration, the duration of the six-axis IMU is restarted, and the first error value, the second error value and the third error value are regenerated in real time.
Further, the first error value is equal to the average of the measured values of the x-axis angular velocity at each timing, the second error value is equal to the average of the measured values of the y-axis angular velocity at each timing, and the third error value is equal to the average of the measured values of the z-axis angular velocity at each timing. It should be noted that if the time length is not longer than the first preset time length, the first error value, the second error value and the third error value are calculated, and the data of the first error value, the second error value and the third error value are unstable due to the shorter time, if the time length is longer than the second preset time length, the first error value, the second error value and the third error value are calculated, which results in the waste of data resources, and therefore, if the time length is longer than the first preset time length and not longer than the second preset time length, the first error value, the second error value and the third error value are calculated reasonably.
When the gesture resolving method of the six-axis IMU is used for gesture resolving, firstly determining whether the six-axis IMU is in a static state, if so, performing first preset processing on first original measurement data to generate first processing data, performing gesture resolving based on the first processing data and second original measurement data, and if so, performing second preset processing on the first original measurement data to generate second processing data, and performing gesture resolving based on the second processing data and the second original measurement data. The first preset processing can eliminate zero offset errors and noise errors of the first original measurement data in the static state, and the second preset processing can eliminate zero offset errors and noise errors of the first original measurement data in the moving state, so that the result of gesture calculation is not influenced by the zero offset errors and the noise errors in the first original measurement data no matter the six-axis IMU is in the static state or the moving state, and the accuracy of gesture calculation of an object in the static state and the moving state can be effectively improved.
In order to execute the gesture resolving method of the six-axis IMU corresponding to the method embodiment, corresponding functions and technical effects are achieved. Referring to fig. 2, fig. 2 shows a block diagram of a six-axis IMU pose solving apparatus according to an embodiment of the application. The six-axis IMU includes a three-axis accelerometer and a three-axis gyroscope, and for convenience of explanation, only a portion related to the present embodiment is shown, and the posture resolution device 20 of the six-axis IMU provided in the embodiment of the present application includes:
The system comprises a determining module 21, a first resolving module 22 and a second resolving module 23, wherein the determining module is used for determining whether the six-axis IMU is in a static state, the first resolving module 22 is used for performing first preset processing on first original measurement data to generate first processing data and performing gesture resolving on the first processing data and second original measurement data if the six-axis IMU is in the static state, the first original measurement data is the original measurement data of the three-axis gyroscope, the second original measurement data is the original measurement data of the three-axis accelerometer, the first preset processing is used for eliminating zero bias errors and noise errors of the first original measurement data in the static state, and the second resolving module 23 is used for performing second preset processing on the first original measurement data to generate second processing data if the six-axis IMU is in the motion state, and performing gesture resolving on the second processing data and the second original measurement data based on the second processing data.
The above-mentioned six-axis IMU posture calculation device may implement the six-axis IMU posture calculation method of the above-mentioned method embodiment. The options in the method embodiments described above are also applicable to this embodiment and will not be described in detail here. The rest of the embodiments of the present application may refer to the content of the above method embodiments, and in this embodiment, no further description is given.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 3, the computer device 30 of this embodiment comprises at least one processor 31 (only one shown in fig. 3), a memory 32 and a computer program 33 stored in said memory 32 and executable on said at least one processor 31, said processor 31 implementing the steps of any of the method embodiments described above when said computer program 33 is executed.
The computer device 30 may be a smart television remote controller, an automobile screen remote controller, a gesture indicator, a mouse and the like. The computer device may include, but is not limited to, a processor 31, a memory 32. It will be appreciated by those skilled in the art that fig. 3 is merely an example of computer device 30 and is not intended to limit computer device 30, and may include more or fewer components than shown, or may combine certain components, or may include different components, such as input-output devices, network access devices, etc.
The Processor 31 may be a central processing unit (Central Processing Unit, CPU), the Processor 31 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application specific integrated circuits (Application SpecificIntegrated Circuit, ASIC), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 32 may in some embodiments be an internal storage unit of the computer device 30, such as a hard disk or a memory of the computer device 30. The memory 32 may also be an external storage device of the computer device 30 in other embodiments, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), etc. that are provided on the computer device 30. Further, the memory 32 may also include both internal and external storage units of the computer device 30. The memory 32 is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs, such as program code for the computer program. The memory 32 may also be used to temporarily store data that has been output or is to be output.
In addition, the embodiment of the present application further provides a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the steps in any of the above-mentioned method embodiments.
Embodiments of the present application provide a computer program product which, when run on a computer device, causes the computer device to perform the steps of the method embodiments described above.
In several embodiments provided by the present application, it will be understood that each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device to perform all or part of the steps of the method according to the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The foregoing embodiments have been provided for the purpose of illustrating the general principles of the present application, and are not to be construed as limiting the scope of the application. It should be noted that any modifications, equivalent substitutions, improvements, etc. made by those skilled in the art without departing from the spirit and principles of the present application are intended to be included in the scope of the present application.