Method for implementing somatosensory badminton game based on function fitting

By correcting the rotation quaternion of the gyroscope data and combining Kalman filtering and function fitting techniques, the problem of insufficient attitude calculation accuracy in traditional motion control systems is solved, achieving higher accuracy in swing action recognition and wider applicability.

CN117357901BActive Publication Date: 2026-11-24SHENZHEN HULE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311574857.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-22
Publication Date
2026-11-24
Estimated Expiration
2043-11-22

AI Technical Summary

Technical Problem

In traditional motion control systems, gyroscope data is susceptible to noise interference and drift, leading to a decrease in the accuracy of user action recognition, especially during long-term use where the accuracy of posture calculation is insufficient.

Method used

By correcting the rotational quaternion of gyroscope data using magnetometer and accelerometer data, and combining Kalman filter and function fitting techniques, the trajectory data of the motion sensing device is accurately calculated to identify the type of swing action.

Benefits of technology

It improves the accuracy and applicability of swing motion recognition, enhances the generalization and flexibility of the game, and improves the accuracy of user motion recognition and adaptability to swing motions of different users and scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117357901B_ABST
    Figure CN117357901B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and computer-readable storage medium for implementing a motion-sensing badminton game based on function fitting. The method includes: after the motion-sensing badminton game is started, acquiring motion-sensing data from a bound motion-sensing device, the motion-sensing data including magnetometer data, acceleration data, and gyroscope data; calculating the rotation quaternion of the motion-sensing device by solving the gyroscope data; correcting the rotation quaternion based on the magnetometer data and the acceleration data; calculating the trajectory data of the motion-sensing device based on the corrected rotation quaternion; performing function fitting on the trajectory data to identify the type of racket swing action performed by the user; and executing the corresponding game operation according to the type of racket swing action performed. The method for implementing a motion-sensing badminton game based on function fitting of this invention has advantages such as high accuracy in racket swing action recognition, wide applicability, and strong generalization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motion-sensing game technology, and in particular to a method, apparatus, device, and computer-readable storage medium for realizing motion-sensing badminton games based on function fitting. Background Technology

[0002] In the current field of motion-sensing games, in order to provide a more realistic and interactive user experience, developers often use various sensor technologies to capture the user's actual movements and map them into the game environment.

[0003] Traditional motion-sensing control systems typically use sensors such as accelerometers and gyroscopes to acquire attitude information of user devices. However, this sensor data is often affected by noise, especially during prolonged use. Gyroscope data may drift, reducing the accuracy of attitude calculation and leading to a decrease in the accuracy of user action recognition. Summary of the Invention

[0004] This application provides a method for implementing motion-sensing badminton games based on function fitting, aiming to improve the accuracy of user action recognition.

[0005] To achieve the above objectives, embodiments of this application provide a method for implementing a motion-sensing badminton game based on function fitting, comprising:

[0006] After the motion-sensing badminton game is started, motion-sensing data is obtained from the bound motion-sensing device. The motion-sensing data includes magnetometer data, acceleration data, and gyroscope data.

[0007] The rotation quaternion of the motion sensing device is obtained by solving the gyroscope data;

[0008] The rotational quaternion is corrected based on the magnetometer data and the acceleration data;

[0009] The trajectory data of the motion sensing device is calculated based on the corrected rotational quaternion;

[0010] The trajectory data is fitted with a function to identify the type of swing motion performed by the user;

[0011] Perform the corresponding game action based on the type of swing motion completed.

[0012] In one embodiment, correcting the rotational quaternion based on the magnetometer data and the acceleration data includes:

[0013] The attitude angle of the motion sensing device is calculated based on the magnetometer data and the acceleration data.

[0014] An observation equation is constructed based on gyroscope observations and the attitude angle.

[0015] A state equation is constructed based on the rotational quaternion and the gyroscope error;

[0016] The corrected rotational quaternion is obtained based on the observation equation and the state equation.

[0017] In one embodiment, the modified rotation quaternion is obtained based on the observation equation and the state equation, including:

[0018] Based on the observation equation and the state vector of the previous time step, predict the state vector and state covariance matrix of the current time step, wherein the state vector includes rotation quaternions and gyroscope errors;

[0019] Calculate the Kalman gain based on the observation vector and observation equation at the current moment;

[0020] Based on the current state vector and state covariance matrix predicted by the Kalman gain correction, the updated state vector and state covariance matrix are obtained, wherein the updated state vector includes the corrected rotation quaternion and gyroscope error.

[0021] In one embodiment, the attitude angles include pitch angle, roll angle, and yaw angle;

[0022] Calculating the attitude angle of the motion sensing device based on the magnetometer data and the acceleration data includes:

[0023] Calculate the pitch and roll angles of the motion sensing device based on the acceleration data;

[0024] The yaw angle of the motion sensing device is calculated based on the magnetometer data.

[0025] In one embodiment, before correcting the rotational quaternion based on the magnetometer data and the acceleration data, the method further includes:

