# Swimming Attitude for Tracking Error Correction Based on Mahony Algorithm

Authors: Zheng Chang; Yu Zhao
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Swimming is predominantly a long-distance endurance sport. In this sport, like in many others, monitoring and tracking swimming attitude error correction and how it changes over time is critical. Besides, in swimming posture measurement, due to the absorption and refraction of various signals of water, sensors relying on external information cannot provide accurate information. In addition, the inertial technology is not dependent on external information, suitable for the field of swimming posture measurement. Inertial attitude measurement requires initial alignment technology to provide initial values to calculate the attitude in the swimming movement. However, the swimmer’s jump time is uncertain and the traditional initial alignment algorithm needs a long time to get a high-precision result. To solve this problem, in this paper, we proposed a fast alignment method by the Mahony algorithm. In our work, we have used nine-axis inertial measurement unit of micro-electro-mechanical systems (MEMS) to collect information. Furthermore, we calculated the attitude angle by angular velocity information, horizontal attitude angle, and yaw angle, and these were corrected by acceleration information and magnetic field intensity information, respectively, and multisource information was integrated by a complementary filtering method. It is simple to acquire the starting value of inertial attitude measurement. Laboratory experiments verify that the horizontal accuracy of attitude angle can reach the angle classification within 3 s, which meets the requirements of swimming sports. The algorithm’s viability is further confirmed through experiments in real-world sporting scenarios.


---

## Body

## 1. Introduction

In recent years, with the proposal of the slogan “Science and technology helps sports,” more and more technologies have been applied to the field of human movement measurement [1]. Attitude tracking system is one of the key techniques among the aforementioned technologies, which plays an increasingly important role in national defense and national economy. Through the real-time capture and measurement of human body posture and data processing and analysis, it can effectively realize 3D gait analysis, prosthesis-assisted production and correction, spinal curvature correction measurement, and other auxiliary diagnosis and treatment, as well as sports training. At present, common attitude measurement methods include positioning and measuring attitude based on optical markers, attitude recognition based on image analysis, and attitude measurement based on inertial technology. The attitude measurement method based on optical markers and the attitude recognition method based on image analysis is both optics-based attitude measurement methods. When the attitude measurement is carried out on the water surface, due to the refraction of water, spray, and the occlusion of light by the human body, it cannot achieve a good attitude measurement effect. Underwater optical measurement needs to be arranged in a narrow environment and requires more cameras to measure the attitude of the whole swimming section, which is costly and difficult to achieve. Currently, a set of optical attitude measurement equipment for the 15 m swimming section has been installed in the Training Bureau of the General Administration of Sport of China, but it can only provide the display of lateral images, not quantitative attitude indicators, and the price is extremely expensive. With the development of MEMS, inertial devices with two characteristics of lightweight and low cost, inertial technology, as a multiscene application technology independent of external information, are gradually introduced into the measurement of human body motion.Inertial attitude measurement needs to provide initial value through initial alignment technology to obtain continuous motion attitude information by continuous integral calculation. The most traditional method of initial alignment is shaking resistance coarse alignment [2], the algorithm core is to assume that the carrier is in a static state, the measurement of angular velocity and acceleration information is equal to the Earth’s rotation angular velocity and the acceleration of gravity, and both are compared to calculate the initial attitude angle, but the algorithm ignores the shaking effect of measurement error and inertial device. In addition, due to the requirements of lightweight and miniaturization of sensors worn in swimming sports, MEMS devices must be used for measurement, and the current MEMS devices still cannot sense the ground velocity well, so the antisloshing rough alignment method cannot be applied to swimming sports. At present, the initial alignment method [3] commonly used in the field of inertia under the shaking base needs a long time to complete the relevant work, which has a great impact on the user experience of athletes. Therefore, a fast and accurate initial alignment method that meets the requirements has become an urgent problem to be solved. On other hand, the Strapdown inertial navigation system measurement device MIMU is an important component, because of its light weight, small size, stability, and short-term accuracy and is widely used in UAV, satellite, missile attitude control, and in the field of military navigation is playing a huge role. Therefore, the research on MIMU has become a hot topic in recent years. However, the traditional MIMU itself is not high precision, long time using gyro drift will cause a large attitude error, so the MIMU needs to be combined with other sensors to overcome this shortcoming. In order to solve the error caused by gyro drift, commonly used sensors are magnetometer, GPS, and so on. In reference [4], an extended Kalman filter based on attitude angle error is proposed. Literature [5] proposed a Kalman filter that uses GPS to compensate attitude error, which effectively improves the accuracy of navigation system. However, GPS signal is unstable and easy to be lost in some complex terroids, which limits its application. An attitude quaternion Kalman filtering algorithm based on magnetometer and MIMU is proposed in this paper. Different from literature [6], attitude quaternion is directly selected as a state variable, which simplifies the dimension of the system and reduces the amount of calculation. The attitude angle of the carrier is estimated by accelerometer and magnetometer, and then it is converted into quaternion measurement value, and the constraint relation between the state variables is considered. The attitude angle of the carrier is estimated by Kalman filter, which reduces the dependence on gyro accuracy. Finally, Matlab software is used for simulation, and the results show the effectiveness of the filtering algorithm.In inertial navigation attitude modeling, inertial navigation platform angle error is usually approximated as attitude angle error, which is used for Kalman filtering. This simple approximation brings some errors to the mathematical model of the combined system, which leads to a decrease in measurement accuracy. To improve the attitude accuracy, this paper deduces the conversion relation between platform Angle error and attitude Angle error. The filtering model is improved from two aspects of measurement matrix modification and observation preprocessing. Through the algorithm simulation, the improved measurement accuracy is analyzed, and the error characteristics are statistically analyzed. The simulation results show that the improved filtering algorithm can effectively improve the precision of combined pose measurement and has a certain engineering application value. The inertial motion tracking system is mainly composed of MEMS accelerometers, gyroscopes, and magnetometers. Due to the manufacturing and using method of MEMS sensor, the static output of MEMS accelerometer has certain measurement error, which limits its use effect. At present, the most popular static correction method in engineering is the maximum–minimum-value method. The disadvantage of this method is that it can only estimate the scale factor error and zero deviation, and it is easy to be disturbed by random error. Another more common correction method that is tested is gyroscope inertial measurement unit, a specific combination of calibration compensation method, and this method mainly relies on a rotating platform to provide reference data for error correction. This can be a static and dynamic calibration error at the same time, and this method model has a correction effect of high precision. But in the process of correction requires multiple rotating platform operation, and repairing the normal process is complicated, and the cost of the rotating platform is beyond the range of ordinary users.It is known that human motion has certain geometric constraints, and introducing these constraints can achieve a better motion-tracking effect. At present, the commonly used method of tracking human body posture with the bone model of a joint link is to obtain the space position between elbow and wrist through the transformation of the coordinate system and to obtain the position of the reference shoulder joint point by using Lagrange optimization method through constraint relation. This method can locate the joint position, but cannot get the corresponding angle when the arm is flipped. In this paper, a new initial alignment method based on Mahony complementary filtering algorithm is proposed. Based on MEMS-SINS initial alignment principle, an accelerometer and magnetometer are used to correct the angle estimated by a gyroscope. Mahony algorithm is used in the correction process, which well combines the low-frequency performance of the gyroscope and the high-frequency performance of the accelerometer. It can quickly provide an initial alignment result whose accuracy meets the requirements of swimming motion and has a certain anti-interference ability. The key contributions of this research work are listed as below:(1)
We begin by explaining the overall design of the proposed scheme for attitude estimation and then we reduce a mathematical model error using various mathematical equations.(2)
After that, for effective detection and correction of swimming attitude error, we tested athletes from the national swimming team at the Zhejiang and concluded the following from various experiments:The XYZ triaxial acceleration data corresponding to different swimming strokes of equal intensity are significantly different, which can be used as the basis for human swimming stroke recognition. The amplitude of acceleration and angular velocity frequency corresponding to the same swimming stroke with different intensities are greatly different, which can be used to judge the swimming intensity.The left and right rotation Angle of the human body is a simple periodic signal for freestyle and backstroke. As a result, the human body’s movement period and amplitude can be extracted, and the damage and fatigue degrees of the human body can be evaluated by the difference and variance of the left and right sides, respectively.The rest of this work is arranged as follows: Section2 is based on related works of another researcher in the current domain, Section 3 explains our proposed work during which we reduced the mathematical model error, Section 4 is comprised of our experimental work and achievements, and Section 5 concludes our work.


