Enhancing fluency and productivity in human-robot collaboration through online scaling of dynamic safety zones

Industrial collaborative robotics is promising for manufacturing activities where the presence of a robot alongside a human operator can improve operator’s working conditions, flexibility, and productivity. A collaborative robotic application has to guarantee not only safety of the human operator, but also fluency in the collaboration, as well as performance in terms of productivity and task time. In this paper, we present an approach to enhance fluency and productivity in human-robot collaboration through online scaling of dynamic safety zones. A supervisory controller runs online safety checks between bounding volumes enclosing robot and human to identify possible collision dangers. To optimize the sizes of safety zones enclosing the manipulator, the method minimizes the time of potential stop trajectories considering the robot dynamics and its torque constraints, and leverages the directed speed of the robot parts with respect to the human. Simulations and experimental tests on a seven-degree-of-freedom robotic arm verify the effectiveness of the proposed approach, and collaborative fluency metrics show the benefits of the method with respect to existing approaches.


Introduction
Nowadays, collaborative robotics is one of the enabling technologies of Industry 4.0 [1]. This paradigm allows a manipulator to work side-by-side with a human operator and to realize a safe sharing of workspace during manufacturing activities. The need of collaborative robotics application in modern manufacturing is driven by the request of flexibility of tasks and automation settings, and of rapidly variable productivity in lot sizes and time to market [2,3]. Furthermore, the introduction of collaborative robotics can reduce the incidence of occupational risks among the employees, and thus increase their working conditions, while enhancing the performance of the production line [4].
Implementing safety in a human-robot collaborative application is fundamental, and several strategies to design safe collaborative robotic workcells have been proposed in the literature [5,6]. These strategies mainly rely on the minimization of injury when human and robot in motion come in contact, or on schemes that preemptively avoid a collision.
The minimization of injury can be obtained by leveraging compliant joints with nonlinear stiffness [7], sensitive covers for robot links [8], or pre-loaded structures that dissipate contact energy [9]. On the contrary, approaches for avoiding a potential collision between operator and robot include, for instance, works that consider probabilistic predictions of the worker's motion [10], or that model robot and operator as capsules and alter on-the-fly the nominal path of the manipulator to prevent collisions with the co-worker [11]. The authors in [12] implemented an optimal path planning approach for avoiding collisions by predicting the volume occupied by an operator during the collaboration with the robot. Furthermore, a control strategy for obstacle avoidance is presented in [13], in which the predefined robot motion is modified online by means of an interpolation with Bézier curves.
Four methods of safe operation for collaborative robotic applications are introduced by the standard ISO 10218: hand guiding, safety-rated monitored stop, speed and separation monitoring, power and force limiting [14,15]. In addition, the technical specification ISO/TS 15066 supplements and supports the industrial robot safety standard, and provides additional guidance on the identified operational functions for collaborative robotics [16]. The technical specification also depicts a guideline to compute a protective separation distance.
The speed and separation monitoring (SSM) criterion is applied in [17], where the speed of the manipulator is adapted with respect to the relative motion between robot and human. In [18], a collision preventing controller predicts possible unwanted contacts with the operator and modifies the robot speed accordingly to the collision danger. In [19], bounding volumes as sphere swept lines (SSLs) are implemented to compute online proximity checks between the robot and its human co-worker. More recently, the SSLs are adopted by the authors in [20] to guarantee safety by considering path-consistent trajectories for every possible human behavior. In [21], the probability of human hand intrusion in the robot workspace is estimated using interference theory applying the SSM safety method. Furthermore, in [22] dynamically scaled safety zones implemented as SSLs are adopted to ensure a safe collaboration according to the ISO/TS 15066 and to compute stop trajectories based on a set of tentative stop times. However, the main drawback of that work is that the size of the SSLs is not continuous over time and can enlarge abruptly, affecting the collaboration negatively. Alternatively, control barrier functions are considered in [23] to ensure safety without unnecessarily limiting the manipulator speed. In [24], the authors introduce a scheme for solving the performance/safety trade-off in collaborative workspace, which accounts for safety of a predefined set of points of interests on the robot based on the interaction/collision model of [25]. More recently, in [26], an integrated mixed-reality system for safety-aware humanrobot collaboration based on a deep learning approach and on the generation of a digital twin is adopted to compute the minimum safety distance in real time. Furthermore, in [27] a computationally efficient control scheme for safe human-robot interaction is introduced. That approach is based on real-time constraints control and focuses on high dynamic environments where a manipulator moves in close proximity with a human operator and needs to avoid the unpredictable human motions.
Based on the references reported above, it emerges that in modern manufacturing, the design of collaborative robotic applications has not only to guarantee safety of the human operator, but also fluency in the collaboration, as well as performance in terms of productivity and task time [28]. Beyond considering only safety, it is therefore important to design schemes that allow the manipulator to react smartly, and achieve a smooth and successful collaboration between human and robot, otherwise the advantage of introducing a robot into the production line diminishes. A recent example can be found in [29], where efficiency in human-robot collaboration is enhanced by predicting the operator behavior with the hidden semi-Markov model in an assembly scenario.
In the context of human-robot collaboration, the performance of the coordinated meshing of shared activities between human and robot can be evaluated by means of collaborative fluency metrics. Indeed, when robots are introduced in a shared environment, it is suitable to evaluate how fluently robotic teammates could perform with their human counterparts. Collaborative fluency metrics have been introduced in [30], in the context of an anticipatory controller for shared-workspace decision processes. Subsequent works proposed several objective indexes to assess aspects of human-robot collaboration. In [31], human-robot cross-training was modeled and evaluated through different fluency metrics, such as concurrent motion, human idle time, robot idle time, and human-robot distance. The authors in [32] measured fluency in a coffee-making task, planned with different motion approaches, and applied objective metrics such as coordination time, total task time, and concurrent motion time. A codification of subjective and objective fluency metrics can be found in [33], where the author provides an analytical model of four objective metrics (human idle time, robot idle time, concurrent activity, and functional delay). Finally, in [34] a method for estimating online the quality of interaction between robot and operator is presented.
In this paper, we present an approach to guarantee safety of a human operator during the collaboration with a manipulator and, at the same time, enhance fluency and productivity in human-robot collaboration through online scaling of dynamic safety zones by building on [22,35]. This paper includes novel contributions that allow us to: (i) extend the theoretical formulation accounting for the direction of the robot towards a collision to minimize the size of the safety zones enclosing the manipulator; (ii) compare the method with other available approaches with extensive simulations; (iii) demonstrate the practical benefit of the proposed approach by considering fluency metrics for human-robot collaboration; (iv) introduce a novel task performance index named concurrent activity in the robot workspace (C-ACT-WS); and (v) perform experiments using a 7-DOF manipulator on a real collaborative scenario. To summarize, our proposed approach considers: (a) the online optimization of potential smooth stop trajectories to be traveled if a collision danger is identified; (b) the exploitation of the dynamics of the robot to minimize the stop time, and, consequently, the size of the dynamic safety zones enclosing the manipulator, while meeting joint torque limits, and accounting for the directed speed of the robot parts with respect to the human.
The paper is structured as follows: we describe in Sect. 2 the addressed problem, whereas the proposed approach is detailed in Sect. 3. The simulation results are illustrated in Sect. 4, and the experiments in Sect. 5. Finally, the conclusions are given in Sect. 6.