[0026] The gyroscope data, acceleration data, and magnetometer data are corrected according to the ellipsoid fitting method.

[0027] In one embodiment, calculating the trajectory data of the motion-sensing device based on the corrected rotation quaternion includes:

[0028] A grid map consisting of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the terminal executing the motion-sensing game.

[0029] The position of the virtual rigid body in the grid map is updated based on the acceleration data and the corrected rotation quaternion.

[0030] The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

[0031] In one embodiment, performing function fitting on the trajectory data to identify the type of swing motion performed by the user includes:

[0032] The trajectory data is fitted into multiple preset swing functions, and the degree of fit between the trajectory data and each preset swing function is calculated.

[0033] The swing motion type corresponding to the preset swing function with the highest fit is selected as the swing motion performed by the user.

[0034] To achieve the above objectives, this application also proposes a device for implementing a motion-sensing badminton game based on function fitting, comprising:

[0035] The acquisition module is used to acquire motion data from the bound motion-sensing device after the motion-sensing badminton game is started. The motion-sensing data includes magnetometer data, acceleration data and gyroscope data.

[0036] The calculation module is used to calculate the rotation quaternion of the motion sensing device by solving the gyroscope data;

[0037] The correction module is used to correct the rotational quaternion based on the magnetometer data and the acceleration data;

[0038] The calculation module is used to calculate the trajectory data of the motion sensing device based on the corrected rotation quaternion;

[0039] The recognition module is used to perform function fitting on the trajectory data to identify the type of swing action performed by the user.

[0040] The execution module is used to perform the corresponding game operation based on the type of swing action completed.

[0041] To achieve the above objectives, this application also proposes a device for implementing a motion-sensing badminton game based on function fitting, including a memory, a processor, and a program for implementing a motion-sensing badminton game based on function fitting stored in the memory and executable on the processor. When the processor executes the program for implementing a motion-sensing badminton game based on function fitting, it implements the method for implementing a motion-sensing badminton game based on function fitting as described in any of the above claims.

[0042] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a program for implementing a motion-sensing badminton game based on function fitting. When the program for implementing a motion-sensing badminton game based on function fitting is executed by a processor, it implements the method for implementing a motion-sensing badminton game based on function fitting as described in any of the preceding claims.

[0043] The method for implementing motion-sensing badminton games based on function fitting in this application corrects the rotation quaternion obtained from gyroscope data using acceleration and magnetometer data, and then calculates the trajectory data of the motion-sensing device based on the corrected rotation quaternion. This accurately represents the posture of the motion-sensing device in space (i.e., the user's posture when swinging the racket). Then, function fitting is performed based on the calculated trajectory data to identify the type of swing action performed by the user. Thus, on the one hand, the function fitting method can obtain a more realistic swing trajectory, improving the accuracy of swing type recognition; on the other hand, the applicability of the function fitting method to swing actions of different users and in different scenarios can be utilized, improving the generalization and flexibility of the game method. Therefore, compared with traditional motion-sensing game solutions, the motion-sensing badminton game method of this application has advantages such as high swing action recognition accuracy, wide applicability, and strong generalization. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0045] Figure 1 This is a block diagram of an embodiment of the device for realizing a motion-sensing badminton game based on function fitting according to the present invention;

[0046] Figure 2 This is a flowchart illustrating an embodiment of the method for implementing a motion-sensing badminton game based on function fitting according to the present invention.

[0047] Figure 3 This is a block diagram of an embodiment of the device for realizing a motion-sensing badminton game based on function fitting according to the present invention.

[0048] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0049] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0050] To better understand the above technical solutions, exemplary embodiments of this disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of this disclosure to those skilled in the art.

[0051] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The quantifier "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of "first," "second," and "third," etc., does not indicate any order and can be interpreted as names.

[0052] like Figure 1 As shown, Figure 1 This is a schematic diagram of the hardware operating environment server 1 (also called a device for implementing motion-sensing badminton games based on function fitting) involved in the embodiments of the present invention.

[0053] The server in this embodiment of the invention includes devices with display functions such as "Internet of Things devices", smart air conditioners, smart lights, smart power supplies with network connectivity, AR / VR devices with network connectivity, smart speakers, autonomous vehicles, PCs, smartphones, tablets, e-book readers, and portable computers.

[0054] like Figure 1 As shown, the server 1 includes: a memory 11, a processor 12, and a network interface 13.

[0055] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the server 1, such as the hard disk of the server 1. In other embodiments, the memory 11 can also be an external storage device of the server 1, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the server 1.

[0056] Furthermore, the memory 11 may include both internal storage units of the server 1 and external storage devices. The memory 11 can be used not only to store application software and various types of data installed on the server 1, such as the code of program 10 for implementing a motion-sensing badminton game based on function fitting, but also to temporarily store data that has been output or will be output.

[0057] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 11 or process data, such as executing program 10 that implements a motion-sensing badminton game based on function fitting.

[0058] The network interface 13 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface), which is typically used to establish communication connections between the server 1 and other electronic devices.

