*3.2. Experimentation of the Vision-Based Hybrid Controller*

After testing the novel vision-based controller in simulation, the next step is implementing the hybrid controller on the real robot according to the diagram shown in Figure 9. Although both the simulation and experimentation have the same procedure, the experimentation presents two notable differences:


In the experimental context, the type II singularity release can be tested by trying to move the PR by hand before (when the PR is expected to move) and after the SRM is activated. After the activation of the SRM, the 3UPS+RPU PR will regain the stiffness required to ensure safe interaction with a patient.

Regarding the actual robot, the external limbs are driven by Festo DNCE 32-BS10 prismatic actuators, and the central limb is driven by a NIASA M100-F16 prismatic actuator. All the actuators are attached to Maxon 148867 150 W DC motors commanded by ESCON 50/5 servo controllers, which control the current by means of pulse width modulation (PWM). The current is proportional to the applied voltage (which comes from the control actions), and the torque is in turn proportional to the current. The DC motors are equipped with incremental encoders with a resolution of 500 counts per turn.

The control unit is connected to an industrial computer using acquisition cards. A PCI 1784 Advantech card is used to read the position from the encoders, having four 32-bit quadruple AB phase encoder counters. On the other hand, a 12-bit, 4-channel PCI 1720 Advantech card is used to send the control actions <sup>→</sup> *μ*.

The proposed vision-based hybrid controller runs on the Robot Operating System 2 (ROS2) [31,32]. The two levels of the hybrid controller and the processing of the data stream from the 3DTS are implemented in a modular way using the C++ and Python programming languages. The controller receives the set of references <sup>→</sup> *q indr* from the solution of the inverse kinematics given the Cartesian references for the end-effector. The <sup>→</sup> *q indr* is sampled at a rate of 100 Hz, and the desired releasing velocity *ν<sup>d</sup>* is set to 0.01 *<sup>m</sup> <sup>s</sup>* . These parameters are suitable for knee rehabilitation requirements.

For the actual PR, a fourth performance index is added to evaluate the smoothness of the movements performed by the controller, which is measured with the absolute variation rate (AVR) of the control actions as follows:

$$\text{AVR} = \frac{1}{F} \sum\_{i=1}^{F} \left( \sum\_{j=2}^{n} |\pi(i, j) - \pi(i, j - 1)| \right) \tag{14}$$

During the first run of trajectory 1 using the hybrid controller with SRM-V2, the actual 3UPS+RPU PR reaches an AVR of 8N, which is too high for knee rehabilitation. For this reason, the experiment on the actual PR under study only focuses on the hybrid controller with SRM-V1. This decision is also supported by the better performance shown in the simulation (see Table 4).

Table 5 shows the results of performance tracking of <sup>→</sup> *q indr* of the hybrid controller with SRM-V1 implemented on the 3UPS+RPU PR. The MAE and MAPE for experimentation are similar to the simulation results, with a low AVR ensuring smooth movements of the mobile platform. In contrast, the actual MDSR is lower than the values calculated in the simulation. The reduction in MDSR is due to the accurate measure of <sup>→</sup> *Xc* provided by the 3DTS, which is fundamental for a proper measure of the proximity to a type II singularity.

**Table 5.** Performance of the hybrid controller using SRM-V1 in the experimentation.


Figure 11 shows the measures of the two indices (*JD<sup>c</sup>* and minΩ*c*) when the actual PR is released from a singular configuration, corresponding to trajectory 1 with Ω3,4 as minΩ*c*. The variation of *JD<sup>c</sup>* and minΩ*<sup>c</sup>* before SRM-V1 is activated is due to the external force applied to the actual PR. It is important to mention that the actual PR recovers its stiffness at the end of all experiments. To the best of the author's knowledge, this is the first time that an actual PR has been driven to a type II singularity and successfully released from it by using the index Ω*i*,*j*. The results can be seen in Video 1 and Video 2 provided as Supplementary Materials of this research.

**Figure 11.** (**a**) *JD* (**b**) minΩ for trajectory 1 in the experimentation.

Figure 12 shows the reference (*r*) trajectory for *xm* in contrast to its estimation (*c*ˆ) by using the forward kinematic model and the experimental measures (*c*) based on data streaming from the 3DTS. Despite both estimated and experimental measures being calculated online, only the experimental measure detects the movement produced by the

external force applied to the PR. This verifies that when the 3UPS+RPU PR is in a type II singularity, the actual *xm* cannot be determined by solving the forward kinematic.

**Figure 12.** *xm* position for trajectory 1.

Figure 13a shows the position for limb 3, which is one of the two limbs involved in the type II singularity in trajectory 1. In this figure, the measured position (*c*) accurately tracks the desired position (*d*), which differs from the reference (*r*) only after SRM-V1 activation. Furthermore, Figure 13a clearly shows that the desired position is modified by a few millimetres from the reference to release the actual PR from the type II singularity. Finally, Figure 13b shows the smooth control actions calculated by the hybrid controller implemented on the actual PR using SMR-V1. Video 1 provides an interactive view of the results presented in Figures 12 and 13 and can be found in the Supplementary Materials Section.

