Spline Function Simulation Data Generation for Walking Motion Using Foot-Mounted Inertial Sensors

This paper investigates the generation of simulation data for motion estimation using inertial sensors. The smoothing algorithm with waypoint-based map matching is proposed using foot-mounted inertial sensors to estimate position and attitude. The simulation data are generated using spline functions, where the estimated position and attitude are used as control points. The attitude is represented using B-spline quaternion and the position is represented by eighth-order algebraic splines. The simulation data can be generated using inertial sensors (accelerometer and gyroscope) without using any additional sensors. Through indoor experiments, two scenarios were examined include 2D walking path (rectangular) and 3D walking path (corridor and stairs) for simulation data generation. The proposed simulation data is used to evaluate the estimation performance with different parameters such as different noise levels and sampling periods.


Introduction
Motion estimation using inertial sensors is one of the most important research topics that is increasingly applied in many application areas such as medical applications, sports, and entertainment [1].Inertial measurement unit (IMU) sensors are commonly used to estimate human motion [2][3][4][5].Inertial sensors can be used alone or combined with other sensors such as cameras [6,7] or magnetic sensors [8].In personal navigation and healthcare applications [9][10][11], foot-mounted inertial sensors without using any additional sensors is a key enabling technology since it does not require any additional infrastructure.If additional sensors (other than inertial sensors) are also used, sensor fusion algorithms [12,13] can be used to obtain more accurate motion estimation.
To evaluate the accuracy of any motion estimation algorithm, it is necessary to compare the estimated value with the true value.The estimated value is usually verified through experiments with both IMU and optical motion tracker [14,15].In [2], the Vicon optical motion capture system is used to evaluate the effectiveness of human pose estimation method and its associated sensor calibration procedure.An optical motion tracking is used as a reference to compare with motion estimation using inertial sensors in [15].
Although the experimental validation gives the ultimate proof, it is not only more convenient but also more important to work with simulation data, which is statistically much more relevant for testing and the development of algorithms.For example, the effect of gyroscope bias on the performance of an algorithm cannot be easily identified in experiments.In this case, simulation using synthesized data is more convenient since gyroscope bias can be changed arbitrarily.
In [16][17][18], IMU simulation data are generated using optical motion capture data for human motion estimation.In [19], IMU simulation data is generated for walking motion by approximating walking trajectory as simple sinusoidal functions.In [20][21][22], IMU simulation data are also generated for flight motion estimation using an artificially generated trajectory.There are many different methods to represent attitude and position simulation data.Among them, the spline function is the most popular approach [23].The B-spline quaternion algorithm provides a general curve construction scheme that extends the spline curves [24].Reference [25] presents an approach for attitude estimation using cumulative B-splines unit quaternion curves.Position can be represented by any spline function [23].Usually, position data are represented using cubic spline functions.The cubic spline function gives a continuous position, velocity, and acceleration.However, the acceleration is not sufficiently smooth.This is a problem for the inertial sensor simulation data generation since the smooth accelerometer data cannot be generated.Thus, we use the eighth-order spline function for position data since it gives position data with smooth acceleration, whose jerk (third derivative) can be controlled in the optimization problem.
In this paper, we use cumulative B-spline for attitude representation and eighth-order algebraic spline for position representation.The eighth-order algebraic spline is a slightly modified version of the spline function from a previous study [26].
The aim of this paper is to obtain simulation data combining inertial sensors (accelerometer and gyroscope) and waypoint data without using any additional sensors.A computationally efficient waypoint-based map matching smoothing algorithm is proposed for position and attitude estimation from foot-mounted inertial sensors.The simulation data are generated using spline functions, where the estimated position and attitude are used as control points.This paper is an extended version of a work published in the conference paper [27], where a basic algorithm with a simple experimental result is given.
The remainder of the paper is organized as follows.Section 2 describes the smoothing algorithm with waypoint-based map matching to estimate motion for foot-mounted inertial sensors.Section 3 describes the computation of the spline function to generate simulation data.Section 4 provides the experiment results to verify the proposed method.Conclusions are given in Section 5.