## 2. Related Work

Swimming instructors want to track their athletes’ performance to design and improve a competitive model for their best swimmers. A swimmer goes through numerous swimming stages from wall to wall throughout a match, along with a dive into the water or wall push-off, gliding, and stroke preparation, and eventually swimming up to the turnaround at the end of the loop and restarting the same process in the following loop. Whether the body posture can keep a good streamline when swimming is directly related to the technical play and swimming speed. Poor body posture in the water can increase the resistance of swimming, cause obstacles to improving performance, and also affect the technique of brush stroke. Based on the analysis of the key factors affecting the streamlined body posture, this paper introduces several effective methods for improving the streamlined body posture in the water, to help beginner’s better master the streamlined body posture.Especially for professional athletes, sports injury not only affects normal training but even causes irreversible consequences to body function. In 2014, Document No. 46 of the State Council clearly proposed to “vigorously develop sports medicine and rehabilitation medicine” [7]. In 2016, MTT International Symposium on Medical Exercise Rehabilitation further clarified the current business model of “combination of physical medicine and medicine” + “Combination of Internet online and offline” in the field of exercise rehabilitation [8]. However, China’s development in this field is still in the primary stage, and the market gap is large. At present, medical professionals and engineers are paying increasing attention to the rehabilitation treatment and prevention of sports injuries. Engineers focus primarily on the collection, transmission, and analysis of health-related data, while healthcare professionals focus on providing better health and medical services based on the collection and analysis results of existing equipment.In recent years, many foreign researchers wear inertial sensors to monitor swimmers’ movement information. In 2017, the authors of [9] defined a kind of low-order and high-order behavior parameters for analyzing motion control in swimming but did not design the corresponding swimming measurement system. Low-order parameters mainly refer to position, speed, and acceleration, while high-order parameters mainly refer to coordination between motion and movement. In 2012, the scholar of [10] adopted a single inertial measurement system to monitor freestyle swimming to improve the speed of swimmers. However, only the velocity information of the forward direction is extracted, so the monitoring information is relatively simple. In 2016, authors of [11–13] installed four inertial measurement sensors on the wrist and ankle of the human body, which can store monitoring data for 4 minutes continuously, and then upload it to the computer through a USB interface. The operation is relatively complicated. In 2016, authors of [14] designed a motion-monitoring wristband with a built-in acceleration sensor, which could only measure the motion rule of a single arm and low-order parameters such as swimming speed and distance but could not fully reflect the motion state of the human body. Although the previous researchers have demonstrated the usefulness of imU in capturing swimming data, most of them have focused on low-order characteristics such as swimming distance and speed and have not addressed how to extract information about human physical conditions [15–18]. We suggested a swimming-attitude tracking error-correction approach based on the Mahony algorithm in this research by undertaking numerous tests, which were inspired by the work of these experts.


## 3. Design and Methodology of Swimming Attitude Tracking Error Correction Based on Mahony Algorithm

### 3.1. Overall Design of the Proposed Scheme for Attitude Estimation