Problem statement
In this work, we address the problem of minimizing the size of the dynamic safety zones enclosing a manipulator, subjected to torque constraints, while performing an operation in coexistence with a human. As it will be shown below in Sect. 4, the minimization of the size of the dynamic safety zones results in a more fluent collaboration between human and robot, which, in turn, reduces the total task time of a given collaborative task and, therefore, increases productivity. During the collaborative task, the supervisory controller regularly checks online the collision danger between the manipulator links and the operator. In this regard, during robot motion, the robot system must never get closer to the operator than a protective separation distance S p , which is computed online as in [16]. The contributions of S p consider the space S r traveled by the robot during the reaction time t r , the robotic system stop distance S s during the stop time t s , the operator's change in location S h : where the term includes several error sources, i.e., the measurement tolerance of the sensing system, the uncertainty in the robot position, and the portion of the human that can intrude the sensing field before being perceived. Disturbances and noise on the estimation of human position can also be included in the term . As stated by the technical specification [16], the terms in (1) can be considered either as a constant worst-case value, or as a function of the current speed of the human or the manipulator. More in detail, the space S r k traveled by the k-th link of the robot arm from the initial time of the safety check t 0 (present or current time) to t 0 + t r is given by: where v r k is the speed of the k-th link during t r . Once t s is defined, as it will be described below in Sect. 3, the distance S s k traveled by the k-th link to come to stop is calculated as: being v k the speed of the k-th link being stopped, directed on the minimum-distance line segment with respect to the human. Finally, the term S h can be computed only once by considering a worst case, as: where v h = 1.6 m∕s is the maximum velocity that may be considered for the human by the ISO/TS 15066 [16].
In this work, we choose SSLs as bounding volumes surrounding both robot and human to verify possible unwanted contacts between them. SSLs are given by the Minkowski sum of a sphere S and a line segment P. The SSL for the kth link is defined by the end-points a k and b k of segment P k , and the radius r v , which is the minimum radius needed to enclose the geometry of the link, as shown in Fig. 1.
We define safety zones as SSLs that also account for the protective separation distance S p , and that over-approximate the space the robot needs to stop starting from its current kinematic state. Accordingly, the radius r SZ of a SSL that represents a safety zone surrounding a link is given by: After the calculation of r SZ , the possible collision between each safety zone of the robot and the SSLs enclosing the human is verified. For this purpose, the distance between The k-th part of a manipulator enclosed in a SSL and in its corresponding safety zone (light gray). On the left, a human bounding volume each couple of line segments is computed online, and checked against the radii of the two spheres corresponding to the closest points on the line segments of the human and the robot. The SSM criterion is satisfied, if the safety distance between human and robot is guaranteed, or if the manipulator is stopped.