[0059] The network can be the Internet, a cloud network, a Wi-Fi network, a Personal Area Network (PAN), a Local Area Network (LAN), and / or a Metropolitan Area Network (MAN). Various devices in the network environment can be configured to connect to the communication network according to various wired and wireless communication protocols. Examples of such wired and wireless communication protocols may include, but are not limited to, at least one of the following: Transmission Control Protocol and Internet Protocol (TCP / IP), User Datagram Protocol (UDP), Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), ZigBee, EDGE, IEEE 802.11, Li-Fi, 802.16, IEEE 802.11s, IEEE 802.11g, multi-hop communication, wireless access points (APs), device-to-device communication, cellular communication protocols, and / or Bluetooth communication protocols, or combinations thereof.

[0060] Optionally, the server may also include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be referred to as a screen or display unit, used to display information processed in server 1 and to display a visual user interface.

[0061] Figure 1Only server 1, which includes components 11-13 and program 10 for implementing motion-sensing badminton game based on function fitting, is shown. Those skilled in the art will understand that... Figure 1 The structure shown does not constitute a limitation on server 1 and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0062] In this embodiment, the processor 12 can be used to call the program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0063] After the motion-sensing badminton game is started, motion-sensing data is obtained from the bound motion-sensing device. The motion-sensing data includes magnetometer data, acceleration data, and gyroscope data.

[0064] The rotation quaternion of the motion sensing device is obtained by solving the gyroscope data;

[0065] The rotational quaternion is corrected based on the magnetometer data and the acceleration data;

[0066] The trajectory data of the motion sensing device is calculated based on the corrected rotational quaternion;

[0067] The trajectory data is fitted with a function to identify the type of swing motion performed by the user;

[0068] Perform the corresponding game action based on the type of swing motion completed.

[0069] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0070] The attitude angle of the motion sensing device is calculated based on the magnetometer data and the acceleration data.

[0071] An observation equation is constructed based on gyroscope observations and the attitude angle.

[0072] A state equation is constructed based on the rotational quaternion and the gyroscope error;

[0073] The corrected rotational quaternion is obtained based on the observation equation and the state equation.

[0074] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0075] Based on the observation equation and the state vector of the previous time step, predict the state vector and state covariance matrix of the current time step, wherein the state vector includes rotation quaternions and gyroscope errors;

[0076] Calculate the Kalman gain based on the observation vector and observation equation at the current moment;

[0077] Based on the current state vector and state covariance matrix predicted by the Kalman gain correction, the updated state vector and state covariance matrix are obtained, wherein the updated state vector includes the corrected rotation quaternion and gyroscope error.

[0078] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0079] Calculate the pitch and roll angles of the motion sensing device based on the acceleration data;

[0080] The yaw angle of the motion sensing device is calculated based on the magnetometer data.

[0081] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0082] The gyroscope data, acceleration data, and magnetometer data are corrected according to the ellipsoid fitting method.

[0083] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0084] A grid map consisting of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the terminal executing the motion-sensing game.

[0085] The position of the virtual rigid body in the grid map is updated based on the acceleration data and the corrected rotation quaternion.

[0086] The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

[0087] In one embodiment, the processor 12 can be used to call a program stored in the memory 11 that implements a motion-sensing badminton game based on function fitting, and perform the following operations:

[0088] The trajectory data is fitted into multiple preset swing functions, and the degree of fit between the trajectory data and each preset swing function is calculated.

[0089] The swing motion type corresponding to the preset swing function with the highest fit is selected as the swing motion performed by the user.

[0090] Based on the hardware architecture of the device for implementing motion-sensing badminton games using function fitting, this invention proposes an embodiment of the method for implementing motion-sensing badminton games using function fitting. The method for implementing motion-sensing badminton games using function fitting of this invention aims to improve the accuracy of user motion recognition.

[0091] Reference Figure 2 , Figure 2 This is an embodiment of the method for implementing a motion-sensing badminton game based on function fitting according to the present invention. The method for implementing a motion-sensing badminton game based on function fitting includes the following steps:

[0092] S10. After the motion-sensing badminton game is started, motion-sensing data is obtained from the bound motion-sensing device. The motion-sensing data includes magnetometer data, acceleration data, and gyroscope data.

[0093] This motion-sensing badminton game is a motion-sensing game based on motion-sensing technology. It can be a virtual reality game, or a traditional 2D or 3D game. Compared to traditional game controllers or keyboards, motion-sensing badminton games capture the user's real movements and postures and translate them into in-game hitting actions.

[0094] Alternatively, the motion-sensing badminton game can be a web-based web game, an HTML5-based mini-program, or a standalone app.

[0095] Furthermore, motion-sensing devices are a class of devices used to capture, recognize, and translate user body movements. They typically include sensors, controllers, and related hardware components, designed for use in conjunction with interactive experience technologies such as video games, virtual reality, and augmented reality.

