# Development of a Hardware-in-the-Loop Platform for a Teleoperation Flexibility Robotic System
## 4 Simulations
### Teleoperation Simulation  
In this case study, the specifications of the position mapping method are selected based on trial and error to expand the workspace of the CDHR robot in the telerobotic system. Two parameter sets are selected, as summarized in Table 3. The workspaces corresponding to parameter sets 1 and 2 are presented in Figure 11a,b, respectively. The blue areas denote the workspace, and the red area is the singularity area. According to these figures, the workspace based on parameter set 2 is larger than that based on parameter set 1. Therefore, parameter set 2 is selected for the next step. Figure 11: Desired workspace of CDHR robot with (**a**) parameter set 1 and (**b**) parameter set 2. Figure 10: Simulation results: (**a**) trajectory planning along XYZ axes, and (**b**) error of CDHR robot. \begin{table}
\begin{tabular}{c c c c c} \hline
**The Parameter Set 1** & \multicolumn{2}{c}{**Value**} & \multicolumn{2}{c}{**The Parameter Set 2**} & \multicolumn{2}{c}{**Value**} \\ \hline \(\mathbf{K}\) & \(\text{diag}\big{(}[2\quad 4\quad 4]\big{)}\) & \(\mathbf{K}\) & \(\text{diag}\big{(}[3\quad 6\quad 6]\big{)}\) \\ \hline \(\mathbf{P_{w}}\) & \(\text{diag}\big{(}[700\quad 0\quad 0]\big{)}\) & \(\mathbf{P_{w}}\) & \(\text{diag}\big{(}[650\quad 0\quad 0]\big{)}\) \\ \hline \end{tabular}
\end{table} 
Table 3: Parameter sets 1 and 2 used for mapping. Although the workspace is improved considerably, the singularity area appears. In this area, control over the robot may be lost, which is dangerous for the objects impacted by the robot. Therefore, haptics are used to solve this problem. The parameters of the haptic algorithm are depicted in Figure 12.  
First, the position of the haptic device is initialized with the value [80; 0; 0] mm. The operator pulls the end-effector of the haptic device to a random position along the Z-axis and releases it. The position error based on the initialized position and the end-effector can be determined, and then, forces are generated based on this error that act on the end-effector to control the haptic device's return to the initialization position. Data pertaining to the force and position of the haptic device are collected through an Application Programming Interface (API) for communicating with the hardware device. Based on an observation of the response in Figure 12, we identified that the solid red line represents the proper value. This is because the respond does not have an overshoot, and the response time is better than that obtained in another case study. Therefore, the proper parameters of the haptic device are \"\(\mathbf{K_{s}}=0.33\) and \(\mathbf{C}=9\)\". A comparison between the process simulations performed using the non-haptic and haptic algorithms verified the effectiveness of the algorithms. The simulation results are depicted in Figure 13.  
In Figure 13, the solid black line represents the setpoint in the local site, that is, the coordinates obtained after using the mapping method, and the red line denotes the position response of the CDHR robot measured at the end-effector of the robot. During verification, the position of the CDHR robot oscillates in Figure 13a in the singularity area outside the safe area. In this area, the CDHR robots operates by following unknown planning, which is dangerous for humans and impacts the entire system. Moreover, the safety factor cannot be  
Figure 12: Parameters of the haptic algorithm: \(\mathbf{K_{s}}\) and \(\mathbf{C}\). Figure 13: CDHR robot in singularity region (**a**) without haptic algorithm and (**b**) with application of the haptic algorithm. ensured. Therefore, the haptic algorithm is applied to the system to prevent the occurrence of this phenomenon. The CDHR robot remains stable and does not follow the setpoint, despite the appearance of a singularity point in Figure 13b. Additionally, the responses along the X-axis and the generated force are depicted in Figure 14.  
Figure 14a depicts the position response at the end-effector of the CDHR robot.