Proposed approach
In this work, the optimization of the size of the safety zones around the robot is based on the online minimization of the stop time t s during which the manipulator is steered to stop without exceeding its torque limits nor activating the mechanical brakes. The core of the approach is the online optimization of t s that aims at computing the stop trajectory that makes the safety regions around the robot as small as possible. We compare the proposed approach with a direct implementation of the technical specification ISO/TS 15066 [16], which guarantees safety through static safety zones, and with the method in [22]. Figure 2 reports a graphical diagram of the approach presented in this work. As it can be seen from the figure, the contribution S r is first computed using (2) and the nominal trajectory from the current time t 0 to t 0 + t r . We assume that it will be required to stop the manipulator right after the reaction time of the supervisory controller. Therefore, the potential stop trajectory defined from t 0 + t r to t 0 + t r + t s is planned by optimizing the stop time t s and considering the joint torque limits of the robot as nonlinear constraints. After the definition of t s , the algorithm computes the term S s by considering the minimum-distance vector (t) , as explained below. After that, the contribution S h and the radius of each safety zone enclosing the manipulator are computed. It has to be noted that the contribution S h includes both the space covered by the human during the stop time, and the distance traveled during the reaction time, which represents the receding horizon of the collision avoidance approach.
Finally, intersection tests are run for all the safety zones of the robot against the SSLs enclosing the human. If a potential collision is identified, the stop trajectory is engaged right after the reaction time. Otherwise, the robot keeps tracking the nominal trajectory. Our method follows the indications of the ISO/TS 15066 [16] for handling the risk of collision when the robot moves. On the other hand, the technical specification does not consider collisions when the robot stops. In the following, we describe the proposed approach for optimizing the stop trajectory online and computing the contribution S s .
We consider the stop trajectory q s (t) as a five-degree polynomial planned from the current joint variables at time t 0 + t r , i.e., initial position q s,i , velocity q s,i , and acceleration q s,i , to the final joint state, chosen as q s,f = q s,i , q s,f = 0 , and q s,f = 0 . Five-degree polynomial trajectories allow us to steer the robot from the current kinematic state to the safe stop with smooth acceleration and limited jerk. Please note that the stop trajectory needs to be computed in discrete values in a real implementation.
The optimal stop trajectory q s (t) is computed by means of a numerical optimization, which is solved online within the reaction time t r . The optimization problem is defined as: subject to where w 0 and w 1 are positive weights, t s,prev is the stop time found at the previous iteration, i and i,max are the torque at the i-th joint and the maximum torque at the same joint, respectively, and N is the number of the robot DOFs. The term w 1 |t s − t s,prev | allows us to penalize large discontinuities between successive iterations that would result in sudden widening of the safety zones. If no available solution of (6) with (7) is found within t r , the worst-case stop time t s,wc is selected, which can be obtained by considering the robot specification. t s,wc also initializes t s,prev at the beginning.
The dynamics of the robot is considered to verify the torque values during the stop trajectory. More in detail, the torques during q s (t) can be computed as follows: where M(q s ) represents the mass matrix of the robot, and C(q s ,q s )q s considers the Coriolis and centrifugal terms. F v and f c are the viscous and Coulomb friction terms, respectively, whereas g(q s ) is the gravity vector. In this work, the dynamic model of the manipulator is considered to be well known 1 . However, if the available robot dynamics is uncertain or inaccurate, an alternative approach that allows one to compute online forces and torques bounds from uncertain dynamics can be adopted, e.g., using a recursive Newton-Euler algorithm based on interval arithmetic, as in [36]. In that work, it is shown that even with uncertainties, a resolution of one step of inverse dynamics is in the order of 10 −5 s on a standard computer.
The distance S s k traveled by the k-th link of the robot being stopped is computed as in (3), where we account for the maximum linear velocity of a link directed in the direction of the vector (t) , representing the minimum-distance line segment between human and robot over the stop time.
Since the proposed approach is based on the intersection of bounding volumes considered as capsules, the minimum distance between human and robot is computed between each possible couple of line segments belonging to the human and the robot, as described in [37]. The algorithm for computing the distance of two line segments is efficient and suitable for online computation, since it is based on an analytical formulation. Figure 1 shows that c h and c r are the closest points on the generic line segments of the human and the robot, respectively. During the stop trajectory, the robot is being stopped, and also the human is considered to be in motion. Therefore, both c h and c r , and the direction of (t) change over the stop time, as shown in Fig. 3. During that time interval, i.e., when t ∈ [t 0 + t r , t 0 + t r + t s ] , the position of the human is updated as if it is moving at the full speed v h towards the manipulator along (t).
The maximum linear velocity v k (t) of a link directed in the direction of (t) is obtained by considering the velocity of the spherical end-caps ȧ e k and ḃ e k . As shown in Fig. 1, a e k and b e k are the extreme points of the spherical end-caps that over-approximate the k-th link of the robot. To compute a e k and b e k , the potential stop trajectory q s (t) and its velocity q s (t) are calculated for t ∈ [t 0 + t r , t 0 + t r + t s ] . The maximum linear velocity v k of a link, directed on the minimumdistance line segment with respect to the human, for the same time interval t is given by: where the velocities of a e k and b e k are computed using forward differential kinematics, as in [35].