[0096] In the technical solution of this application, the motion sensing device includes a magnetometer, an accelerometer, and a gyroscope, to collect magnetometer data, acceleration data, and gyroscope data respectively when the user is playing a game.

[0097] Optionally, the motion-sensing devices used in the technical solutions of this application include, but are not limited to, mobile phones, bracelets, watches, rings, controllers, wristbands, etc., with gyroscopes.

[0098] Specifically, the binding of motion-sensing devices to game terminals can be achieved through communication methods such as USB, WIFI, Bluetooth, or 2.4G. The game terminal refers to the terminal that runs motion-sensing games, which can be mobile terminals such as mobile phones, tablets, laptops, and handheld consoles, or fixed terminals such as desktop computers and home consoles.

[0099] After the binding is completed, when the user terminal starts the motion-sensing badminton game on the game terminal, the terminal can periodically receive or obtain gyroscope data and acceleration data from the motion-sensing device based on the connection protocol with the motion-sensing device.

[0100] S20. Solve the gyroscope data to obtain the rotation quaternion of the motion sensing device.

[0101] In this context, a quaternion is a mathematical tool used to describe rotation. It consists of one real part and three imaginary parts. In attitude calculation, quaternions are used to represent the rotation of the device relative to an initial attitude. The rotational speed information provided by the gyroscope is integrated, and the device's rotation is tracked by updating the quaternions.

[0102] Specifically, gyroscope data can be calculated based on quaternion attitude calculation algorithms to obtain rotation quaternions.

[0103] Specifically: Let the current time be t, the rotational speed provided by the gyroscope be ω(t), and the rotational quaternion of the device at time t be q(t). By integrating the rotational speed of the gyroscope, a new rotational quaternion can be obtained:

[0104] q(t+Δt)=q(t)+1 / 2Δω(t);

[0105] Where Δt is the time interval between two sensor data samplings.

[0106] It can be understood that by continuously outputting the rotation quaternion of the current motion sensing device's posture, the rotation angle (i.e., posture angle) of the motion sensing device can be obtained.

[0107] S30. Correct the rotational quaternion based on the magnetometer data and the acceleration data.

[0108] Specifically, a Kalman filter can be used to fuse magnetometer and acceleration data, thereby updating the rotation quaternion. The Kalman filter is a recursive algorithm used to fuse information from different sensors to improve the accuracy of attitude calculation.

[0109] Specifically, gyroscope data can be affected by factors such as drift, bias, temperature, vibration, and impact. These errors accumulate over time, causing the data collected by the gyroscope to deviate from the actual motion performance of the motion sensing device, thus affecting the accuracy of judging the user's actions.

[0110] Specifically, the Kalman filter can calculate another attitude data based on magnetometer and acceleration data, and then use this attitude data to correct the rotation quaternion. This corrected rotation quaternion can more accurately reflect the actual attitude of the motion sensing device, thus reducing errors caused by gyroscope data drift and providing a more reliable basis for subsequent trajectory data calculation.

[0111] S40. Calculate the trajectory data of the motion sensing device based on the corrected rotation quaternion.

[0112] Specifically, after obtaining the corrected rotation quaternion, it can be transformed into a rotation matrix to represent the rotation of the motion sensing device. Then, the rotation matrix is ​​fused with accelerometer data to obtain the motion trajectory of the motion sensing device in space. Finally, based on this trajectory, the trajectory data of the motion sensing device can be obtained.

[0113] S50. Perform function fitting on the trajectory data to identify the type of swing action performed by the user.

[0114] In this context, the racket swing refers to the various actions and sequences of actions performed by the user during the simulated racket swing in a motion-sensing badminton game. These actions can simulate various actions in a real badminton game, such as forehand shots, backhand shots, smashes, and serves.

[0115] Specifically, to identify the type of swing motion performed by a user by fitting a function to trajectory data, typical swing functions representing different types of swing motions can be fitted using swing motion data collected in actual badminton games. Then, the function fitted to the user's trajectory data in the motion-sensing badminton game is compared with these typical swing functions, and finally, the type of swing motion performed by the user is identified based on the comparison results.

[0116] It's understandable that function fitting is used to identify swing motion types. On one hand, function fitting methods can model and describe the user's swing motion based on actual swing trajectory data. By fitting a function, the details and features of the swing motion can be accurately captured, including the starting point, ending point, trajectory shape, and speed changes. Compared to other sensor-based or rule-based methods, function fitting more accurately reflects the true characteristics of the swing motion, improving the accuracy of motion recognition.

[0117] On the other hand, function fitting methods can derive a general swing function model based on multiple sets of collected sample data. This model can be used to identify swing movements of different users in different scenarios, exhibiting a certain degree of generalization ability. Through function fitting, universally applicable movement patterns and rules can be learned from sample data, enabling the recognition of new swing movements. This generalization ability makes function fitting methods highly adaptable and practical.