The correction algorithm for attitude estimation by magnetometer mainly includes four parts: attitude strapdown solution by micro-gyro, attitude progressive estimation by accelerometer and magnetometer, and design of Kalman filter, and attitude calculation. The micro-gyroscope gathers data and delivers it to the Kalman filter for attitude angle computation; similarly, data from the micro accelerometer and micro magnetometer are sent to the Kalman filter after Quaternion conversion and the appropriate attitude angle is determined. Figure1 depicts a schematic representation of attitude angle computation, with descriptions of each phase after this figure.Figure 1
Schematic diagram of attitude estimation.


#### 3.1.1. Micro Gyroscope

MEMS gyroscopes, also known as MEMS angular rate sensors, are employed wherever rate of turn (°/s) monitoring without a fixed reference point is needed. This distinguishes the gyros from other rotation-measuring devices, such as tachometers. Silicon sensing’s MEMS gyros all employ the same innovative VSG resonating loop technique to measure rotation rate via the Coriolis effect. Silicon-sensing developed the first MEMS VSG in the late 1990s, and since then, over 20,000,000 MEMS gyros have already been supplied to dozens of satisfied clients. To the best of my knowledge, practically all of these gyros are still operational after 20 years of constant duty, demonstrating VSG’s dependability.


#### 3.1.2. Strapdown Decoding

Strapdown, also known as inertial navigation, is the method of estimating location by velocity integrating and velocity by total gravity integrating. Total acceleration is determined as the combination of gravitational acceleration and no gravitational force acceleration. An inertial navigation system (INS) is made up of a navigation computer that performs the integration function and an attitude reference that defines the angular orientation of the accelerometer triad as a component of the velocity calculation. Nowadays, the orientation reference is given by a system implementation function in the INS computer, which uses information from a three-axis set of gyroscope angular rate sensors. To preserve precise alignments between every gyroscope, the angular rate sensor, as well as accelerometer triads, is attached to a shared rigid frame within the INS chassis. Due to the hard connection of the inertial sensors inside the chassis, and hence to the vehicle in which the INS is placed, such an installation has been referred to as a strapdown INS.


#### 3.1.3. Micro-Accelerometer

Micro-accelerometers are microscopic inertial weights that are elastically hung on inertial frames that are rigidly linked to the object on which the acceleration is to be recorded. The inertial mass travels in proportion to the magnitude of the moving body’s acceleration.


#### 3.1.4. Micro Magnetometer

A magnetometer is an instrument used to measure the magnetic field. Magnetometers of various sorts measure the direction, intensity, or changes that occur in a magnetic field at a specific area. A compass is one such instrument that measures the orientation of an Earth’s magnetic field, in this instance, the magnetic field of the Earth. Some magnetometers determine a magnetic substance’s magnetic dipole by measuring the influence of the ferromagnetic material on the generated current in a coil.


#### 3.1.5. Quaternion Conversion

Quaternions are a mathematical notation that may be used to denote spatial orientations and rotations of items in three-dimensional space. They specifically encapsulate data about an axis-angle revolution about any axis.


#### 3.1.6. Kalman Filter

It is recognized as among the most essential and widely used estimate methods. The Kalman Filter generates hidden variable estimations based on faulty and ambiguous data. In addition, the Kalman Filter predicts the future state of the system based on prior estimations.


#### 3.1.7. Attitude Angle

The angle formed by the longitudinal axis and the horizon is known as the attitude angle. The attitude indication or fake horizon displays this angle.


### 3.2. Methodology

This section consists of our proposed methodology for the swimming attitude tracking error correction. Here we first analyze the swimming posture characteristics after that we initial the alignment principle of MEMS-SINS and reduce mathematical error.


### 3.3. Analysis of Swimming Posture Characteristics

Swimming is a sport with larger movement range, faster speed, and higher requirements of body and limb coordination. On the other hand, swimming posture is the position adopted by the swimmer’s body during muscle activation or as a consequence of a synchronized motion created by a team of muscles functioning together to ensure stability. There are three major issues with swimmers’ bad posture: damage risk, stroke mechanics, and strength of body.


#### 3.3.1. Harm Risk

When a swimmer stands, sits, or swims with bad posture, certain structures are put under extra strain. Greater stress on a particular location increases the burden on the muscle and the danger of injury. Several swimmers have excellent posture and are hurt; numerous swimmers have poor posture and are not harmed. Pain is caused by a variety of circumstances, but the majority of swimmers’ injuries are caused by overworked tissues. Overload takes a long time to build up, and the minor added stress of bad posture builds up over time.


#### 3.3.2. Mechanism of Stroke

As we all know, posture is extremely important in swimming mechanics and effectiveness. A swimmer’s streamlining will be affected if they have bad posture. All swimmers understand how important it is to be streamlined. Swimmers who are not streamlined produce greater drag in the water and must fight harder against the current to go forward. Poor posture is especially detrimental to the grab in freestyle and fly, as well as the pull-in breaststroke. However, this position can interfere with other components of the stroke, most importantly the capacity to bend the shoulder. If swimmers cannot maintain their head in line with their spine, every breath creates more drag as it propels the body through into the water.


#### 3.3.3. Strength of Body

Poor posture also reduces strength. Every muscle has a preferred resting posture. It contracts the most in this orientation. On both ends of each joint, muscles surround it. When one side of a joint has tight muscles, the muscles on the opposite side will lengthen. Each of these muscles is pushed out of its ideal position and grows weaker as a result. The severity of these flaws may be small, but they mount up over time. Also, while posture should never be the primary focus of any strength program, it should not be overlooked when considering the rates of dryland injury. For competitive swimmers, it is very important to provide the most comprehensive and accurate feedback quantitative analysis, and the design of swimming measuring equipment needs to be combined with the movement characteristics of the swimming process. The characteristics of good swimming are shown in Figure2.Figure 2
Characteristics of good swimming.From Figure 2, it is concluded that the swimming process is extremely complex and has high requirements on the volume, quality, and use experience of attitude measurement equipment. Therefore, MEMS’s inertial device combination is adopted as attitude measurement equipment, and the fast initial alignment algorithm is studied. Since inertial technology measures attitude information at fixed points, it is very important to select a suitable measurement point for feedback on swimming movement. The research shows that the hip can reflect the key information of the athlete’s torsional amplitude and torsional frequency during the swimming process, so it is appropriate to use it as the measurement point of inertial posture to reflect the athlete’s overall posture movement [19].


