# Design of a Lower Limb Exoskeleton: Robust Control, Simulation and Experimental Results
## 5 Control Algorithm
### Control Algorithm  
The following assumptions are made about the robot dynamics [21]:  
\[\begin{split}&\|\mathrm{M}(\mathrm{q})\|<\alpha_{1},\\ &\|\mathrm{C}(\mathrm{q},\dot{\mathrm{q}})+\mathrm{g}(\mathrm{q}) \|<\alpha_{3}+\alpha_{4}\|\mathrm{q}\|+\alpha_{2}\|\dot{\mathrm{q}}\|^{2},\\ &\|\tau_{d}(t)\|<\alpha_{5}.\end{split} \tag{4}\]  
The exoskeleton is subject to uncertainties in the parameters of the dynamic model. It is considered that the real values of the parameters are unknown. However, an estimate is available; therefore, the \(M(q)\) matrix can be decomposed as  
\[M(q)=M_{e}(q)+M_{\Delta}(q), \tag{5}\]  
where \(M_{e}(q)\in R^{n\times n}\) contains the estimated parameters of the inertial matrix and \(M_{\Delta}(q)\in R^{n\times n}\) contains the unknown parameters. Therefore, Equation (1) can be rewritten as  
\[M_{e}(q)\ddot{q}+M_{\Delta}(q)\ddot{q}=-C(q,\dot{q})\dot{q}-g(q)-\delta(q, \dot{q})+\tau_{d}+\tau. \tag{6}\]  
Then, the angular acceleration is  
\[\ddot{q} = M_{e}(q)^{-1}\tau-M_{e}(q)^{-1}[M_{\Delta}(q)\ddot{q}+C(q,\dot{q}) \dot{q}+g(\dot{q},\dot{q})-\tau_{d}]. \tag{7}\]By defining \(F(q,\dot{q},\ddot{q})\), (7) becomes  
\[\ddot{q}=M_{e}(q)^{-1}\tau-F(q,\dot{q},\ddot{q}), \tag{8}\]  
where \(F(q,\dot{q},\ddot{q})\) represents the unknown dynamics of the robot, shown in (9):  
\[F(q,\dot{q},\ddot{q})=M_{e}(q)^{-1}[M_{\Delta}(q)\ddot{q}+C(q,\dot{q})\dot{q}+g (q)+\delta(q,\dot{q})-\tau_{d}]. \tag{9}\]  
We define the tracking error as  
\[e =q_{d}-q, \tag{10}\] \[\dot{e} =\dot{q}_{d}-\dot{q},\] (11) \[\ddot{e} =\ddot{q}_{d}-\ddot{q}\ =\ \ddot{q}_{d}-M_{e}^{-1}(q)\tau+F(q,\dot{q}, \ddot{q}). \tag{12}\]  
Also, we assume that the unknown dynamics \(F(q,\dot{q},\ddot{q})\) and its derivative \(\dot{F}(q,\dot{q},\ddot{q})\) satisfy the following conditions:  
\[\|F(q,\dot{q},\ddot{q})\| \leq\Lambda_{1}^{T}B_{1},\] \[\|\dot{F}(q,\dot{q},\ddot{q})\| \leq\Lambda_{2}^{T}B_{2}. \tag{13}\]  
Both are hypotheses used in the design of the control [16], where \(\Lambda_{1}=[1\quad\|q\|\quad\|q\|^{2}]^{T}\) and \(\Lambda_{2}=[1\quad\|q\|\quad\cos||\dot{q}||]^{T}\), while \(B_{1}\) and \(B_{2}\in\mathbb{R}^{3}\) are vectors with positive constant elements.  
The proposed condition for \(\|F(q,\dot{q},\ddot{q})\|\) is considering the sum of the individual assumptions in (4) of the matrices that make up the vector. For the sliding surface, the following variable is defined. Also, its derivative,  
\[\sigma =e+\Gamma\int_{0}^{t}e^{[p]}(\tau)d\tau,\] \[\dot{\sigma} =\dot{e}+\Gamma e^{[p]}, \tag{14}\]  
where \(\sigma=[\sigma_{1},\sigma_{2},...,\sigma_{n}]^{T}\), \(e^{[p]}=|e|^{p}sign(e)\), \(0<v<1\) and \(\Gamma\in R^{n\times n}\) is a positive diagonal matrix. The sliding surface is described as  
\[s =\ \ddot{e}+\beta\sigma+\alpha\sigma, \tag{15}\]  
where \(s\) represents the proposed surface vector, \(v\) is fractional order and \(\alpha,\beta>0\) are constant parameters. By substituting Equation (14) into (15),  
\[s=\ddot{q}_{d}-M_{e}^{-1}(q)\tau+F(q,\dot{q},\ddot{q})+\beta(\dot{e}+\Gamma e^ {[p]})+\alpha\bigg{(}e+\Gamma\int_{0}^{t}e^{[p]}(\tau)d\tau\bigg{)}. \tag{16}\]  
The input control is defined as  
\[\tau=M_{e}[\tau_{a}+\tau_{b}], \tag{17}\]  
where \(\tau_{a}\) is the input control for the known terms and \(\tau_{b}\) is for compensating the unknown dynamics. Introducing Equation (17) into Equation (16),  
\[s=\ddot{q}_{d}-\tau_{a}-\tau_{b}+F(q,\dot{q},\ddot{q})+\beta(\dot{e}+\Gamma e^ {[p]})+\alpha\bigg{(}e+\Gamma\int_{0}^{t}e^{[p]}(\tau)d\tau\bigg{)}. \tag{18}\]  
Therefore, the corresponding equation of \(\tau_{a}\) is formulated as follows:  
\[\tau_{a}=\ddot{q}_{d}+\beta(\dot{e}+\Gamma e^{[p]})+\alpha\bigg{(}e+\Gamma\int _{0}^{t}e^{[p]}(\tau)d\tau\bigg{)}. \tag{19}\]Substituting Equation (19) into Equation (18),  
\[s = -\tau_{b}+F(q,\dot{q},\ddot{q}), \tag{20}\]  
Obtaining the derivative of Equation (20)  
\[\dot{s} = -\tau_{b}+\tilde{F}(q,\dot{q},\ddot{q}). \tag{21}\]