# Single Leg Gait Tracking of Lower Limb Exoskeleton Based on Adaptive Iterative Learning Control
## 2 Adaptive Iterative Learning Control  
### Design of the AILC Controller  
Figure 1 shows the block diagram of a typical iterative learning controller. In the controller, \(\theta_{d}(t)\) is the desired trajectory and \(x_{k}(0)\) is the initial state. In a given time \(t\in[0,T]\), the control input \(\varphi_{k}(t)\) should approach \(\varphi_{d}(t)\) and the system output \(\theta_{k}(t)\) should approach the desired trajectory \(\theta_{d}(t)\) through iterative parameter updates and learning. \(e_{k}(t)\) is the deviation between the expected output \(\theta_{d}(t)\) and the actual output \(\theta_{k}(t)\). \(\varphi_{k}\) of the \(k_{th}\) iteration is calibrated by the deviation \(e_{k}(t)\) at the \(k_{th}\) closed-loop iteration.  
When the controlled system runs for the \(k_{th}\) time:  
\[\begin{array}{l}\dot{x}_{k}(t)=f(x_{k}(t),\;\varphi_{k}(t),\;t)\\ \theta_{k}(t)=g(x_{k}(t),\;\varphi_{k}(t),\;t)\end{array} \tag{1}\]  
where, \(x\in R^{n}\), \(\theta\in R^{m}\), and \(\tau\in R^{r}\) are the state, output, and input variables of the system, respectively. The tracking error \(e_{k}(t)\) is:  
\[e_{k}(t)=\theta_{d}(t)-\theta_{k}(t) \tag{2}\]  
Figure 1: The block diagram of the iterative learning control (ILC) algorithm.  
The control law of ILC (iterative learning control) in classical PID (proportion, integral, differential) closed-loop controller can be expressed as:  
\[\varphi_{k}=\varphi_{k-1}(t)+\mathbf{\Gamma}\dot{\mathbf{\epsilon}}_{k}(t)+\mathbf{\Phi} \mathbf{\epsilon}_{k}(t)+\mathbf{\
abla}\int_{0}^{t}e_{k}(t)dt \tag{3}\]  
where, \(\mathbf{\Gamma}\), \(\mathbf{\Phi}\) and \(\mathbf{\
abla}\) are learning gain matrices.  
Figure 2 is the schematic diagram of the adaptive iterative learning control (AILC). The adaptive controller corrects the conventional controller's parameters according to the deviation \(\mathbf{\epsilon}_{k}(t)\) and a modified value \(\varphi_{k}\). The iterative learning control system takes the required control system parameters as the function of the running state of the control objective.  
The control law and adaptive parameter learning the law of the \(k_{th}\) iteration is:  
\[\mathbf{\tau}_{k}(t)=\mathbf{K}_{P}\mathbf{\epsilon}_{k}(t)+\mathbf{K}_{D}\dot{\mathbf{\epsilon}}_{ k}(t)+\mathbf{\phi}_{k}(t)sgn\Big{(}\dot{\mathbf{\epsilon}}_{k}(t)\Big{)},\quad k=0,1, \ldots,N \tag{4}\]  
\[\mathbf{\phi}_{k}(t)=\mathbf{\phi}_{k-1}(t)+\ \mathbf{\gamma}\mathbf{\epsilon}_{k}^{T}(t)sgn \Big{(}\dot{\mathbf{\epsilon}}_{k}(t)\Big{)} \tag{5}\]  
In Equation (4), \(\mathbf{K}_{P}\) and \(\mathbf{K}_{D}\) are PID gain matrices, \(sgn\) is the sign function, which can enhance the anti-interference ability of the system, and \(N\) is the total number of iterations. In Equation (5), \(\hat{\varphi}_{k-1}(t)=0\); \(\mathbf{\gamma}\) is the adaptive parameter; \(\dot{\mathbf{\epsilon}}_{k}^{T}(t)\) is the transpose of \(\dot{\mathbf{\epsilon}}_{k}(t)\), and:  
\[\mathbf{\epsilon}_{k}(t) =\mathbf{\theta}_{d}(t)-\mathbf{\theta}_{k}(t) \tag{6}\] \[\dot{\mathbf{\epsilon}}_{k}(t) =\mathbf{\hat{\theta}}_{d}(t)-\dot{\mathbf{\theta}}_{k}(t) \tag{7}\]  
In Equation (6), \(\mathbf{\theta}_{d}(t)=\left[\begin{array}{c}\theta_{d1}(t)\\ \theta_{d2}(t)\end{array}\right]\), \(\theta_{d1}(t)\) and \(\theta_{d2}(t)\) are the target trajectories of the hip and knee joint of the lower limb exoskeleton, respectively; \(\mathbf{\theta}_{k}(t)=\left[\begin{array}{c}\theta_{k1}(t)\\ \theta_{k2}(t)\end{array}\right]\); \(\theta_{k1}(t)\) and \(\theta_{k2}(t)\) are the trajectories of the hip and knee joint generated by the \(k_{th}\) iteration.