### 3.4. Initial Alignment Principle of MEMS-SINS

Swimming motion attitude measurement needs inertial equipment with small volume and lightweight, so it is necessary to study the initial attitude alignment algorithm for strapdown inertial navigation equipment composed of MEMS gyroscope. Before the strapdown inertial navigation system (SINS) enters the navigation state, it is necessary to determine the initial attitude matrixCnb from the carrier coordinate system to the navigation coordinate system. It can be calculated from equation (1).(1)Cnb=C1nC21Cn2=cosψsinψ0−sinψcosψ00011000cosθ−sinθ0sinθcosθcosγ0sinγ010−sinγ0cosγ.In equation (1), ψ is yaw angle, θ is pitch angle, and γ is roll angle, and the direction cosine matrix is an orthogonal matrix.The initial alignment of the stationary base is punctual, and the relation between its output and the specific force in the northeast celestial navigation coordinate system is calculated from equation (2).(2)fb=Cnbgn.In equation (2), g is the local horizontal acceleration of gravity. It can be obtained from equations (1) and (2).(3)θ=atcsinfyg,γ=atcsin−fyg.Two horizontal attitude anglesθ and γ were calculated, but the yaw angle could not be obtained, so magnetometer was introduced to provide reference information of yaw angle.The relationship between the navigation coordinate system and the carrier coordinate system is determined by using the magnetic field intensity of the carrier coordinate system of the calibrated triaxial magnetometer. This relationship can be calculated as per the equation (4):(4)Mb=CnbMn=Cnbmxnmynmzn=CnbHsinαHcosα−Htanβ.In equation (4), Mb is the three-dimensional magnetic field intensity in the carrier coordinate system, Mn is the three-dimensional magnetic field intensity in the navigation coordinate system, and H0 is the horizontal intensity of the local geomagnetic field.Using the horizontal attitude angle determined in equation (3), the attitude matrix Ch from the carrier coordinate system to the horizontal coordinate system can be calculated utilizing equation (5).(5)Cnb=1000cosθ−sinθ0sinθcosθcosγ0sinγ010−sinγ0cosγ.Due to the above,Mb can be calculated using equation (6).(6)Mb=CnbMn,(7)Mb=mxhmyhmzh=CnbH0sinαH0cosα−H0tanβ.So we can compute the matrixCnb using equation (7):(8)Cnb=cosψsinψ0−sinψcosψ0001.So we can determine the yaw angle a.In conclusion, according to equations (3) and (7), the attitude angle can be calculated from the acceleration information and magnetic field intensity information, and the calculation of the initial attitude angle of swimming motion attitude measurement using MEMS equipment can be realized.The heading angle, pitch angle, and roll angle determined by the inertial navigation attitude matrix are, respectively,(9)φ=φt+δθ=θt+δγ=γt+δ.Taking heading angle as an example, the relationship between platform angle error and attitude angle error is deduced using equation (9):(10)tanφ=tanφt+δ=tanφt+tanδ1−tanφttanδ.Ignore small quantities above second order.(11)tanφ=tanφt+1+tan2φtδ.Equation (11) can be obtained according to equation (10).(12)tanφ=T12+T22ϕ−T32ϕT22−T12ϕ+T32ϕ.The denominator of equation (11) is expanded according to Taylor, and the first term of attitude angle error is obtained: (13)tanφ=T12+T22ϕ−T32ϕT22−T12ϕ+T32ϕ=T12T22+1+T12T22φ−T32T22ϕ−T32T22ϕ.Equations (12) and (13) are simplified on behalf of equation (11): (14)δ=T12T32T22+T12−T22T32T12+T12ϕ+ϕ.Similarly, the transformation relation of pitch angle and roll angle can be obtained:(15)δ=T221−T32ϕ−T121−T32ϕ,(16)δ=T21T33−T23T31T31+T33ϕ+T13T31−T11T33T31+T33ϕ.The relations among heading angle, pitch angle, roll angle, and platform angle error in equations (15) and (16) are obtained by substituting them into the measurement matrix:(17)Z=φ1−φGnθ1−θGnγ1−γGnV1−VGnP1−PGnAmong them(18)L=T12T32T12+T22−T32T22T12+T22,(19)M=−T221−T32−T121−T32,(20)δ=T21T33−T23T31T31+T33ϕ+T13T31−T11T33T31+T33ϕ.Through equation (19), the physical significance of state quantity and quantity measurement in attitude measurement equation is unified. Thus, the mathematical model error is reduced.


## 3.1. Overall Design of the Proposed Scheme for Attitude Estimation

The correction algorithm for attitude estimation by magnetometer mainly includes four parts: attitude strapdown solution by micro-gyro, attitude progressive estimation by accelerometer and magnetometer, and design of Kalman filter, and attitude calculation. The micro-gyroscope gathers data and delivers it to the Kalman filter for attitude angle computation; similarly, data from the micro accelerometer and micro magnetometer are sent to the Kalman filter after Quaternion conversion and the appropriate attitude angle is determined. Figure1 depicts a schematic representation of attitude angle computation, with descriptions of each phase after this figure.Figure 1
Schematic diagram of attitude estimation.


### 3.1.1. Micro Gyroscope

