*3.1. Simulation of the Vision-Based Hybrid Controller*

Prior to implementing the algorithm on the actual PR, some simulations are performed on a kinematic and dynamic model of the 3UPS+RPU PR designed in MATLAB/Simulink. In both simulation and experimentation, the PR is moved from the initial position to a singular test configuration without activating the releaser. Then, it remains in the singular configuration for 15 s, after which the loop of the SRM is activated via *epin*. In that moment, one of the SRMs in Section 2.5 is launched based on the assumption that it will help release the robot from the type II singularity. The SRM launched has a lapse of 15s, allowing it to move the PR under study to a non-singular configuration.

Due to the lack of a simulated model of the 3DTS (see Figure 9) for MATLAB/Simulink, → *Xc* is calculated directly by solving the forward kinematic problem. The main objective of the simulation is to test that the novel hybrid controller increases the values of *JD* and Ω*i*,*<sup>j</sup>* in the vicinity of a type II singular configuration; i.e., it is able to release the PR under study from the type II singularity.

Since the 3UPS+RPU PR was built to interact with human knees, it is used to execute three rehabilitation movements: flexion of the hip, flexion–extension of the knee, and internal–external rotation of the knee [19]. This study, combining these three fundamental movements for simulation and experimentation, performs five knee rehabilitation trajectories ending in a type II singular configuration (see Table 3). The singular configurations of these five trajectories have *JD* and Ω*i*,*<sup>j</sup>* close to zero but not exactly zero, avoiding several forward kinematic solutions in the simulation. All five knee trajectories are designed with constant velocity; in this case, the translational DOFs move at 0.02 *m*/*s* and the rotational ones at 0.03 rad/s.


**Table 3.** Description of the trajectories with a type II singularity at the end.

The simulation of the five knee rehabilitation trajectories verifies that SRM-V1 and SRM-V2 release the 3UPS+RPU PR from a singular configuration. Figure 10 shows how the type II singularity indices *JD<sup>c</sup>* and minΩ*<sup>c</sup>* increase when *epin* is activated for trajectory

1. These results verify from an analytical perspective that the hybrid controller proposed releases the 3UPS+RPU PR from a type II singularity.

**Figure 10.** (**a**) *JD* (**b**) minΩ for trajectory 1 in the simulation.

The performance of the proposed hybrid controller in tracking <sup>→</sup> *q indr* is evaluated by three overall measures:

• The mean absolute error (MAE)

$$\text{MAE} = \frac{1}{F} \sum\_{i=1}^{F} \left( \frac{1}{n} \sum\_{j=1}^{n} |q\_{indr}(i,j) - q\_{indc}(i,j)| \right) \tag{11}$$

• The mean absolute percentage error (MAPE)

$$\text{MAPE} = \frac{100}{F} \sum\_{i=1}^{F} \left( \frac{1}{n} \sum\_{j=1}^{n} \left| \frac{q\_{indr}(i,j) - q\_{indc}(i,j)}{q\_{indr}(i,j)} \right| \right) \tag{12}$$

• The mean distance travelled for type II singularity release (MDSR)

$$\text{MDSR} = \frac{1}{F} \sum\_{i=1}^{F} \left( \sum\_{j=1}^{n} |q\_{indr}(i,k) - q\_{indc}(i,j)| \right) \tag{13}$$

where *n* is the number of samples taken after the activation of *epin* at instant *k*, and *i* and *j* are the actuator and the time instant, respectively.

Table 4 shows the MAE, MAPE, and MDSR results for the simulation of the hybrid controller with SRM-V1 and SRM-V2. In this table, the MAE and the MAPE show that SRM-V1 has less error in position tracking than that of SRM-V2 during release from the type II singularity. In addition, the MDSR shows that SRM-V1 needs fewer movements of the actuators than SRM-V2 to release the PR from a singular configuration. These results show that moving the pair of actuators identified by the index Ω*i*,*<sup>j</sup>* (SRM-V1) is the best option to release a PR from a type II singularity.


**Table 4.** Performance of the hybrid controller using SRM-V1 and SRM-V2 in the simulation.