[0118] Furthermore, function fitting methods can select different function forms to model the swing motion according to actual needs. Depending on the specific situation, polynomial functions, trigonometric functions, Gaussian functions, etc., can be selected to fit the swing trajectory data. This flexibility allows function fitting methods to adapt to different types of swing motions, possessing high adaptability and scalability. Moreover, function fitting methods can perform calculations and inferences quickly, enabling action recognition to be applied in real-time scenarios. The calculation and classification of the swing function can be completed in a short time, improving game performance.

[0119] S60. Execute the corresponding game operation based on the type of swing action completed.

[0120] Specifically, in motion-sensing badminton games, there are corresponding game operation commands for each type of swing action. For example, a forehand shot can be mapped to a forward swing operation in the game; a backhand shot can be mapped to a side swing operation in the game.

[0121] Based on this, after determining the type of swing motion performed by the user, the corresponding game operation instructions can be passed to the game character for execution. This can be achieved through interaction with the game engine or controller, such as through programming interfaces or controller input, to pass instructions to the game system. In this way, the user's swing motion can be reproduced.

[0122] It is understood that the method for realizing a motion-sensing badminton game based on function fitting in this application corrects the rotation quaternion obtained from the gyroscope data using acceleration and magnetometer data, and then calculates the trajectory data of the motion-sensing device based on the corrected rotation quaternion. This allows for an accurate representation of the motion-sensing device's posture in space (i.e., the user's posture when swinging the racket). Then, function fitting is performed based on the calculated trajectory data to identify the type of swing action performed by the user. Thus, on the one hand, the function fitting method can obtain a more realistic swing trajectory, improving the accuracy of swing type recognition; on the other hand, the applicability of the function fitting method to swing actions of different users and in different scenarios can be utilized, improving the generalization and flexibility of the game method. Therefore, compared with traditional motion-sensing game solutions, the motion-sensing badminton game method of this application has advantages such as high swing action recognition accuracy, wide applicability, and strong generalization.

[0123] In some embodiments, correcting the rotational quaternion based on the magnetometer data and the acceleration data includes the following steps:

[0124] S31. Calculate the attitude angle of the motion sensing device based on the magnetometer data and the acceleration data.

[0125] Among these, attitude angles describe the angles in which an object is facing in three-dimensional space, and typically include three angles: pitch, yaw, and roll.

[0126] Specifically, calculating the attitude angle of the motion sensing device based on the magnetometer data and the acceleration data includes the following steps:

[0127] S311. Calculate the pitch angle and roll angle of the motion sensing device based on the acceleration data.

[0128] Specifically, the pitch and roll angles of a motion-sensing device can be calculated based on the following steps:

[0129] (1) Calculate the total acceleration: Calculate the total acceleration of the motion sensing device by combining the three-axis acceleration components provided by the accelerometer.

[0130] (2) Calculate pitch and roll angles: Calculate the pitch and roll angles using mathematical methods such as trigonometric functions, utilizing the components of the total acceleration. Typically, the pitch angle can be calculated using the arctangent function, and the roll angle can be calculated using the arcsine and arccosine functions.

[0131] (3) Consider the device orientation: Correct the calculated pitch and roll angles to take into account the device orientation and ensure that they are in the correct orientation relative to the motion sensing device coordinate system.

[0132] S312. Calculate the yaw angle of the motion sensing device based on the magnetometer data.

[0133] Specifically, the yaw angle of the motion-sensing device can be calculated based on the following steps:

[0134] (1) Obtain magnetometer data: Obtain the three-axis magnetic field components from the magnetometer of the somatosensory device.

[0135] (2) Calculate the magnetic north direction: Using the data provided by the magnetometer, calculate the magnetic north direction of the motion sensing device relative to the Earth coordinate system.

[0136] (3) Calculate the yaw angle: Using the calculated magnetic north direction and the orientation information of the device, calculate the yaw angle of the motion sensing device. This can be calculated using the arctangent function.

[0137] S32. Construct observation equations based on gyroscope observations and the attitude angles.

[0138] Among these, the gyroscope is used to measure the angular velocity of the motion sensing device in space, that is, the rotational speed around each axis. Therefore, gyroscope measurements refer to the angular velocities of the motion sensing device around the X, Y, and Z axes, usually expressed in vector form.

[0139] Specifically, the observation equation can be constructed based on the following steps:

[0140] (1) Construct the rotation matrix H:

[0141] Using the pitch, roll, and yaw information calculated in step S31, construct the rotation matrix H.

[0142] (2) Convert the attitude angle into a quaternion q:

[0143] The attitude angles are converted into quaternions using the constructed rotation matrix H.

[0144] (3) Constructing the observation equation:

[0145]

[0146]

[0147] Where: wx, wy, wz are gyroscope observations; R is the measurement noise; φroll represents the roll angle; θpitch represents the pitch angle; and ψyaw represents the yaw.

[0148] By constructing observation equations, the system can map the gyroscope's observations into the attitude angle space.

[0149] S33. Construct a state equation based on the rotation quaternion and gyroscope error.

[0150] In this embodiment, gyroscope error typically refers to gyroscope drift error, which is the persistent error generated by the gyroscope when measuring angular velocity. More broadly, gyroscope error can include gyroscope measurement errors caused by factors such as drift, impact, and temperature.