MEMS gyroscopes, also known as MEMS angular rate sensors, are employed wherever rate of turn (°/s) monitoring without a fixed reference point is needed. This distinguishes the gyros from other rotation-measuring devices, such as tachometers. Silicon sensing’s MEMS gyros all employ the same innovative VSG resonating loop technique to measure rotation rate via the Coriolis effect. Silicon-sensing developed the first MEMS VSG in the late 1990s, and since then, over 20,000,000 MEMS gyros have already been supplied to dozens of satisfied clients. To the best of my knowledge, practically all of these gyros are still operational after 20 years of constant duty, demonstrating VSG’s dependability.


### 3.1.2. Strapdown Decoding

Strapdown, also known as inertial navigation, is the method of estimating location by velocity integrating and velocity by total gravity integrating. Total acceleration is determined as the combination of gravitational acceleration and no gravitational force acceleration. An inertial navigation system (INS) is made up of a navigation computer that performs the integration function and an attitude reference that defines the angular orientation of the accelerometer triad as a component of the velocity calculation. Nowadays, the orientation reference is given by a system implementation function in the INS computer, which uses information from a three-axis set of gyroscope angular rate sensors. To preserve precise alignments between every gyroscope, the angular rate sensor, as well as accelerometer triads, is attached to a shared rigid frame within the INS chassis. Due to the hard connection of the inertial sensors inside the chassis, and hence to the vehicle in which the INS is placed, such an installation has been referred to as a strapdown INS.


### 3.1.3. Micro-Accelerometer

Micro-accelerometers are microscopic inertial weights that are elastically hung on inertial frames that are rigidly linked to the object on which the acceleration is to be recorded. The inertial mass travels in proportion to the magnitude of the moving body’s acceleration.


### 3.1.4. Micro Magnetometer

A magnetometer is an instrument used to measure the magnetic field. Magnetometers of various sorts measure the direction, intensity, or changes that occur in a magnetic field at a specific area. A compass is one such instrument that measures the orientation of an Earth’s magnetic field, in this instance, the magnetic field of the Earth. Some magnetometers determine a magnetic substance’s magnetic dipole by measuring the influence of the ferromagnetic material on the generated current in a coil.


### 3.1.5. Quaternion Conversion

Quaternions are a mathematical notation that may be used to denote spatial orientations and rotations of items in three-dimensional space. They specifically encapsulate data about an axis-angle revolution about any axis.


### 3.1.6. Kalman Filter

It is recognized as among the most essential and widely used estimate methods. The Kalman Filter generates hidden variable estimations based on faulty and ambiguous data. In addition, the Kalman Filter predicts the future state of the system based on prior estimations.


### 3.1.7. Attitude Angle

The angle formed by the longitudinal axis and the horizon is known as the attitude angle. The attitude indication or fake horizon displays this angle.


## 3.1.1. Micro Gyroscope

MEMS gyroscopes, also known as MEMS angular rate sensors, are employed wherever rate of turn (°/s) monitoring without a fixed reference point is needed. This distinguishes the gyros from other rotation-measuring devices, such as tachometers. Silicon sensing’s MEMS gyros all employ the same innovative VSG resonating loop technique to measure rotation rate via the Coriolis effect. Silicon-sensing developed the first MEMS VSG in the late 1990s, and since then, over 20,000,000 MEMS gyros have already been supplied to dozens of satisfied clients. To the best of my knowledge, practically all of these gyros are still operational after 20 years of constant duty, demonstrating VSG’s dependability.


## 3.1.2. Strapdown Decoding

Strapdown, also known as inertial navigation, is the method of estimating location by velocity integrating and velocity by total gravity integrating. Total acceleration is determined as the combination of gravitational acceleration and no gravitational force acceleration. An inertial navigation system (INS) is made up of a navigation computer that performs the integration function and an attitude reference that defines the angular orientation of the accelerometer triad as a component of the velocity calculation. Nowadays, the orientation reference is given by a system implementation function in the INS computer, which uses information from a three-axis set of gyroscope angular rate sensors. To preserve precise alignments between every gyroscope, the angular rate sensor, as well as accelerometer triads, is attached to a shared rigid frame within the INS chassis. Due to the hard connection of the inertial sensors inside the chassis, and hence to the vehicle in which the INS is placed, such an installation has been referred to as a strapdown INS.


## 3.1.3. Micro-Accelerometer

Micro-accelerometers are microscopic inertial weights that are elastically hung on inertial frames that are rigidly linked to the object on which the acceleration is to be recorded. The inertial mass travels in proportion to the magnitude of the moving body’s acceleration.


## 3.1.4. Micro Magnetometer

A magnetometer is an instrument used to measure the magnetic field. Magnetometers of various sorts measure the direction, intensity, or changes that occur in a magnetic field at a specific area. A compass is one such instrument that measures the orientation of an Earth’s magnetic field, in this instance, the magnetic field of the Earth. Some magnetometers determine a magnetic substance’s magnetic dipole by measuring the influence of the ferromagnetic material on the generated current in a coil.


## 3.1.5. Quaternion Conversion

Quaternions are a mathematical notation that may be used to denote spatial orientations and rotations of items in three-dimensional space. They specifically encapsulate data about an axis-angle revolution about any axis.


## 3.1.6. Kalman Filter

It is recognized as among the most essential and widely used estimate methods. The Kalman Filter generates hidden variable estimations based on faulty and ambiguous data. In addition, the Kalman Filter predicts the future state of the system based on prior estimations.


## 3.1.7. Attitude Angle

The angle formed by the longitudinal axis and the horizon is known as the attitude angle. The attitude indication or fake horizon displays this angle.


## 3.2. Methodology

This section consists of our proposed methodology for the swimming attitude tracking error correction. Here we first analyze the swimming posture characteristics after that we initial the alignment principle of MEMS-SINS and reduce mathematical error.


## 3.3. Analysis of Swimming Posture Characteristics