Comparison results
In this section, the simulated test cases and the fluency metrics for human-robot collaboration are first described. Then, the simulation test bed is illustrated. Finally, the practical benefit of the proposed approach is demonstrated through the comparison results.

Simulated test cases
To evaluate the feasibility of the proposed method, the following approaches to plan the potential stop trajectory within the reaction time t r are implemented and compared: • Approach (1): online scaling of dynamic safety zones; • Approach (2): a method based on the selection of the best stop trajectory among n tentative stop times, as in [22]; • Approach (3): an implementation of the technical specification ISO/TS 15066 [16], resulting in static safety zones.
Approach (1) consists of the optimization scheme described in Sect. 3, which is the strategy proposed in this paper. Approach (2) implements the strategy that selects the best smooth stop trajectory by considering n linearly spaced tentative stop times t s = [t s,1 , ..., t s,n ] , with t s,j < t s,j+1 for j = 1, ..., n , and t s,n ≤ t s,wc , as in [22]. The number of tentative stop times is limited to n = 10 , to cope with the available reaction time t r . Each stop trajectory is planned within t r , and the first feasible trajectory that meets the torque limits max is chosen. Even in this case, five-degree polynomial motion laws are adopted to guarantee smoothness

Fluency metrics for human-robot collaboration
The practical benefit of the proposed method is shown by considering fluency metrics for human-robot collaboration. We adopt from [33] the objective metrics of total task time and robot idle time. Furthermore, a novel task performance index named concurrent activity in the robot workspace is introduced in this paper. We also account for the number of robot stops during the prescribed task. These metrics quantitatively estimate the degree of fluency in a given humanrobot interaction, and are defined as follows: • Total task time (T-TIME): this metric consists of the total time needed for the robot to complete its motion by keeping possible safety stops and restarts into account. T-TIME is directly related to productivity. for the total number of times the robot is stopped by the supervisory controller during the prescribed task.
The novel metric C-ACT-WS has been introduced in this paper since C-ACT did not highlight the presence of the human in the robot workspace. If there were sporadic presences with most of the task performed outside the workspace, C-ACT could hide impact on the fluency perceived by the operator for the intervals of time she/he collaborates very close to the robot. High levels of C-ACT-WS can be related to a high sense of fluency and work balance in the collaborative task.