[0151] Specifically, the purpose of establishing the state equation is to establish the relationship between the gyroscope error and the system state (rotational quaternion).

[0152] Specifically, the expression for the state equation is as follows:

[0153]

[0154] X = [q0, q1, q2, q3, b] x b y b z ] T .

[0155] Where A is the system coefficient matrix obtained from the partial derivatives of the gyroscope; Qk is the process covariance of the system, that is, the covariance corresponding to the process noise of the system; q0, q1, q2, q3 are quaternions; bx, by, bz are the three axial errors of the gyroscope, given by the Kalman filter.

[0156] S34. Obtain the corrected rotational quaternion based on the observation equation and the state equation.

[0157] Specifically, the state equation can be used to predict the current state of the system based on the state estimate from the previous moment and the current input data (gyroscope observations). Then, the observation equation can be used to correct the predicted current state to obtain a corrected rotation quaternion. Through continuous prediction and correction, the gyroscope error can be continuously corrected to obtain a rotation quaternion that more accurately represents the attitude of the motion sensing device, thereby obtaining a more accurate trajectory prediction.

[0158] In some embodiments, obtaining the modified rotation quaternion based on the observation equation and the state equation includes the following steps:

[0159] S341. Based on the observation equation and the state vector of the previous moment, predict the state vector and state covariance matrix of the current moment, wherein the state vector includes rotation quaternions and gyroscope errors.

[0160] In this context, the state covariance matrix is ​​used to represent the uncertainty in the prediction of the state vector.

[0161] Specifically, the state can be predicted using the state vector and state equation from the previous time step. This step includes predicting the state vector and updating the state covariance matrix. Simultaneously, the state covariance matrix can be updated based on the system's dynamic properties and the observation equations.

[0162] S342. Calculate the Kalman gain based on the observation vector and observation equation at the current moment.

[0163] Kalman gain is a key parameter in the Kalman filtering algorithm, used to find the optimal trade-off between state prediction and observation to optimize the estimation of the system state. The role of Kalman gain is to adjust the weights of the state estimate, making it closer to either the observation or the prediction, depending on the reliability of both.

[0164] Specifically, the Kalman gain can be calculated using the state covariance matrix and the covariance matrix of the observation equation.

[0165] S343. Based on the current state vector and state covariance matrix predicted by the Kalman gain correction, the updated state vector and state covariance matrix are obtained, wherein the updated state vector includes the corrected rotation quaternion and gyroscope error.

[0166] Specifically, the predicted state vector is corrected using Kalman gain and observation residuals (the difference between observed and predicted values) to obtain an updated state vector. Simultaneously, the state covariance matrix can be updated using Kalman gain.

[0167] By performing the above steps, the system can dynamically fuse observations and the system model using the Kalman filter algorithm based on the observation equation and the state equation, thereby obtaining the corrected rotation quaternion and gyroscope error. This process enables real-time correction of the system state and improves the accuracy of attitude estimation for the motion sensing device.

[0168] In some embodiments, before correcting the rotational quaternion based on the magnetometer data and the acceleration data, the method further includes:

[0169] The gyroscope data, acceleration data, and magnetometer data are corrected according to the ellipsoid fitting method.

[0170] Specifically, by using the ellipsoid fitting method to correct the gyroscope data, acceleration data, and magnetometer data, the sensor measurements can be obtained more accurately, thereby improving the accuracy of attitude calculation.

[0171] Specifically, the data correction steps for the ellipsoid fitting method are as follows:

[0172] (1) Acquire raw sensor data: Obtain raw data from the gyroscope, accelerometer, and magnetometer. This data includes angular velocity data from the gyroscope, acceleration data from the accelerometer, and magnetic field data from the magnetometer.

[0173] (2) Ellipsoid Fitting: Ellipsoid fitting was performed on the data from the gyroscope, accelerometer, and magnetometer respectively. Ellipsoid fitting is a mathematical method that describes the error characteristics of the sensor by fitting an ellipsoid. This can effectively correct for nonlinearities and biases in sensor measurements.

[0174] (3) Correcting gyroscope data: The angular velocity data of the gyroscope is corrected using the ellipsoidal fitting results of the gyroscope. This can help remove offset and nonlinear effects caused by errors in the gyroscope itself.

[0175] (4) Accelerometer data correction: The accelerometer acceleration data is corrected using the ellipsoidal fitting results of the accelerometer. This helps to eliminate the zero bias and nonlinearity errors of the accelerometer.

[0176] (5) Correcting magnetometer data: The magnetic field data of the magnetometer is corrected using the ellipsoidal fitting results of the magnetometer. This helps to resolve possible interference from hard iron and other magnetic fields that may affect the magnetometer.

[0177] (6) Obtain the corrected sensor data: Obtain the corrected gyroscope, accelerometer and magnetometer data. This corrected data more accurately reflects the real physical quantities and provides more accurate input for subsequent attitude calculation.

