# A graph optimization approach for motion estimation using inertial measurement unit data

- Kiyoshi Irie
^{1}Email authorView ORCID ID profile

**Received: **31 January 2018

**Accepted: **16 May 2018

**Published: **29 May 2018

## Abstract

This study presents a novel approach for processing motion data from a six-degree-of-freedom inertial measurement unit (IMU). Trajectory estimation through double integration of acceleration measurements results in the generation and accumulation of multiple errors. Existing IMU-based measurement methods often use constrained initial and final states to resolve these errors. The constraints on the initial and final states lead to a uniform distribution of the accumulated errors throughout the calculated trajectory so that they cancel each other. We develop a generalized method that can incorporate the constraints from the measurements of intermediate states. The proposed approach is inspired by graph-based simultaneous localization and mapping processes from robotics research. We tested the proposed method with simulated and actual IMU data and found that our method estimates trajectories more accurately than conventional methods with acceptably higher computational costs.

## Keywords

## Introduction

### Background

Measuring athlete motion is an important aspect of sports science. The typical instruments employed for this purpose include high-speed video cameras and infrared motion capture cameras. However, these instruments are expensive and require time and effort for installation.

Recently, small and inexpensive inertial measurement units (IMUs) have become available, making sports motion measurements accessible to a wide range of people. For example, measurement devices that can be attached to a golf club [1, 2] or a tennis racket [3] have been developed.

Considering these applications, this study seeks to improve the data-processing algorithm for extracting trajectories from IMU data. The IMU employed herein is assumed to comprise a three-axis accelerometer and a three-axis gyroscope. We aim to estimate a time series of the attitude, velocity, and position values with a time series of acceleration and angular velocity measurements.

### Main issues to be addressed

The integration of IMU measurements is the simplest way to extract a trajectory from IMU data. Theoretically, attitude can be calculated by integrating the angular velocity, velocity can be calculated by integrating the acceleration, and position can be calculated by the double integration of the acceleration. However, position estimation by simple double integration amplifies the error [4]. Even a small error in the integration of the acceleration can lead to a bias drift in the velocity values. Additionally, the integration of biased velocity causes rapid generation of the positional errors. In addition, if the measurement is performed for a long period, the attitude and velocity estimations are affected by the bias drift in the angular velocity and acceleration values. Thus, it is necessary to correct the accumulated errors.

### Related work

Human gait analysis is a well-studied topic in IMU-based motion estimation. Several methods that can precisely track human gait have been developed [5, 6]. Error correction methods for gait data rely on the assumption that the foot velocity is zero during the stance phase, which is the period during which the foot is in contact with the ground. The errors accumulated in the velocity data can be eliminated using this assumption [6, 7].

A method to correct motion errors without such zero-velocity assumptions needs to be developed because the assumptions are not always applicable to various sports motions. Sagawa et al. developed a method for measuring the pitching motion used in baseball [8]. They constrained the target motion with a known initial state and a known final state. The accumulated errors are corrected with regard to these constraints.

However, this method is limited as error correction is performed only with one constraint, thereby returning inaccurate trajectories for motions that extend over a long period of time. Therefore, a more powerful error correction method is needed to measure longer sets of motions, such as a rally in a tennis match.

### Contribution

Herein, we propose a novel error correction method that can incorporate multiple constraints. While the relation between the initial and final states is the only constraint employed in the conventional motion estimation method, the proposed method employs generalized constraints that can represent the differences between any two known points in time. The problem is formulated as a least-squares fit of the constraint errors. Steps reducing the computational complexity of the algorithm are also introduced to make computations practical. We quantify the performance of the proposed algorithm with simulated and actual data.

## IMU-based motion estimation: review

### Problem definition

Herein, we employ a rotation vector [9] to represent the 3D attitude \(\varvec{u}\). The definition of the rotation vector representation and the operations performed with it are available in Appendix.

### Naive integration

### Sagawa et al.’s error correction method

The aforementioned integration typically leads to significant error accumulation. We now review a method proposed by Sagawa et al. [8] for correcting such errors.

This method assumes that the initial and final states are known, so the relative difference between the initial and final states is used as a constraint on trajectory reconstruction. The estimated time-series states are corrected by uniformly distributing the accumulated errors along the time sequence so that the error at the final state is canceled out.

- 1.
Initial estimates of attitude are calculated via simple integration. The accumulated errors in these attitude values are corrected using the constraint.