Swimming is a sport with larger movement range, faster speed, and higher requirements of body and limb coordination. On the other hand, swimming posture is the position adopted by the swimmer’s body during muscle activation or as a consequence of a synchronized motion created by a team of muscles functioning together to ensure stability. There are three major issues with swimmers’ bad posture: damage risk, stroke mechanics, and strength of body.


### 3.3.1. Harm Risk

When a swimmer stands, sits, or swims with bad posture, certain structures are put under extra strain. Greater stress on a particular location increases the burden on the muscle and the danger of injury. Several swimmers have excellent posture and are hurt; numerous swimmers have poor posture and are not harmed. Pain is caused by a variety of circumstances, but the majority of swimmers’ injuries are caused by overworked tissues. Overload takes a long time to build up, and the minor added stress of bad posture builds up over time.


### 3.3.2. Mechanism of Stroke

As we all know, posture is extremely important in swimming mechanics and effectiveness. A swimmer’s streamlining will be affected if they have bad posture. All swimmers understand how important it is to be streamlined. Swimmers who are not streamlined produce greater drag in the water and must fight harder against the current to go forward. Poor posture is especially detrimental to the grab in freestyle and fly, as well as the pull-in breaststroke. However, this position can interfere with other components of the stroke, most importantly the capacity to bend the shoulder. If swimmers cannot maintain their head in line with their spine, every breath creates more drag as it propels the body through into the water.


### 3.3.3. Strength of Body

Poor posture also reduces strength. Every muscle has a preferred resting posture. It contracts the most in this orientation. On both ends of each joint, muscles surround it. When one side of a joint has tight muscles, the muscles on the opposite side will lengthen. Each of these muscles is pushed out of its ideal position and grows weaker as a result. The severity of these flaws may be small, but they mount up over time. Also, while posture should never be the primary focus of any strength program, it should not be overlooked when considering the rates of dryland injury. For competitive swimmers, it is very important to provide the most comprehensive and accurate feedback quantitative analysis, and the design of swimming measuring equipment needs to be combined with the movement characteristics of the swimming process. The characteristics of good swimming are shown in Figure2.Figure 2
Characteristics of good swimming.From Figure 2, it is concluded that the swimming process is extremely complex and has high requirements on the volume, quality, and use experience of attitude measurement equipment. Therefore, MEMS’s inertial device combination is adopted as attitude measurement equipment, and the fast initial alignment algorithm is studied. Since inertial technology measures attitude information at fixed points, it is very important to select a suitable measurement point for feedback on swimming movement. The research shows that the hip can reflect the key information of the athlete’s torsional amplitude and torsional frequency during the swimming process, so it is appropriate to use it as the measurement point of inertial posture to reflect the athlete’s overall posture movement [19].


## 3.3.1. Harm Risk

When a swimmer stands, sits, or swims with bad posture, certain structures are put under extra strain. Greater stress on a particular location increases the burden on the muscle and the danger of injury. Several swimmers have excellent posture and are hurt; numerous swimmers have poor posture and are not harmed. Pain is caused by a variety of circumstances, but the majority of swimmers’ injuries are caused by overworked tissues. Overload takes a long time to build up, and the minor added stress of bad posture builds up over time.


## 3.3.2. Mechanism of Stroke

As we all know, posture is extremely important in swimming mechanics and effectiveness. A swimmer’s streamlining will be affected if they have bad posture. All swimmers understand how important it is to be streamlined. Swimmers who are not streamlined produce greater drag in the water and must fight harder against the current to go forward. Poor posture is especially detrimental to the grab in freestyle and fly, as well as the pull-in breaststroke. However, this position can interfere with other components of the stroke, most importantly the capacity to bend the shoulder. If swimmers cannot maintain their head in line with their spine, every breath creates more drag as it propels the body through into the water.


## 3.3.3. Strength of Body

Poor posture also reduces strength. Every muscle has a preferred resting posture. It contracts the most in this orientation. On both ends of each joint, muscles surround it. When one side of a joint has tight muscles, the muscles on the opposite side will lengthen. Each of these muscles is pushed out of its ideal position and grows weaker as a result. The severity of these flaws may be small, but they mount up over time. Also, while posture should never be the primary focus of any strength program, it should not be overlooked when considering the rates of dryland injury. For competitive swimmers, it is very important to provide the most comprehensive and accurate feedback quantitative analysis, and the design of swimming measuring equipment needs to be combined with the movement characteristics of the swimming process. The characteristics of good swimming are shown in Figure2.Figure 2
Characteristics of good swimming.From Figure 2, it is concluded that the swimming process is extremely complex and has high requirements on the volume, quality, and use experience of attitude measurement equipment. Therefore, MEMS’s inertial device combination is adopted as attitude measurement equipment, and the fast initial alignment algorithm is studied. Since inertial technology measures attitude information at fixed points, it is very important to select a suitable measurement point for feedback on swimming movement. The research shows that the hip can reflect the key information of the athlete’s torsional amplitude and torsional frequency during the swimming process, so it is appropriate to use it as the measurement point of inertial posture to reflect the athlete’s overall posture movement [19].


## 3.4. Initial Alignment Principle of MEMS-SINS