Simulation test bed
The proposed approach is validated on the 7-DOF Panda robot by Franka Emika GmbH and adopting the dynamic model identified in [38]. The simulated test bed is implemented in Simulink ® , using a laptop running Windows 10 Pro with an Intel i7-8565U CPU and 16 GB of RAM. The optimization problem (6) with (7) is solved online using the constrained nonlinear Matlab TM function fmincon and the sequential quadratic programming iterative scheme. We set to 10 the maximum number of iterations to meet real-time requirements. If the optimization function does not find a feasible solution within the reaction time t r , the worst-case scenario stop time t s,wc is selected. We consider t r = 5 ms , and a sampling time of 1 ms for the dynamic model of the manipulator and its tracking controller. For each of the three compared approaches 100 simulations are run. In these tests, the supervisory controller verifies online the separation distance between the robot performing random trajectories and a human moving around the manipulator and cyclically entering its workspace. For each simulation, five random points are defined in the joint space of the robot, and a five-degree polynomial trajectory q d (t) is planned between each couple of way points. The starting and ending velocities and accelerations are imposed to be equal to zero in each q d (t) . To evaluate the method in challenging conditions for the robot, the sequence of points is chosen in order to bring at least one joint to maximum velocity, while meeting the torque limits max of the manipulator. The travel time to reach each way point is set equal to t wp = 2 s , leading to a nominal total time of 10 s, without considering the possibility of stopping due to human intrusion. In case a safety stop of the robot occurs, a restart trajectory is engaged to steer the robot from the current kinematic state to the next way point. The restart trajectory is defined as a joint-space five-degree polynomial motion law with zero initial and final velocities and accelerations. The total time for the restart trajectory is computed analytically as the maximum between the time needed for that motion law to steer at least one joint to maximum velocity, and the time needed to steer at least one joint to maximum acceleration.
We choose four bounding volumes to enclose all the links and joints of the considered 7-DOF manipulator. However, choosing four bounding volumes instead of seven represents a reasonable approximation to speed up online calculations without introducing excessive conservativeness in the case considered in this work. Furthermore, a self-collision avoidance algorithm is implemented based on the same four bounding volumes that tightly over-approximate the robot.
The evaluation of the proposed method is carried out first of all with simulated humans, i.e., by realizing a deterministic and replicable motion model for the human that brings its speed to the limits that may be considered according to [16]. In this manner, different approaches for safe human-robot interaction can be evaluated and compared using exactly the same human motion over time. The simulated human is modeled as a simplified kinematic tree with a chest, a head, and two arms with 4-DOF, as shown in Fig. 4. For the sake of simplicity, the wrist and hand movement have been excluded, as in [39]. Six bounding volumes have been defined to encapsulate the human, whose dimensions are chosen according to the anthropometric estimates of the 95-th percentile of British adults aged 19-65 years [40]. In this way, at each iteration of the supervisory controller, the minimum distance between human and robot is found online as the minimum of the 24 distances between the six human line segments and the four of the robot.
The human is moved along an arbitrarily chosen rectangular path with a length of 4.00 m and a width of 2 r ws , where r ws = 0.855 m is the maximum horizontal reachability of the arm from the robot base reference frame. The geometry of that path is chosen in order to simulate cyclical intrusions of the human in the workspace of the robot during the random motion of the manipulator. In this way, the compared approaches are tested with a high number of random intrusions in which the relative motion between human and robot is not defined a priori. At each corner of the path, the human model rotates ∕2 rad . The motion law for the human is defined by means of four consecutive trapezoidal speed profiles that bring its speed v h to 1.6 m/s. The total time for the human to complete the rectangular path is set equal to 10 s. However, in the numerical tests where at least one safety stop of the robot occurs, the human keeps moving on its path and cyclically entering the robot workspace until the robot end effector has not reached the last way point. Figure 5 shows the architecture of the robot supervisory controller. In the figure it can be seen that the hypothesis on the basis of this work considers the knowledge of the desired trajectory prescribed to the robot, the robot kinematic and dynamic parameters, its torque limits, and the human position and bounding volumes. In the block diagram, the intersection test verifies if the desired trajectory q d should be traveled by the manipulator ( = 1 ), or if the optimal stop trajectory q s should be engaged ( = 0 ). Finally, the tracking controller supplies the robot with the torques values for all the seven joints on the basis of the measured joint positions q m and velocities q m . Figure 6 reports exemplary frames of one of the 100 performed simulations with the three compared approaches in which the human cyclically intrudes in the robot workspace, while the manipulator performs random trajectories. Frames with shaded background denote safety stops of the robot. From Fig. 6(a), it appears evident that the sizes of the safety zones in Approach (1) are smaller than those in Approach (2), and further increase in size if Approach (3) is considered. For that exemplary simulation (Fig. 6(d)), it can be seen that the T-TIME is equal to 13.37 s for Approach (1) (only 3.37 s late with respect to the nominal robot task time of 10 s), to 18.19 s for Approach (2), and to 28.81 s for Approach (3), due to the increasing time the robot is stopped by the supervisory controller scrolling through the three approaches. To better appreciate the online scaling of the dynamic safety zones, a video of the robot performing an exemplary trajectory is     Fig. 7(e) it can be seen that the radii of the dynamic safety zones change according to the dynamic scaling performed online with the proposed strategy. Furthermore, when a potential collision is identified, the robot engages a trajectory that steers the robot to stop while respecting the joint torque limits, as it is shown in Fig. 7(c) and (d). From Fig. 7(e), it can be seen that the safety zones r SZ occupy a restricted portion of the robot workspace, since they show values of the radius lower than the maximum horizontal reachability of the arm r ws = 0.855 m during the whole trajectory. Therefore, a human can safely enter the  Fig. 7 workspace of the robot during its operation. This is also testified by the novel fluency metric C-ACT-WS introduced in this paper, as it is described below. Figure 8 reports the human position variables with respect to the robot base reference frame over the task time for the example simulation of Fig. 7. The human keeps moving on its path and cyclically entering the robot workspace until the manipulator has reached the last way point. Figure 9 shows five frames of the robot traveling the test trajectory of Fig. 7 and the dynamic safety zones computed with Approach (1) for t = 0.00 , 0.50, 1.00, 1.50, and 2.00 s. Figure 10 shows the box plot representation of the simulation results, where the three approaches to compute the potential stop trajectory within the reaction time are compared. In the box plots, the central mark indicates the median, the bottom and top of each box represent the first and third quartiles, whereas the whiskers extend to the most extreme data not considered outliers. For each of the 100 simulations, the root mean square values for the stop time and the radii of the safety zones are computed and reported in aggregate form in Fig. 10(a) and (b). In this figure, Approach (3) is not shown since it presents fixed values equal to 0.40 s and 1.583 m, for the stop time and the radii of the safety zones, respectively. The box plot results for the fluency metrics T-TIME, R-IDLE, C-ACT-WS and R-STOPS are shown in Fig. 10(c)-(f). Furthermore, Table 2 reports the quantitative metrics for stop time, radii of the safety zones, and fluency metrics for human-robot collaboration, as mean, standard deviation, minimum and maximum values across the 100 simulations for each of the three compared approaches.  . 9 Frames of the robot performing the test trajectory of Fig. 7, and dynamic safety zones computed with Approach (1) Fig. 10 and Table 2, it can be seen that the values of stop time and radius of the safety zones are considerably lower for Approaches (1) and (2) with respect to the basic implementation of the technical specification ISO/ TS 15066, which results in static safety zones. Furthermore, the optimal scaling of dynamic safety zones implemented in Approach (1), which also accounts for the direction of the robot towards a collision, further reduces both the time required by the manipulator to come to a safe stop, as well as the size of the safety zones, with respect to Approach (2).