- 2.
Velocities are estimated via integration using the acceleration data and the corrected attitudes. The accumulated errors are again corrected using the constraint.

- 3.
Positions are estimated through the integration of the corrected velocities, and these estimations are corrected with respect to the constraint.

#### Attitude correction

#### Velocity correction

#### Position correction

## Proposed method

The aforementioned error correction employed a single constraint. Thus, we extend the problem to multiple constraints.

We treat the problem as an optimization of a graphical model shown in Fig. 1. The state at each time is modeled as a graph node. The constraints representing a relation between two nodes are modeled as graph edges.

### Objective function

### Constraints

### Error function

*j*relative to node

*i*matches \(\varvec{c}_{ij}\).

### Optimization

*F*in Eq. (8). This method is a gradient descent method that can be used for nonlinear least-squares problems. We initiate the objective variable with an initial estimate, \(\varvec{\hat{x}}\), and iterate over the following three steps until convergence:

- 1.
Linearization: Calculate \(\bar{F}_{\varvec{\hat{x}}}(\varvec{d})\), i.e., the linear approximation of \(F(\varvec{x})\) at \(\varvec{x} = \varvec{\hat{x}}\).

- 2.
Minimization: Determine the update vector \(\varvec{d}\), which minimizes \(\bar{F}_{\varvec{\hat{x}}}(\varvec{d})\).

- 3.
Update: Update the current estimate \(\varvec{\hat{x}}\) using \(\varvec{d}.\)

#### Linearization

#### Minimization

#### Update

### Relevance to graph-based simultaneous localization and mapping

The formulation can be considered as an extension of graph-based simultaneous localization and mapping (SLAM) [12, 13]. Graph-based SLAM produces attitude and position estimates, and the proposed method extends the state vector with velocity as an extra degree of freedom.

### Improving initial estimates

The computational cost of the proposed method is higher than those of the graph-based SLAM methods for the same number of nodes and constraints as \(\varvec{H}\) becomes larger. Therefore, to achieve practical processing time, we employ an initialization technique, which is described below.

We initialize the position estimates for the main problem by integrating the attitudes and velocities returned by sub-problem optimization, thereby reducing the iterations required for convergence in the main optimization problem.

## Results

### Simulation experiments

Experiments with simulated data were conducted as follows. IMUSim [14] was employed to generate 100 different random trajectories with ideal 100-Hz IMU measurements. The duration of each generated trajectory was 3 s.

To improve the realism of the simulation, artificial white noise was added to the ideal measurements. The standard deviations of the noise terms were 0.1 \(\mathrm {m/s^2}\) for acceleration and 0.3°/s for angular velocity. Bias errors of 0.2°/s were also added to the angular velocity data.

First, we tested the processing methods for motions with only one constraint. The estimation accuracy of the proposed method was compared with those of the naive integration and Sagawa et al.’s conventional method [8].

However, the proposed method exhibited significantly smaller attitude errors in comparison with Sagawa et al.’s method (\(p < 0.001\) using the Wilcoxon signed-rank test). The typical attitude estimation results are plotted in Fig. 4, which is generated using the same motion as shown in Fig. 2. This plot shows that both correction methods accurately estimated the final attitude; however, Sagawa et al.’s method exhibited larger errors for intermediate states. This was because the method uniformly distributed the attitude errors along a single rotation axis. Thus, the correction was not expected to necessarily match with the direction of the errors.

Next, we tested the method with multiple constraints. Several observation points were chosen in the simulated data sequences, and the true IMU states at these points were used as additional constraints. The relation between the number of constraints used and the estimation accuracy is summarized in Fig. 5. This figure clearly shows that the estimation accuracy improves as the number of constraints increases.

### Trajectory estimation using real IMU data

We again compared the proposed method and Sagawa et al.’s method [8] in terms of estimation accuracy. Both methods were provided the same constraint, i.e., the initial and final states were identical. Extra constraints were employed in the proposed method, which are defined by the relative positions of three vertices and the assumption that the device stops moving at these vertices. The times when the IMU visited the vertices was calculated based on the acceleration spikes caused by collisions with the table surface.

The processing times for the proposed method and Sagawa et al.’s method were 0.58 and 0.022 s, respectively, on a laptop equipped with a Core i7-7600U processor (mean of 10 trials). Although the proposed method performed slower than Sagawa et al.’s method, the performance of our method does not appear to be a significant problem for the purpose of offline motion analysis.