Swimming motion attitude measurement needs inertial equipment with small volume and lightweight, so it is necessary to study the initial attitude alignment algorithm for strapdown inertial navigation equipment composed of MEMS gyroscope. Before the strapdown inertial navigation system (SINS) enters the navigation state, it is necessary to determine the initial attitude matrixCnb from the carrier coordinate system to the navigation coordinate system. It can be calculated from equation (1).(1)Cnb=C1nC21Cn2=cosψsinψ0−sinψcosψ00011000cosθ−sinθ0sinθcosθcosγ0sinγ010−sinγ0cosγ.In equation (1), ψ is yaw angle, θ is pitch angle, and γ is roll angle, and the direction cosine matrix is an orthogonal matrix.The initial alignment of the stationary base is punctual, and the relation between its output and the specific force in the northeast celestial navigation coordinate system is calculated from equation (2).(2)fb=Cnbgn.In equation (2), g is the local horizontal acceleration of gravity. It can be obtained from equations (1) and (2).(3)θ=atcsinfyg,γ=atcsin−fyg.Two horizontal attitude anglesθ and γ were calculated, but the yaw angle could not be obtained, so magnetometer was introduced to provide reference information of yaw angle.The relationship between the navigation coordinate system and the carrier coordinate system is determined by using the magnetic field intensity of the carrier coordinate system of the calibrated triaxial magnetometer. This relationship can be calculated as per the equation (4):(4)Mb=CnbMn=Cnbmxnmynmzn=CnbHsinαHcosα−Htanβ.In equation (4), Mb is the three-dimensional magnetic field intensity in the carrier coordinate system, Mn is the three-dimensional magnetic field intensity in the navigation coordinate system, and H0 is the horizontal intensity of the local geomagnetic field.Using the horizontal attitude angle determined in equation (3), the attitude matrix Ch from the carrier coordinate system to the horizontal coordinate system can be calculated utilizing equation (5).(5)Cnb=1000cosθ−sinθ0sinθcosθcosγ0sinγ010−sinγ0cosγ.Due to the above,Mb can be calculated using equation (6).(6)Mb=CnbMn,(7)Mb=mxhmyhmzh=CnbH0sinαH0cosα−H0tanβ.So we can compute the matrixCnb using equation (7):(8)Cnb=cosψsinψ0−sinψcosψ0001.So we can determine the yaw angle a.In conclusion, according to equations (3) and (7), the attitude angle can be calculated from the acceleration information and magnetic field intensity information, and the calculation of the initial attitude angle of swimming motion attitude measurement using MEMS equipment can be realized.The heading angle, pitch angle, and roll angle determined by the inertial navigation attitude matrix are, respectively,(9)φ=φt+δθ=θt+δγ=γt+δ.Taking heading angle as an example, the relationship between platform angle error and attitude angle error is deduced using equation (9):(10)tanφ=tanφt+δ=tanφt+tanδ1−tanφttanδ.Ignore small quantities above second order.(11)tanφ=tanφt+1+tan2φtδ.Equation (11) can be obtained according to equation (10).(12)tanφ=T12+T22ϕ−T32ϕT22−T12ϕ+T32ϕ.The denominator of equation (11) is expanded according to Taylor, and the first term of attitude angle error is obtained: (13)tanφ=T12+T22ϕ−T32ϕT22−T12ϕ+T32ϕ=T12T22+1+T12T22φ−T32T22ϕ−T32T22ϕ.Equations (12) and (13) are simplified on behalf of equation (11): (14)δ=T12T32T22+T12−T22T32T12+T12ϕ+ϕ.Similarly, the transformation relation of pitch angle and roll angle can be obtained:(15)δ=T221−T32ϕ−T121−T32ϕ,(16)δ=T21T33−T23T31T31+T33ϕ+T13T31−T11T33T31+T33ϕ.The relations among heading angle, pitch angle, roll angle, and platform angle error in equations (15) and (16) are obtained by substituting them into the measurement matrix:(17)Z=φ1−φGnθ1−θGnγ1−γGnV1−VGnP1−PGnAmong them(18)L=T12T32T12+T22−T32T22T12+T22,(19)M=−T221−T32−T121−T32,(20)δ=T21T33−T23T31T31+T33ϕ+T13T31−T11T33T31+T33ϕ.Through equation (19), the physical significance of state quantity and quantity measurement in attitude measurement equation is unified. Thus, the mathematical model error is reduced.


## 4. Experimental Results and Analysis