Results of comparative simulations
The results of the f luency metrics shown in Fig. 10(c)-(f) allow us to further analyze the comparison results. The total task time for both Approaches (1) and (2) is considerably lower than Approach (3). In particular, the robot is able to complete the task faster with Approach (1) with respect to Approach (2), showing that the optimal scaling of safety zones we propose reduces the total time required by the robot to reach the five prescribed way points. R-IDLE is lower for Approach (1), indicating that the robot is inactive for a lower percentage of the total task time. The values for this metric rise slightly for Approach (2), and considerably for Approach (3), with whom R-IDLE is equal to the 60.6% of the total task time. Furthermore, the concurrent activity in the robot workspace indicates that with our proposed approach (Approach (1)) robot and human can be concurrently active for up to the 81.8% of the time the human enters the robot workspace at least partially. C-ACT-WS assumes a mean value of 80.4% with Approach (2). On the contrary, no concurrent activity is possible if an approach based on static safety zones is implemented, since the radii of the safety zones enclosing the robot would be always greater than r ws . Finally, in Fig. 10(f) the number of robot stops during the prescribed task is shown. With Approach (3) the robot is stopped three times in all the simulations, since it can be active only when the human is moving outside the robot workspace on the farthest side of its rectangular path, and it is stopped for all the remainder time. This results in T-TIME with a mean value equal to approximately 29 s, i.e., the human moves around the robot for almost three cycles before the robot can complete its task.
On the contrary, with Approach (2) the mean number of robot stops is equal to 10.0. This value is further reduced to 5.9 if Approach (1) is considered. Finally, Fig. 11 reports the box plot representation of the comparison results showing the maximum torques of the robot during a stop for the three approaches. The joint torque limits equal to 87 and 12 Nm, for the first four joints and for the last three, respectively, are always respected during the numerical simulations. The maximum available torques resulting with Approach (1) are closer to the limits with respect to the other two comparison approaches, especially for the first and the second joints. This shows that the optimization problem solved online in (6) with (7) allows the robot to better exploit the full range of available torques during a safety stop.

