## 2 Cooperative SCARA System
### Controllers
#### 2.4.2 Sliding Mode Controller  
The Sliding Mode Controller is a robust and effective technique for controlling nonlinear systems, particularly those with disturbances and model uncertainties. This technique is particularly useful in cooperative robotics applications, where precision and adaptability are crucial for system performance.  
The SMC is based on the following principles:  
1. Sliding surface: A sliding surface \(\mathrm{s}(\mathrm{x})=0\) is defined where \(\mathrm{s}(\mathrm{x})\) is a function of system state \(\mathrm{x}\). This surface represents the desired behavior of the system.
2. Control law: The SMC control law is divided into two components: * Equivalent Control (\(\mathrm{u}_{\mathrm{eq}}\)): This is calculated to maintain the system on the sliding surface in the absence of disturbances. * Switching Control \((\mathrm{u}_{\mathrm{n}})\): This is added to ensure that the system remained on the sliding surface, compensating for disturbances and uncertainties.
3. Discontinuous control action: The typical switching control law has the form \(\mathrm{u}_{\mathrm{n}}=-\mathrm{ksign}(\mathrm{s}(\mathrm{x}))\), where \(\mathrm{K}\) is a positive gain and \(\mathrm{s}(\mathrm{x})\) is the sign function that introduces a discontinuous control action to drive the system towards the sliding surface.
4. Complete control law: \(\mathrm{u}=\mathrm{u}_{\mathrm{eq}}+\mathrm{u}_{\mathrm{n}}\).  
The SMC is known for its robustness against disturbances and variations in system parameters. It stands out for its simplicity in design, fast response, and reduction in tracking errors, making it ideal for applications in which conditions can change rapidly. This technique is crucial in cooperative robotics, where synchronization and coordination are essential. By maintaining the system on the sliding surface, SMC minimizes tracking errors, ensuring that the robots cooperate efficiently.  
For the implementation of the controller in the system and considering Equation (12), which describes the dynamics of a robotic manipulator where \(\mathrm{q}\), \(\mathrm{\dot{q}}\), \(\mathrm{\ddot{q}}\) vectors represent the angles, velocities, and accelerations of the joints, respectively, the following is proposed:1. Definition of state variables: \(x_{1}=q\,y\,x_{2}=\dot{q}_{2}\).
2. Control input: \(u=\tau\).
3. State-space representation: \[x=\begin{bmatrix}x_{1}\\ x_{2}\end{bmatrix}=\begin{bmatrix}q\\ \dot{q}_{2}\end{bmatrix}\] (35)
4. Definition of the sliding surface: \(s=\dot{e}+\lambda e\), where \(e=q-q_{ref}\) is the tracking error, and \(\lambda\) is a coefficient that affects the rate of convergence to the sliding surface.
5. SMC control law: \[M_{i}(q_{i})\big{(}\ddot{q}_{ref}-\lambda\dot{e}\big{)}+C_{i}\big{(}q_{i}, \dot{q}_{i}\big{)}\dot{q}_{i}+G_{i}(q_{i})-ksign(s)=u\] (36) where \(\ddot{q}_{ref}\) is the acceleration of the reference trajectory, and \(k\) is a gain that determines the magnitude of the discontinuous control action.
6. Reduction in chattering: To reduce chattering in the control signal, the sign function can be replaced with a saturation function as follows: \[sat\Big{(}\frac{s}{\Phi}\Big{)}=\begin{array}{ll}1&\text{is,$s>\Phi$}\\ \frac{s}{\Phi}&\text{is, $|s|\leq\Phi$}\\ -1&\text{is,$s<\Phi$}\end{array}\] (37) where \(\Phi\) is the thickness of the boundary layer.