# A Practical and Effective Layout for a Safe Human-Robot Collaborative Assembly Task
## 3 Robot Control Strategy
To avoid undesired contacts between the worker and the moving links of the manipulator, nine points, divided in five clusters, have been assumed within the robot, as seen in Figure 6.  
The positions of these reference points are calculated by direct kinematics, exploiting the feedback joint degrees of freedom provided by the UR controller. The distances between the human joints and the points on the UR3 robot are then evaluated using the _kunsearch_ algorithm [38]. This algorithm, given as inputs of two sets of points \(X\) and \(Y\) (in this case the points are respectively the position vectors of the joints of the optimized skeleton and of the points of the clusters) finds the nearest neighbor in \(X\) for each query point in \(Y\) and gives as outputs the distances. Given the human-robot distances \(\mathbf{d}_{i}\), the repulsive velocities \(\mathbf{v}_{\mathbf{r}\mathbf{p},i}\) are calculated for each \(i\) cluster using the following equations:  
\[V_{i}=\ \frac{V_{MAX}}{\left(1+e^{(|\mathbf{d}_{i}|\times\frac{\rho}{\rho}-1)\alpha }\right)} \tag{1}\]  
\[\mathbf{v}_{\mathbf{r}\mathbf{p},i}=\ V_{i}\frac{\mathbf{d}_{i}}{|\mathbf{d}_{i}|} \tag{2}\]  
where \(V_{MAX}\) is the maximum value of the magnitude of the repulsive velocity, \(\rho\) is the reference distance, and \(\alpha\) is a shape factor. In this work, the magnitude \(V_{i}\) has been modelled as in Figure 7. This curve is obtained with \(V_{MAX}\) = 0.3 m/s, \(\rho\) = 0.4 m, and \(\alpha\) = 5, which have been used during the experimental phase. Concerning the value of \(\rho\) (that determines the distance between the control points on the robot and the skeleton that triggers the repulsive effect), even if it may seem quite conservative, takes into account the real dimensions of the human body and robot. In fact, \(\mathbf{d}_{i}\) are point-to-point distances, so the human body and robot dimensions have been included in the reference distance \(\rho\). Moreover, \(\rho\) also considers the position uncertainties of the operator and robot resulting from measurement tolerances of the sensing devices according to what is required by the standards. Concerning \(V_{MAX}\) and \(\alpha\), their values were chosen considering the TCP velocity during the pick-and-place phases, to obtain evasive movements of the robot from the operator which were smooth and seamless. Figure 6: Points and clusters considered on the UR3 robot. It is important to highlight that the values of the three parameters \(V_{MAX}\), \(\rho\), and \(\alpha\) used in the experimental phase result in a safe collision avoidance in the sense that they can prevent the collision with the operator, even if the algorithm described in this section does not fully respect the equations related to the SSM presented in [8]. In the technical specification, the value of the minimum human-robot distance is not constant and depends on several terms. The velocity of the human operator is one of the terms that modify the value of the minimum distance. In this work, a constant reference distance \(\rho\) was adopted and the influence of the human velocity was taken into account choosing sufficiently precautionary values of the three parameters involved in the calculation of the repulsive velocities. Concerning the repulsive velocities associated to the points of Clusters 1 and 2, the distances \(\mathbf{d}_{i}\) are the minimum human-robot distances of each cluster. Instead, concerning the TCP of the robot, which is Cluster 5 in Figure 6, the repulsive velocity \(\mathbf{v}_{rep,TCP}\) is added to the attractive velocities associated to the task to obtain the resultant velocity \(\mathbf{v}_{res,TCP}\):  
\[\mathbf{v}_{res,TCP}=\ \mathbf{v}_{rep,TCP}+\ \mathbf{v}_{task}+\mathbf{K}\times\mathbf{e} \tag{3}\]  
where \(\mathbf{v}_{task}\) is the velocity vector associated to the planned task, \(\mathbf{K}\) is a diagonal matrix, and \(\mathbf{e}\) is the error vector, which is the difference between the desired pose of the TCP and the actual one.