## 3 Adaptive Fuzzy Controller for the Hydraulic Manipulator  
### Cascade Control  
In this paper, the proposed control is divided into two subsystems based on cascade control. In the outer loop, sliding mode control is employed to cope with the manipulator dynamic and generate desired torque for the hydraulic actuator, whereas the inner loop control using non-linear PI is utilized to run the actual torque induced by the EHA under the presence of the uncertainties and the highly nonlinear terms. The overview of the proposed control is illustrated in Figure 4.  
**Step 1:** The sliding mode control for the manipulator dynamics. Define state variable errors \(e=x_{1}-x_{1d}\in R^{3\times 1}\), \(\dot{e}=x_{2}-x_{2d}\in R^{3\times 1}\), and \(\ddot{e}=\dot{x}_{2}-\dot{x}_{2d}\in R^{3\times 1}\), where \(x_{1d}\,\text{and}\,x_{2d}\in R^{3\times 1}\) are the desired angular position and velocity, respectively. The sliding variable vector \(s_{1}=[s_{11}\ \ s_{12}\ \ s_{13}]^{T}\in R^{3\times 1}\) is chosen as follows:  
\[s_{1}=\dot{e}+\lambda e \tag{17}\]  
where \(\lambda=\text{diag}(\lambda_{1},\dots,\lambda_{3})\) is a positive-definite matrix. The reference state of the manipulator is defined as:  
\[\left\{ \begin{array}{l}x_{2s}=x_{2}-s_{1}=x_{2d}-\lambda e\in R^{3\times 1}\\ \dot{x}_{2s}=\dot{x}_{2}-\dot{s}_{1}=\dot{x}_{2d}-\lambda\dot{e}\in R^{3\times 1 }\end{array} \right. \tag{18}\]  
The derivative of the sliding variable with respect to time is expressed as follows:  
\[\dot{s}_{1}=\dot{e}+\lambda\dot{e} \tag{19}\]  
Replacing (17), (18), and (19) into the 2 nd equation of (16) yields:  
\[\dot{s}_{2}=\dot{x}_{3}-\dot{x}_{3d}=-F_{1}(x)+F_{2}(x)U+\Delta_{2}(t)-\dot{x}_{3d} \tag{28}\]  
The control vector is chosen as  
\[U=F_{2}^{-1}(x)\Big{(}\dot{x}_{3d}-F_{1}(x)-K_{2}s_{2}-\Gamma v_{2}-s_{1}-\eta_{ 2}sign(s_{2})\Big{)} \tag{29}\]  
where \(K_{2}=diag(k_{21},k_{22},k_{23})\) and \(\Gamma=diag(\gamma_{1},\gamma_{2},\gamma_{3})\) are arbitrary positive matrices, \(\
u_{2}=\int_{0}^{t}s_{2}(\tau)d\tau\in R^{3\times 1}\), \(\eta_{2}=diag(\eta_{21},\dots,\eta_{23})\in R^{3\times 3}\) is a robust gain diagonal positive \(d_{2}\) matrix of the sliding mode control s\({}_{2}\), and the sign function \(\mathrm{sgn}(s_{2})\) is defined by:  
\[sign(s_{2})=\Big{[} \begin{array}{cc}sign(s_{21})&sign(s_{22})& sign(s_{23})\end{array} \Big{]}^{T} \tag{30}\] \[sign(s_{2i})=\left\{ \begin{array}{cc}1&ifs_{2i}(t)\geq 0\\ -1&ifs_{2i}(t)<0\end{array} \right.\]  
**Assumption 2**. : _The perturbation, \(\Delta_{2}(t)\), varies with respect to time, and it is bounded \(\|\Delta_{2i}(t)\|\leq\eta_{2i}(i=1,\dots,3)\)._  
Considering the Lyapunov function candidate:  
\[V_{2}(s_{1},s_{2})=V_{1}(s_{1})+\frac{1}{2}s_{2}^{T}s_{2}+\frac{1}{2}v_{2}^{T} \Gamma v_{2} \tag{31}\]  
The derivative of the Lyapunov function (31) is:  
\[\dot{V}_{2}(s_{1},s_{2})=\dot{V}_{1}(s_{1})+s_{2}^{T}\Big{(}\dot{s}_{2}(t)+ \Gamma v_{2}\Big{)} \tag{32}\]  
Replacing (29) and (27) into (32), the derivative of the Lyapunov function can be rewritten as follows:  
\[\dot{V}_{2}(s_{1},s_{2})=\dot{V}_{1}(s_{1})+s_{2}^{T}\Big{(}\dot{s}_{2}(t)+ \Gamma v_{2}\Big{)}\leq\sum_{i=1}^{2}-s_{i}^{T}K_{i}s_{i}+s_{i}{}^{T}(\Delta_{ i}(t)-\eta_{i}\mathrm{sign}(s_{i}))\leq\sum_{i=1}^{2}-s_{i}^{T}K_{i}s_{i} \tag{33}\]  
As shown in (33), \(\dot{V}_{2}(s_{1}(t),s_{2}(t))\) is a negative-definite function, \(V_{2}(s_{1}(t),s_{2}(t))\leq V_{2}(s_{1}(0),s_{2}(0))\). It means that \(s_{1}\) and \(s_{2}\) are bounded. Let function \(P_{v2}=s_{1}^{T}K_{1}s_{1}+s_{2}^{T}K_{2}s_{2}\leq-\dot{V}_{2}\) and integrate function \(P_{v2}\) with respect to time.