Experiments
To verify the effectiveness of the proposed approach on a real collaborative scenario, the method is implemented on a 7-DOF Franka Emika manipulator, available at the Laboratory for Artificial Intelligence for Human-Robot Collaboration (AI4HRC) at the University of Udine (Italy). The robot has a reachability of 855 mm and can hold a payload of 3 Kg. A workstation running Ubuntu 18.04 LTS Bionic Beaver with an Intel i5-10600k and 32 GB of RAM has been adopted. The robot is controlled using ROS Melodic Morenia (Robot Operating System) with Python.
To track the position of the human online, we adopt a Intel ® RealSense TM Depth Camera D435. The camera has a depth field of view of 87 • × 58 • , a depth output resolution  [40]. The human joint coordinates, acquired in the camera reference frame, are then transformed in the robot reference frame, in order to compute the distance between each couple of human and robot line segments in a consistent reference frame. For this purpose, the human joint coordinates are first transformed into a marker reference frame, by means of the ArUco open-source library based on OpenCV that provides a marker detection in real time [41,42]. Then, the joint coordinates are transformed in the robot reference frame with a proper marker-to-robot calibration.
The optimization problem is implemented with the opensource tool for nonlinear optimization CasADi [43]. The use of this tool requires the recursive Newton-Euler inverse dynamics of the robot to be written in a symbolic form. For this reason, we adopt urdf2casadi, a software library for computing functions of the robot dynamics that can be adopted with symbolic expressions in the CasADi framework, based on a URDF description of the robot [44]. The parameters of the dynamic model of the Franka arm have been taken from the model that was experimentally verified in [38].
For a simpler implementation on the real robot, we consider the minimum-distance line segment (t) constant during the stop time. Therefore, the maximum linear velocity v k of a link is computed as in (9) using the same (t) during the stop time. This assumption does not introduce a significant error, as we experienced in our experiments. Figure 12 shows six frames of an example experiment in which a human subject performs a cyclical motion around the robot so as to intrude in the robot workspace while the manipulator is performing a task. A video of this example experiment is reported in the supplementary material of the paper. The approach proposed in this work is general, meaning that the robot could perform any task, as for instance, assembly, pick-and-place, gluing or packaging operations. However, to ensure generality in the applicability of the proposed approach, a random joint-space nominal trajectory is performed by the manipulator during the experiment. The corresponding trajectory of the robot is shown in Fig. 13, where the joint positions, velocities, radii of the safety zones, and stop time obtained using Approach (1) are reported over time. Safety stops of the robot are denoted as shaded areas.
For comparison, Approaches (2) and (3) are also implemented experimentally. The total task time with the three different methods is evaluated with an additional experiment and an arbitrarily selected task for the human, which considered the same task execution instructions in all three cases. More in detail, the motion of the human is designed so as to cyclically intrude in the robot workspace, while the robot performs a random motion with a nominal duration of 30 s. The experimental results of this example test report a total task time equal to 37.80 s for Approach (1), 51.45 s for Approach (2), and 96.31 s for Approach (3). The proposed approach allows us to achieve a percentage improvement To summarize, our method shows better performance in terms of total task time with respect to the considered alternative approaches, and demonstrates the benefits of the online scaling of dynamic safety zones also at experimental level. Furthermore, as testified by the metrics for humanrobot collaboration, the proposed approach is promising for enhancing fluency and productivity in manufacturing applications where the presence of human alongside the manipulators is required.