### Attitude estimation using real IMU data

The attitude estimation accuracy was also evaluated using the MTi-3 IMU. In this evaluation, the IMU was rotated randomly and returned to the initial state, as depicted in Fig. 9. The constraint that the initial and final states are identical was employed. The mean attitude errors for the collected 53 sequences of the IMU data are shown in Fig. 10. As can be seen from the figure, the estimation error of the proposed method was smaller than that of Sagawa et al.’s method (\(p = 0.0376\)).

### Analysis of the effect of data frequency and length

## Conclusions and future work

Using IMU data, the proposed motion estimation method corrects the accumulated errors via least-squares fitting with constraints that are obtained from IMU measurements and from prior knowledge of the motion. This method can incorporate more than one constraint in error correction steps, thereby improving the estimation accuracy. The effect of accuracy improvement was verified by experiments using simulated and real data. When using a single constraint, the proposed method estimated attitude more accurately than the conventional methods. The computation time of the proposed method was practical for motions with duration of several seconds, thanks to the use of an initialization technique. Nevertheless, the computational cost will be large on data with long duration or high frequency. One way to alleviate the problem would be node thinning.

In future work, we plan to apply this method to actual sports data. An analysis of table tennis rallies is in progress.

The proposed method has a limitation: it assumes that the constraints are independent; however, biased measurements can violate this assumption. A mathematical model that considers gyroscope and accelerometer biases can compensate for this limitation.

## Declarations

### Authors’ contributions

The author read and approved the final manuscript.

### Competing interests

The author declares that he has no competing interests.

### Ethics approval and consent to participate

Not applicable.

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Open Access**This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## Authors’ Affiliations

## References

- Seaman A, McPhee J (2012) Comparison of optical and inertial tracking of full golf swings. Procedia Eng 34:461–466View ArticleGoogle Scholar
- TruSwing™. http://www.garmin.com.hk/products/intosports/truswing/
- Smart Tennis Sensor for Tennis Rackets. https://www.sony.com/electronics/smart-devices/sse-tn1w
- Woodman OJ (2007) An introduction to inertial navigation. Technical report, University of CambridgeGoogle Scholar
- Madgwick SOH, Harrison AJL, Vaidyanathan R (2011) Estimation of IMU and MARG orientation using a gradient descent algorithm. In: IEEE international conference on rehabilitation robotics, pp 1–7Google Scholar
- Ojeda L, Borenstein J (2007) Non-GPS navigation for security personnel and first responders. J Navig 60(3):391–407View ArticleGoogle Scholar
- Sagawa K, Ohkubo K (2015) 2D trajectory estimation during free walking using a tiptoe-mounted inertial sensor. J Biomech 48(10):2054–2059View ArticleGoogle Scholar
- Sagawa K, Abo S, Tsukamoto T, Kondo I (2009) Forearm trajectory measurement during pitching motion using an elbow-mounted sensor. J Adv Mech Design Syst Manuf 3(4):299–311View ArticleGoogle Scholar
- Diebel J (2006) Representing attitude: Euler angles, unit quaternions, and rotation vectors. Report, Stanford UniversityGoogle Scholar
- Konolige K, Grisetti G, Kummerle R, Burgard W, Limketkai B, Vincent R (2010) Efficient sparse pose adjustment for 2D mapping. In: Proceedings of the IEEE international conference on intelligent robots & systems (IROS), pp 22–9Google Scholar
- Montemerlo M, Thrun S (2006) Large-scale robotic 3-D mapping of urban structures. In: Ang MH, Khatib O (eds) Experimental robotics IX: the 9th international symposium on experimental robotics, vol 21. Springer, Berlin, pp 141–150View ArticleGoogle Scholar
- Lu F, Milios E (1997) Globally consistent range scan alignment for environment mapping. Auton Robots 4:333–349View ArticleGoogle Scholar
- Grisetti G, Kummerle R, Stachniss C, Burgard W (2010) A tutorial on graph-based slam. IEEE Intell Transp Syst Mag 2(4):31–43View ArticleGoogle Scholar
- Young AD, Ling MJ, Arvind DK (2011) IMUSim: a simulation environment for inertial sensing algorithm design and evaluation. In: Proceedings of international conference on information processing in sensor networks (IPSN), pp 199–210Google Scholar