**Figure 13.** (**a**) *qind* (**b**) *τ* on limb 3 for trajectory 1.

The experimental results conclude that the vision-based hybrid controller with SMR-V1 releases an actual PR from a type II singularity with minimum deviation from the original reference. In addition, the OptiTrack 3DTS allows the hybrid controller with SMR-V1 to take advantage of the features of the index Ω*i*,*j*.

#### **4. Discussion**

This study has addressed the novel task of releasing a 4-DOF PR from type II singular configuration using the index Ω*i*,*<sup>j</sup>* to identify the limbs involved in the singularity. The hybrid controller proposed combines an algebraic controller with an external computational loop that modifies the joint references only for the limbs that are causing the singularity. This mechanism can be activated whenever the robot enters into a type II singularity by measuring the *JD<sup>c</sup>* and minΩ*c*. Both *JD<sup>c</sup>* and minΩ*<sup>c</sup>* are measured based on the actual position and orientation of the mobile platform that is provided online by a OptiTrack 3DTS. The embedded sensorization includes a set of encoders attached to the motors to ascertain the joint positions.

To show the effectiveness of the designed method, several experiments have been conducted with trajectories that leave the robot in distinct singular configurations, where the releasing algorithm is activated. This scheme has been implemented in both simulation and actual settings to compare the differences in performance when moving the limbs involved (SRM-V1) or not involved (SRM-V2) in the type II singularity. The algorithm for SRM-V1 and SRM-V2 defined the movement of the actuators based on the results of minΩ*c*.

The results of the simulation in Section 3.1 clearly show that SRM-V1 makes the robot behave better in terms of all the performance measures with respect to SRM-V2. According to Table 4, SRM-V1 presents a 0.54% (4.09 mm) mean error in tracking the original reference with a mean distance travelled of 7.95 mm for releasing the PR from a type II singularity. These errors are approximately half of those obtained with SRM-V2, thus verifying that moving the actuators identified by minΩ*<sup>c</sup>* is the best option to release the 3UPS+RPU PR from a type II singularity. In fact, no trajectories were performed with the actual robot using SRM-V2, as a first experiment using this algorithm showed that the robot was struggling to get out of the singular configuration, with sharper control actions than those obtained in simulation.

Section 3.2 shows that by using knowledge of the true position and orientation of the mobile platform, the hybrid controller with SRM-V1 can successfully release the actual PR from a type II singularity. All singular trajectories were overcome, even in the cases where the mobile platform was manipulated to change its position during the standby time. The results show how the simulated and real experiments are alike, as all of the indicators for SMR-V1 are somewhat similar. These errors are proven to be dependent on the starting singular configuration, since trajectory 5 is harder for the PR to overcome.

Based on the results of simulation and experimentation, this is the first use of a visionbased hybrid controller capable of releasing a 4-DOF PR from a singular configuration. It is also notable that the effectiveness of the release from a type II singularity with a minimum deviation of the original reference depends on minΩ*c*. The smoother response of the vision-based hybrid controller is achieved because of the accurate measures of the 3DTS, making it a fundamental element of the hybrid controller. It is important to highlight that before this research, the Ω*i*,*<sup>j</sup>* had not been used as an online detector of the proximity to type II singularities for controlling purposes.

The proposed vision-base hybrid controller compensates a main drawback of PRs, and it represents a step forward towards compliant manipulation of PRs. This system improves the performance of knee rehabilitation tasks by ensuring the safety of the patient during human–robot interaction, even if the PRs arise a type II singularity.

In future research, SRM-V1 can be extended for its use in the task of type II singularity avoidance, i.e., preventing the PR from entering into a singular configuration. Although little literature exists regarding this field, the SRM-V1 algorithm offers valuable insight into the limbs that are expected to lead the robot to a type II singularity. After adding the possibility of returning to the original reference to SRM-V1, the avoidance of type II singularities could be achieved in a more reliable way than using other methods such as artificial potential fields.

**Supplementary Materials:** The following videos are available online at https://imbio3r.ai2.upv.es/ videos/TypeII\_singularities: Video 1: 4-DOF parallel robot: vision-based hybrid controller to release from a type II singularity. Trajectory 1; Video 2: 4-DOF parallel robot: vision-based hybrid controller to release from a type II singularity. Trajectory 5.

**Author Contributions:** Conceptualization, V.M., M.V., and M.U.; methodology, V.M., M.V., and J.L.P.; software, R.J.E. and J.F.; validation, V.M. and M.U.; formal analysis, V.M.; investigation, J.L.P.; resources, V.M. and M.V.; data curation, R.J.E. and J.F.; writing—original draft preparation, M.V.; writing—review and editing, J.L.P.; visualization, M.V.; supervision, V.M.; project administration, V.M. and M.V.; funding acquisition, V.M. and M.V. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the FEDER-CICYT project with reference PID2020-119522RB-I00 (ROBOTS PARALELOS DE REHABILITACION: DETECCION Y CONTROL DE SINGULARI-DADES EN PRESENCIA DE ERRORES DE MANUFACTURA), Spain.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.