[0178] In some embodiments, the trajectory data of the motion-sensing device is calculated based on the corrected rotation quaternion, including:

[0179] S41. Generate a grid map consisting of multiple grid cells and a virtual rigid body that matches the motion-sensing device on the terminal executing the motion-sensing game.

[0180] Among these, a grid map is an image representation method that divides space into regular grid units. It divides the entire space into discrete small regions, each region called a grid unit, which can be square, rectangular, or other shapes. Each grid unit has a unique identifier and coordinates to represent its position within the entire map. In the technical solution of this application, the grid map is used to represent the layout of a game scene. Each grid unit can correspond to a fixed-size region or grid, used to record the position of a virtual rigid body in the game.

[0181] Specifically, after the motion-sensing badminton game starts, a grid map can be constructed based on preset initialization parameters. This grid map can be a two-dimensional map (such as a planar map) or a three-dimensional map (such as a stereoscopic scene). It is worth noting that, according to the preset initialization parameters, the size of each grid cell and the coordinate values ​​of each grid cell are determined at the same time as the grid map is generated.

[0182] Furthermore, a rigid body refers to an object in the physical world that has a fixed shape and mass and does not deform or bend. A virtual rigid body is a virtual model with corresponding physical properties. In the technical solution of this application, the virtual rigid body is used to record the movement trajectory of the motion sensing device in a grid map.

[0183] S42. Update the position of the virtual rigid body in the grid map based on the acceleration data and the corrected rotation quaternion.

[0184] Specifically, by using the corrected rotation quaternion, the orientation of the virtual rigid body can be updated to ensure that the virtual rigid body's orientation in the virtual environment matches the user's actual actions. Then, using acceleration data combined with the updated orientation information, the position of the virtual rigid body in the grid map can be updated. This can be done by estimating the velocity by integrating the acceleration data, and then integrating the velocity to update the position.

[0185] S43. Record the coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map as the trajectory data.

[0186] Specifically, a data structure can be created to store the coordinate data of the mesh cells traversed by the virtual rigid body. Data structures such as arrays, lists, and matrices can be used to represent the trajectory data. During gameplay, the coordinate values ​​of the mesh cells where the virtual rigid body is located can be recorded into the trajectory data structure based on the time sequence, serving as the trajectory data of the motion-sensing device in space.

[0187] As can be understood, the above steps can represent the trajectory data of the motion-sensing device as processed grid coordinates, converting a continuous sequence of coordinates into a discrete sequence of grid cells. This removes minute variations between adjacent coordinates, reducing data redundancy and duplication, thereby optimizing data representation and storage, and improving the efficiency of motion trajectory calculation.

[0188] In some embodiments, function fitting is performed on the trajectory data to identify the type of swing motion performed by the user, including:

[0189] S51. Substitute the trajectory data into multiple preset swing functions for fitting, and calculate the trajectory data to select a preset swing function:

[0190] In this context, the preset swing function is a mathematical function or model predefined in swing motion analysis to simulate or describe a specific type of swing motion. These functions are typically designed based on the experience of domain experts or experimental data, aiming to capture and express the motion characteristics associated with the swing motion. For example, preset swing functions can be obtained by fitting the following functions: sine function, cosine function, polynomial function, linear regression function, etc.

[0191] Specifically, after obtaining the trajectory data representing the movement of the motion-sensing device, this trajectory data can be substituted into each preset swing function. A fitting algorithm (such as the least squares method) is then used to calculate the goodness of fit between each function and the trajectory data. The goodness of fit can be calculated by comparing the residuals between the trajectory data and the function model.

[0192] S52. Select the swing action type corresponding to the preset swing function with the highest fitting degree as the swing action completed by the user.

[0193] Specifically, the highest value among the calculated goodness-of-fit values ​​is selected, corresponding to the preset swing function that best matches the trajectory data. This represents the best fit between the trajectory data and a certain type of swing motion. Based on this, the swing function corresponding to the highest goodness-of-fit can be regarded as the type of swing motion performed by the user.

[0194] Through the above steps, the system can determine the type of swing action performed by the user based on the fit of the preset swing function.

[0195] In addition, refer to Figure 3 The present invention also proposes a device for realizing a motion-sensing badminton game based on function fitting, the device comprising:

[0196] The acquisition module 110 is used to acquire motion data from the bound motion-sensing device after the motion-sensing badminton game is started. The motion-sensing data includes magnetometer data, acceleration data and gyroscope data.

[0197] The calculation module 120 is used to calculate the rotation quaternion of the motion sensing device by solving the gyroscope data;

[0198] Correction module 130 is used to correct the rotational quaternion based on the magnetometer data and the acceleration data;

[0199] Calculation module 140 is used to calculate the trajectory data of the motion sensing device based on the corrected rotation quaternion;

[0200] The recognition module 150 is used to perform function fitting on the trajectory data to identify the type of swing action performed by the user.

[0201] The execution module 160 is used to execute the corresponding game operation based on the type of swing action completed.