Conclusion
In this paper, we presented an approach to enhance fluency and productivity in collaborative robotics through online scaling of bounding volumes considered as dynamic safety zones. Unlike other approaches, the directed speed between the robot parts and the human, the robot dynamics and its torque limits are here taken into account to plan online the trajectories that minimize the stop time. The strategy has been validated on a case study with extensive simulations in which the supervisory controller verifies online the separation distance between a robot performing random trajectories and a human moving around the manipulator and cyclically entering its workspace.
A comparison with an existing method that defines a smooth stop trajectory by simply considering n linearly spaced tentative stop times, and with an approach that considers an implementation of the technical specification ISO/ TS 15066 has been performed. Furthermore, the application of existing objective fluency metrics for collaborative robotics, with the novel introduction of a new one named concurrent activity in the robot workspace, has shown the practical benefit and the effectiveness of the proposed approach with respect to the other benchmarks. Finally, the proposed approach has been experimentally tested with online computations on a 7-DOF Franka Emika Panda arm.
Future developments of this work will consider alternative strategies for the search of the best t s and the solving of the optimization problem. Moreover, promising extensions of the proposed method could include other approaches for the trajectory planning subjected to kinematic and dynamic constraints [45], as well as for the definition of the final joint configuration of the robot at the end of the stop trajectory. Finally, the method could also be adapted for mobile manipulators to provide safety and enhance fluency and  (1)