Smoothing Algorithm with Waypoint-Based Map Matching
In this section, a smoothing algorithm is proposed to estimate the attitude, position, velocity and acceleration, which will be used to generate simulation data in Section 3.
Two coordinate frames are used in this paper: the body coordinate frame and the navigation coordinate frame.The three axes of the body coordinate frame coincide with the three axes of the IMU.The z axis of the navigation coordinate frame coincides with the local gravitational direction.The choice of the x and y axes of the navigation coordinate frame can be arbitrarily chosen.The notation [p] n ([p] b ) is used to denote that a vector p is represented in the navigation (body) coordinate frame.
The position is defined by [r] n ∈ R 3 , which is the origin of the body coordinate frame expressed in the navigation coordinate frame.Similarly, the velocity and the acceleration are denoted by [v] n ∈ R 3 and [a] n ∈ R 3 , respectively.The attitude is represented using a quaternion q ∈ R 4 , which represents the rotation relationship between the navigation coordinate frame and the body coordinate frame.The directional cosine matrix corresponding to quaternion q is denoted by C(q) ∈ SO (3).
The accelerometer output y a ∈ R 3 and the gyroscope output y g ∈ R 3 are given by y a = C(q) g + a b + n a , where ω ∈ R 3 is the angular velocity, a b ∈ R 3 is the external acceleration (acceleration related to the movement, excluding the gravitational acceleration) expressed in the body coordinate frame, and n a ∈ R 3 and n g ∈ R 3 are sensor noises.The vector g is the local gravitational acceleration vector.It is assumed that g is known, which can be computed using the formula in [28].The sensor biases are assumed to be estimated separately using calibration algorithms [29,30].
Let T denote the sampling period of a sensor.For a continuous time signal y(t), the discrete value is denoted by y k = y(kT).The discrete sensor noise n a,k and n g,k are assumed to be white Gaussian sensor noises, whose covariances are given by ( where r a > 0 and r g > 0 are scalar constants.We assume that a walking trajectory consists of straight line paths, where the angle between two adjacent paths can only take one of the following angle {90 • , −90 • , 180 • }.An example of a walking trajectory is given in Figure 1, where there is 90 • turn at P 2 and −90 • turn at P 3 .Waypoints are denoted by P m ∈ R 3 (1 ≤ m ≤ M), which include positions with turn events (P 2 and P 3 in Figure 1), the initial position (P 1 ) and the final position (P 4 ).

Standard Inertial Navigation Using an Indirect Kalman Filter
In this subsection, q, r, and v are estimated using a standard inertial navigation algorithm with an indirect Kalman filter [31].
The basic equations for inertial navigation are given as follows: where symbol Ω is defined by and [ω×] ∈ R 3×3 denotes the skew symmetric matrix of ω: Let qk , rk and vk be the estimated values of q, r and v using (3), where ω and a b are replaced by y g and y a − C( q) g: Coriolis and Earth curvature effects are ignored since we use a consumer grade IMU for limited walking distances where these effects are below the IMU noise level [32].
When the initial attitude ( q0 ) is computed, the pitch and roll angles can be computed from y a,0 .However, the yaw angle is not determined since there is no heading reference sensor such as a magnetic sensor.In the proposed algorithm, the initial yaw angle can be arbitrarily chosen since the yaw angle is automatically adjusted later (see Section 2.3).qe , r e and v e denote the estimation errors in q, r, and v, which are defined by qe q ⊗ q * k , r e r n − rk , where ⊗ is the quaternion multiplication and q * denotes the quaternion conjugate of a quaternion q.
Assuming that qe is small, we can approximate qe as follows: The state of an indirect Kalman filter is defined by The state equation for the Kalman filter is given by [31]: where the covariance of the process noise w is given by The discretized version of ( 8) is used in the Kalman filter as in [31].Two measurement equations are used in the Kalman filter: the zero velocity updating (ZUPT) equation and the map matching equation.
The zero velocity updating uses the fact that there is almost periodic zero velocity intervals (when a foot is on the ground) during walking.If the following conditions are satisfied, the discrete time index k is assumed to belong to zero velocity intervals [31]: where B g , B a , N g and N a are parameters for zero velocity interval detection.This zero velocity updating algorithm is not valid when a person is on a moving transportation such as an elevator.Thus, the proposed algorithm cannot be used when a person is on a moving transportation.
During the zero velocity intervals, the following measurement equation is used: where n v is a fictitious measurement noise representing a Gaussian white noise with the noise covariance R v .
The second measurement equation is from the map matching, which is used during the zero velocity intervals.From the assumption, a straight line path is parallel to either x axis or y axis.If a path is parallel to x(y) axis, y(x) position is constant and this can be used in the measurement equation.
Let e i ∈ R 3×1 (1 ≤ i ≤ 3) be the unit vector whose i-th element is 1 and the remaining elements are 0. Suppose a person is on the path [P m , P m+1 ] and e T j (P m+1 − P m ) = 0, j = 1 or 2. ( For example, ( 11) is satisfied with j = 1 if the path is parallel to the y axis.When ( 11) is satisfied with j (j = 1 or 2), then the map matching measurement equation is given by where n r,12 is the horizontal position measurement noise whose noise covariance is R r,12 .
If the path is level (that is, e T 3 (P m+1 − P m ) = 0), the z axis value of r k is almost the same in the zero velocity intervals when the foot is on the ground.In this case, the following z axis measurement equation is also used: where n r,3 is the vertical position measurement noise whose noise covariance is R r,3 .
The proposed filtering algorithm is illustrated in Figure 2. To further reduce the estimation errors of the Kalman filter, the smoothing algorithm in [31] is applied to the Kalman filter estimated values.

Path Identification
To apply map matching measurement Equation ( 12), a current path must be identified.Using the zero velocity intervals, each walking step can be easily determined.Let S l be the discrete time index of the end of l-th zero velocity interval (see Figure 3).Let ψ S l be the yaw angle at the discrete time S l and ψ l be defined by Please note that ψ l denotes the yaw angle change during l-th walking step.
The turning (that is, the change of a path) is detected using ψ l .Suppose a current path is [P m , P m+1 ].Then the next turning angle is determined by two vectors P m+1 − P m and P m+2 − P m+1 .For example in Figure 1, if a current path is [P 1 , P 2 ], the next turning angle is 90 • .Let δ be the next turning angle.Turning is determined to occur at l-th walking step if the following condition is satisfied: where ψ th is a threshold parameter and M l is a positive integer parameter.Equation ( 15) detects the turning if the summation of the yaw angle changes during 2M l + 1 walking steps is similar to the next expected turning angle δ.The use of parameter M l is due to the fact that turning does not occur during a single step.Once turning is detected in (15), a current path is modified to [P m+1 , P m+2 ] from [P m , P m+1 ].

Initial Yaw Angle Adjustment
The initial yaw angle is arbitrarily chosen and adjusted as follows.Suppose the first N first walking steps belong to the first path [P 1 , P 2 ].Let x l and y l (1 ≤ l ≤ N l ) be defined by The line equation representing (x l , y l ) is computed using the following least squares optimization: The angle between the line (defined by the line equation a, b, c) and [ e 1 e 2 ] T (P 2 − P 1 ) is computed.Using this angle, the initial yaw angle is adjusted so that the walking direction coincides with the direction dictated by the waypoints.

Spline Function Computation
In this section, spline function q(t) (quaternion spline) and r(t) (position spline) are computed using qk , rk and vk as control points.

Cumulative B-Splines Quaternion Curve
Since the quaternion spline q(t) is computed for each interval [kT, (k + 1)T), it is convenient to introduce qk (u) notation, which is defined by To define qk (u), ωk is defined as follows: where the logarithm of an orthogonal matrix is defined in [33].Please note that ŵk is a constant angular velocity vector, which transform from qk to qk+1 .Cumulative B-spline basis function is used to represent the quaternion spline, which is first proposed in [24] and also used in [34]. where The cumulative basis function Bi (u where D is computed using the matrix representation of the De Boor-Cox formula [34]: To generate the gyroscope simulation data, the angular velocity spline ω(t) is required.From the relationship between q(t) and ω(t) [35], ω(t) is given by ω(t) = 2Ξ( q(t)) q(t) (22) where The derivative of q(t) (kT ≤ t < (k + 1)T) is given by where

Eighth-Order Algebraic Splines
The position r(t) is represented by eighth-order algebraic spline [26], where k-th spline segment is given by where p kj,m (0 ) are the coefficients of the k-th spline segment of the m-th element of rk (for example, rk,1 is the x position spline).Continuity constraints up to third derivative of rk,m (u) are imposed on the coefficients.Let âk be the estimated value of the external acceleration in the navigation coordinate frame, which can be computed as follows (see ( 3) The coefficients p kj,m are chosen so that r(kT), ṙ(kT) and r(kT) are close to rk , vk and âk .An additional constraint is also imposed to reduce the jerk term (the third derivative of r(t)), which makes r(t) smooth rather than jerky.Thus, the performance index for m-th element (1 ≤ m ≤ 3) of r(t) is defined as follows: This minimization of J m can be formulated as a quadratic minimization problem of the coefficients p kj,m as follows: min where 1) and M 3 ∈ R can be computed from (26).
Although the matrix size of M 1 could be large, it is a banded matrix with a bandwidth of 7.An efficient Cholesky decomposition algorithm is available for matrices with a small bandwidth [36] and ( 27) can be solved efficiently.
Let pkj,m be the minimization solution of (26).Then r can be computed by inserting pkj,m into (24) and v, ā can be computed by taking the derivatives.
The weighting factors α i (1 ≤ i ≤ 3) and β determine the smoothness of r, v and ā.If β is large, we obtain smoother r, v and ā curves at the sacrifice of nearness to the control points r, v and â.
Let ȳa and ȳg be accelerometer and gyroscope output generated using the spline functions.These values can be generated using (1), where q, a b , ω are replaced by q, C( q) ā, ω with appropriate sensor noises.An overview of the simulation data generation system is shown in Figure 4.

Experiment and Results
In this section, the proposed algorithm is implemented through indoor experiments.An inertial measurement unit MTi-1 of XSens was attached on the foot with the sampling frequency of 100 Hz.The parameters used in the proposed algorithm are given in Table 1.Two experiment sets of scenarios are conducted: (1) walking along a rectangular path for 2D walking data generation; and (2) walking on corridors and stairs for 3D walking data generation.

Walking along a Rectangular Path
In this experimental scenario, the subjects walked five laps at normal speed along a rectangular path with dimensions of 13.05 m by 6.15 m.The total distance for five laps on the path was 192 m.
The standard Kalman filter results without map matching are given in Figure 5.The errors in Figure 5 were primarily driven by the errors in the orientation estimation as well as run bias instability of the inertial sensors leading to the position error of 1 m.As can be seen that the maximum error was almost 2 m at the end of the walking.The navigation results in Figure 6 were obtained from the proposed smoothing algorithm with map matching.It can be seen that the results are improved due to the map matching.The z axis spline data (for the three walking steps out of the rectangle walking steps) is given in Figure 7.

Walking along a 3D Indoor Environment
In the second experimental scenario, a person walked along a 3D indoor environment corridors and stairs.
Figure 8 shows the walking along a 3D trajectory results with a waypoint P 1 is the starting point whose coordinate is (0, 0, 0).The coordinates of waypoints P 1 to P 14 are known, and the starting waypoint P 1 coincides with the end waypoint P 14 on the projection plane.The routes are as follow: starting from the third floor waypoint P 1 , walking along the floor to collect data with normal speed then turning 180 • in P 2 and turning on the right in P 3 , then going up the stairs through the floor by the same way as the other floors, finally reaching the fifth floor waypoint P 14 , after that turning 180 • and walking along the floor to coming back the starting waypoint P 1 .The total length of the path line is approximately 562.98 m.

Evaluation of Simulation Data Usefulness
The simulation data used to test specific performance of a certain algorithm.In this subsection, the standard Kalman filter without map matching is evaluated using the simulation data generated in Section 4.1.The algorithm is tested 1000 times with different noise values (walking motion data is the same).
Let rxy,final,i be the estimation error of the final position value (x and y components) of i-th simulation, where 1 ≤ i ≤ 1000.Since the mean value of rxy,final,i is not exactly zeros, its mean value is subtracted.
The accuracy of an algorithm can be evaluated from the distribution of rxy,final,i .Consider an ellipse whose center point is the mean of rxy,final,i and which include 50% of rxy,final,i (see Figure 9).Let a be the length of the major axis and b be the length of the minor axis.Smaller values of a and b indicate that the error of a certain algorithm is smaller.

Affects of Sampling Rate on the Estimation Performance
The simulation results for the final position estimated errors with different sampling rates are given in Table 2.As an example, Figure 9 shows the estimation error of the final position value with a sampling rate of 100 Hz, where an ellipse represents the boundary of 50% of probability.As can be seen, the final position errors of the different sampling rates are almost the same except for the result with a sampling rate of 50 Hz.This simulation result suggests that the sampling rate is smaller than 100 Hz is not desirable.Also, there is no apparent benefit using the sampling rate higher than 100 Hz.

Gyroscope Bias Effect
The simulation results for the final position estimated errors with different gyroscope bias are given in Table 3.As can be seen, the final position errors change significantly when the gyroscope bias becomes to change larger.

Conclusions
In this paper, simulation data is generated for walking motion estimation using inertial sensors.The first step to generate simulation data is to perform a specific motion, which you want to estimate.The attitude and position are computed from inertial sensors data using a smoothing algorithm.The spline functions are generated using the smoother estimated values as control points.B-spline function is used for the attitude quaternion, and eighth-order algebraic spline function is used for the position.
The spline simulation data generated from the proposed algorithm can be used to test a new motion estimation algorithm by easily changing the parameters such as noise covariance, sampling rate and bias terms.
The shape of generated spline function depends on the weighting factors, which control the constraint on the jerk term.It is one of future research topic to investigate how to choose the optimal weighting factors, which give the most realistic simulation data.

Figure 4 .
Figure 4. System overview for simulation data generation.

Figure 5 .
Figure 5. Rectangle walking estimation for five laps using a standard Kalman filter.

Figure 6 .
Figure 6.Rectangle walking estimation for five laps using the proposed smoothing algorithm.

Figure 7 .
Figure 7. z axis spline functions of the rectangle walking.

Figure 8 .
Figure 8. 3D path indoor estimation with the proposed smoothing algorithm.

Table 1 .
Parameters used in the proposed algorithm

Table 2 .
Final position errors with different sampling rates.Estimation error of the final position value with a sampling rate 100 Hz [ellipse with 50% of probability radius].

Table 3 .
Final position errors with different gyroscope bias.