[0202] The steps for implementing each functional module of the device for realizing a motion-sensing badminton game based on function fitting can be referred to in various embodiments of the method for realizing a motion-sensing badminton game based on function fitting of the present invention, and will not be repeated here.

[0203] Furthermore, this invention also proposes a computer-readable storage medium, which can be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable storage medium includes a program 10 for implementing a motion-sensing badminton game based on function fitting. The specific implementation of the computer-readable storage medium of this invention is largely the same as the method for implementing a motion-sensing badminton game based on function fitting and the specific implementation of the server 1 described above, and will not be repeated here.

[0204] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0205] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0206] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0207] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0208] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0209] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for implementing motion-sensing badminton game based on function fitting, characterized in that, include: After the motion-sensing badminton game is started, motion-sensing data is obtained from the bound motion-sensing device. The motion-sensing data includes magnetometer data, acceleration data, and gyroscope data. The rotation quaternion of the motion sensing device is obtained by solving the gyroscope data; The rotational quaternion is corrected based on the magnetometer data and the acceleration data; The trajectory data of the motion sensing device is calculated based on the corrected rotational quaternion; The trajectory data is fitted with a function to identify the type of swing motion performed by the user; Perform the corresponding game action based on the type of swing motion completed; The correction of the rotational quaternion based on the magnetometer data and the acceleration data includes: The attitude angle of the motion sensing device is calculated based on the magnetometer data and the acceleration data. An observation equation is constructed based on gyroscope observations and the attitude angle. A state equation is constructed based on the rotational quaternion and gyroscope error; Based on the observation equation and the state vector of the previous time step, predict the state vector and state covariance matrix of the current time step, wherein the state vector includes rotation quaternions and gyroscope errors; Calculate the Kalman gain based on the observation vector and observation equation at the current moment; Based on the current state vector and state covariance matrix predicted by the Kalman gain correction, the updated state vector and state covariance matrix are obtained, wherein the updated state vector includes the corrected rotation quaternion and gyroscope error.

2. The method for implementing motion-sensing badminton game based on function fitting as described in claim 1, characterized in that, The attitude angles include pitch angle, roll angle, and yaw angle; Calculating the attitude angle of the motion sensing device based on the magnetometer data and the acceleration data includes: Calculate the pitch and roll angles of the motion sensing device based on the acceleration data; The yaw angle of the motion sensing device is calculated based on the magnetometer data.

3. The method for implementing motion-sensing badminton game based on function fitting as described in claim 2, characterized in that, Before correcting the rotational quaternion based on the magnetometer data and the acceleration data, the method further includes: The gyroscope data, acceleration data, and magnetometer data are corrected according to the ellipsoid fitting method.

4. The method for implementing motion-sensing badminton game based on function fitting as described in claim 1, characterized in that, The trajectory data of the motion-sensing device is calculated based on the corrected rotation quaternion, including: A grid map consisting of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the terminal executing the motion-sensing game. The position of the virtual rigid body in the grid map is updated based on the acceleration data and the corrected rotation quaternion. The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

5. The method for implementing motion-sensing badminton game based on function fitting as described in claim 1, characterized in that, The trajectory data is fitted with a function to identify the type of swing motion performed by the user, including: The trajectory data is fitted into multiple preset swing functions, and the degree of fit between the trajectory data and each preset swing function is calculated. The swing motion type corresponding to the preset swing function with the highest fit is selected as the swing motion performed by the user.

6. A device for implementing a motion-sensing badminton game based on function fitting, used to implement the method for implementing a motion-sensing badminton game based on function fitting as described in any one of claims 1 to 5, characterized in that, The device includes: The acquisition module is used to acquire motion data from the bound motion-sensing device after the motion-sensing badminton game is started. The motion-sensing data includes magnetometer data, acceleration data and gyroscope data. The calculation module is used to calculate the rotation quaternion of the motion sensing device by solving the gyroscope data; The correction module is used to correct the rotational quaternion based on the magnetometer data and the acceleration data; The calculation module is used to calculate the trajectory data of the motion sensing device based on the corrected rotation quaternion; The recognition module is used to perform function fitting on the trajectory data to identify the type of swing action performed by the user. The execution module is used to perform the corresponding game operation based on the type of swing action completed.

7. A device for realizing motion-sensing badminton games based on function fitting, characterized in that, The system includes a memory, a processor, and a program for implementing a motion-sensing badminton game based on function fitting, which is stored in the memory and can run on the processor. When the processor executes the program for implementing the motion-sensing badminton game based on function fitting, it implements the method for implementing the motion-sensing badminton game based on function fitting as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for implementing a motion-sensing badminton game based on function fitting. When the program for implementing a motion-sensing badminton game based on function fitting is executed by a processor, it implements the method for implementing a motion-sensing badminton game based on function fitting as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Somatosensory ball hitting control method and device, medium and electronic equipment

    CN114733189A

  • Shuttlecock motion sensing game equipment

    CN116510282A