Athletes from the national swimming team were tested at the Zhejiang Aquatic Sports Management Center to validate the fast initial alignment algorithm’s practical application performance. It has anX-axis to the right, a Y-axis to the front, and a Z-axis to the air. The y-axis of the sensor is aligned with the human spine, and after strict adjustment, the installation error here only causes a small angle of fixed deviation impact on the roll angle, because of the limitation of the strap. This paper focuses on the alignment method and alignment error, no discussion on this place. The actual test requires the professional athlete to perform preparation work following the actual moving process, which includes the static process of platform preparation diving before jumping.The attitude angle error can be controlled within 10 angle minutes by the measurement matrix correction combination, and the attitude angle error can be controlled within 5 angle minutes by the observation vector pretreatment combination. Compared with the attitude angle combination method, the accuracy is improved obviously. Table1 shows the statistical results of root mean square error under different algorithms.Table 1
Error statistical characteristics.
Attitude angle combination methodHeading angle (angle minutes)Angle of pitch (angle minutes)Roll angle (angle minutes)Attitude direct combination error10.01479.749910.1713Measurement matrix corrects combination error2.04891.99361.9902Vector preprocessing combination error was observed1.19251.35431.3662It can be seen from the root mean square error statistical table that both improved algorithms improve the accuracy of attitude measurement. The precision of the observation vector preprocessing combination is better than that of the measurement matrix modification combination. It shows that the measurement information is processed before filtering, so the error in formula derivation can be avoided from being introduced into the filtering measurement equation. In addition, the model can be more accurate and the measurement accuracy can be improved.Figure3 depicts the alignment results during the alignment window period. Because it is impossible to predict when athletes will dive, the algorithm is set to a 3 s alignment time consistent with the experimental test. The algorithm on the measured data enters the convergence link at 0.2 s. Since the athletes themselves are not in an absolute static state, there are some fluctuations in the horizontal attitude angle, so it is impossible to measure whether the convergence is complete, but it fluctuates up and down around the fixed value after 0.3 s. The yaw angle is nearly constant because the magnetometer’s accuracy is only a degree. It can also be seen that the athletes are extremely good at staying still.Figure 3
Alignment result of measured data algorithm, (a)X-axis pitching angle, (b) Y-axis roll angle, (c) Z-axis yaw angle.
(a)(b)(c)Figure4 is the attitude measurement result of the initial alignment result of Figure 3 as the initial value. To facilitate the understanding of athletes and coaches, the yaw angle is set to 0°, and the angle range is changed from −180° ∼ 180° to 0° ∼ 360°. At 26.85 s, the swimmer swims from the starting point to the endpoint. From 26.85 s to 28.15 s, the swimmer swims back to the starting point. It can be seen that the time of athletes in each exercise stage is consistent with the time calculated based on the original data above, which perfectly restores the whole exercise process.Figure 4
Actual attitude measurement results: (a) navigation calculation of pitch angle, (b) navigation calculation of roll angle, (c) navigation calculation of yaw angle.
(a)(b)(c)Figure5 shows the process of testing against a horizontal baseline. Since the test was conducted according to the azimuth of the northeast day, the true value of the horizontal angle alignment result was 0°. If the calculated initial value was also 0°, the convergence process could not be displayed. Therefore, the initial value was set to a large deviation value to show the convergence process. It can be seen that the algorithm enters the convergence link at 0.2s, that is, a 5% error band. At 0.4s, the convergence is complete, and the rapidity is achieved. Using 3s data as the alignment results, it is found that the horizontal angle alignment results are –0.042° and 0.077°, and the accuracy is angle grade. The yaw angle accuracy is limited to degrees by magnetometer and magnetic field modeling accuracy, but it also meets the requirements of swimming.Figure 5
Alignment results on horizontal datum: (a)X-axis pitching angle, (b) Y-axis roll angle, (c) Z-axis yaw angle.
(a)(b)(c)According to the test results, the corrected nonspindle, sensor angle-measuring data are closer to the true value, and the corrected accuracy is better than the method currently used in the shooting range, as shown in Table2. In this paper, the actual point coordinates of nonspindle sensors are calculated, and then the angular coordinates are converted, so the inconvenience and error introduced by the calculation of nonparallelism in shooting range are avoided. Due to the atmospheric refraction error in the pitching direction, the residual error is relatively large compared with the GPS truth-value.Table 2
Statistics of tracking error correction results.
Measurement error comparisonThe angle error is not correctedNow use the correction methodCorrection method of this paperMean of azimuth error (arc seconds)30.239.464.76Average pitching error (arc seconds)49.5629.217The positioning accuracy of the new modified method proposed in this paper is also higher than that of the current method used in the shooting range after the solution of the rendezvous positioning of an optical survey, as shown in Table3. Experimental data show that the corrected method can meet the need for high-precision processing of theodolite in shooting range, and the angle error is less than 5″ and the positioning error is less than 4 m. At the same time, it is shown that if the nonspindle sensor angle measurement data is not corrected, it will have a very large error effect on the target positioning result.Table 3
Statistics of target positioning error results.
Comparison of positioning errorThe angle error is not correctedNow use the correction methodCorrection method of this paperMean value of positioning error inX direction (m)12.357.123.17Mean value of positioning error inY direction (m)27.2813.193.27Mean value of positioning error inZ direction (m)5.054.052.99Figure6 depicts a comparison of error statistical characteristics for heading angle, pitch angle, and roll angle. We used three methods for attitude angle combination in this case: attitude direct combination error, measurement matrix correction, and vector preprocessing combination error. When compared with the heading angle and angle of pitch, the roll angle of attitude combination is the highest, that is, 10.1713. Similarly, the heading angle of the measurement matrix corrects combination error is the highest, that is, 2.0489. Furthermore, we discovered that the vector preprocessing combination error has the greatest roll angle.Figure 6
Comparison of error statistical characteristics.Figure7 shows the comparison among statistics of tracking error correction results in three methods in terms of the mean of azimuth error and average pitching error. From this figure, it is clear that our proposed method has the lowest mean of azimuth error as compared to the rest of the methods. Similarly, the average pitching error of our suggested system is the lowest as compared to the rest of the two methods. This proved the efficiency and effectiveness of our proposed method.Figure 7
comparison among statistics of tracking error correction results in three methods.Figure8 shows the comparison of statistics of target positioning error results among three methods. According to this figure, the correction method of this paper has the lowest mean value of positioning error in the X direction (m). Apart from this, the mean value of positioning error in the Y direction (m) of the rest of the two methods are high as compared to the proposed method. Similarly, our proposed correction method has the lowest mean value of positioning error in the Z direction (m) which is 2.99.Figure 8
comparison of statistics of target positioning error results among three methods.It is concluded that the swimming attitude tracking error correction method of this paper, based on the Mahony algorithm, is superior to the other methods. As a result, our scheme for detecting swimming attitudes is efficient and capable of detecting swimming attitude errors accurately. As a result, the Mahony algorithm can correctly detect the error of swimming attitude, which may aid swimmers in their swimming.


## 5. Conclusions

This work proposes a rapid alignment approach based on the Mahony algorithm to meet the requirements of quick initial alignment time and high accuracy in inertial attitude measurement in swimming action scenarios. The angular velocity information is used to determine the attitude angle, the acceleration information is used to correct the horizontal attitude angle, and the magnetic field intensity information is used to correct the yaw angle. The complementary filtering method is used to fuse the multisource information, to obtain the initial value of the inertial attitude measurement quickly. The proposed algorithm is verified in laboratory scenarios and actual swimming scenarios. The proposed algorithm can achieve the alignment accuracy of horizontal angle classification and yaw angle classification within 3s, which meets the requirements of swimming posture measurement. This paper describes the development of a wireless swimming posture measurement experimental device that can upload measurement data in real time, at a low cost, and without interfering with the transmission process. The properties of swimming movement data are investigated, and a technique for determining swimming posture and intensity is given, and the duration and amplitude of swimming movement are used to determine human body condition.



---

*Source: 2961428-2022-06-16.xml*