# Bio-Inspired Real-Time Prediction of Human Locomotion for Exoskeletal Robot Control
## 3 Methods
### [PERSON] Reconstruction Prediction and Modifications Based on Motion Smoothness  
[PERSON] reconstruction method is correct for predicting the joint trajectories of human lower limbs, which present quasi-periodicity and nonlinearity. According to [PERSON] reconstruction theorem, it is possible to reconstruct the dynamics of a nonlinear system based on its past measurements. For this purpose, a current embedding vector is defined:  
\[D(t)= \begin{bmatrix}y(t)&y(t-\Delta t)&\cdots&y(t-(p-1)\Delta t)\end{bmatrix} ^{T}, \tag{1}\]  
where \(y(t)\) stands for the current state which might be position, velocity, acceleration, etc., \(t\) is the current sampling instant, \(p\) is the embedding vector length, and the sampling constant is \(\Delta t\). [PERSON] original reconstruction algorithm proposed by [PERSON] [19] is illustrated in Figure 2:  
Figure 1: The inertial measurement unit (IMU)-based lower limb motion capture system. (**a**) One IMU module. (**b**) The system worn on a testing subject and the illustration of joint angles in the human sagittal plane collected in this research. Figure 2: [PERSON] basic reconstruction method workflow. At each sampling instant \(t\) with \(t\geq l\Delta t\), an embedding vector \(D(t)\) is acquired. The current embedding vector \(D(t)\) is then compared to all collected historical embeddings \(D(t_{i})\) with \(l\Delta t\leq t_{i}<t\) by determining the Euclidean distances  
\[\delta(i)=\sqrt{\sum_{x=1}^{p}(y(t_{i}-\Delta t_{x-1})-y(t-\Delta t_{x-1}))^{2}}, \tag{2}\]  
In Equation (2) \(i\) is the index of the \(i\)th historical embedding \(D(t_{i})\) and \(1\leq i\leq l\). \(l\) is also called the history data length. As \(D(t_{i})\) is a vector composed of a series of states, the first component of \(D(t_{i})\) is labeled as \(y(t_{i})\) and the components are defined as \(y(t_{i}-\Delta t_{x-1})\) where \(\Delta t_{x-1}=(x-1)\Delta t\) and \(1\leq x\leq p\). The \(M\) best matching embeddings \(D(\tilde{t}_{1}),D(\tilde{t}_{2}),\ldots,D(\tilde{t}_{M})\) from the sampling instants \(\tilde{t}_{j}\) with \(1\leq j\leq M\) are used to calculate a \(k\)-step prediction \(\hat{y}(t+\Delta t_{k}|t)\):  
\[\hat{y}(t+\Delta t_{k}|t)=\sum_{j=1}^{M}\omega_{j}y(\tilde{t}_{j}+\Delta t_{k }), \tag{3}\]  
with the weightings  
\[\omega_{j}=\frac{1}{N}\frac{1}{\delta(\tilde{t}_{j})}, \tag{4}\]  
and  
\[N=\sum_{j=1}^{M}\frac{1}{\delta(\tilde{t}_{j})}, \tag{5}\]  
In Equation (3) \(\Delta t_{k}=k\Delta t\). When \(k=1\), the subscript is dropped as \(\Delta t\). \(k\) is also called prediction horizon. Although [PERSON] reconstruction method bears many practical advantages such as easy parameter calibration, result smoothness, accuracy and so on, its improvement is still quite possible. The natural smoothness of motion brought by the human body indicates whether high frequency jumps and sharp spikes in trajectories were initially predicted, as correction and smoothing techniques would be used to produce a more realistic result. First, we assumed that the \(y(t_{i}-\Delta t_{x-1})\) in \(D(t_{i})\) closer to \(y(t_{i})\) had more of an influence on Euclidean distance determination. Thus, the Euclidean distances was calculated with the addition of Gaussian coefficients \(G(x)\):  
\[\delta(i)=\sqrt{\sum_{x=1}^{p}((y(t_{i}-\Delta t_{x-1})-y(t-\Delta t_{x-1}))G (x))^{2}}, \tag{6}\]  
and  
\[G(x)=e^{-\frac{1}{2}(\frac{x-1}{Q})^{2}}, \tag{7}\]  
where \(Q\) is constant and \(p\) is the embedding vector length. As the prediction result was not very sensitive to the value of \(Q\), it was chosen to be 4 in this research, which was justified by several items of gait data. Second, the offset between \(y(\tilde{t}_{j})\) in a best matching embedding of \(D(\tilde{t}_{j})\) and \(y(t)\) in the current embedding vector was decided during each vector match by  
\[\Delta y_{j}=y(\tilde{t}_{j})-y(t), \tag{8}\]where \(y(\tilde{t}_{j})\) means the past observation of the current state \(y(t)\) in the \(j\)th best matching vector \(D(\tilde{t}_{j})\).