# Seamless Human-Robot Collaborative Assembly Using Artificial Intelligence and Wearable Devices
## 3 Implementation
### Ergonomics Improvement Module (EIM)  
EIM's goal is to quantify the physical effort that the operator is putting in while actively collaborating with the robot as well as reduce the muscle strain to an acceptable level. Kinect Azure [29] sensors installed around the shopfloor track operator's body and joints. Using the RULA assessment [22], the EIM processes joint data on the fly to provide scoring of ergonomic risk factors associated with upper extremity musculoskeletal disorders (MSDs). The final outcome of the above process is to generate a grand score for each frame. In this way, the ergonomic values are being monitored during the whole duration of the assembly. Whenever a user-defined threshold is exceeded, the EIM tries to find an alternative robot pose that will allow the operator to adopt an ergonomically correct posture.  
To achieve it, an AI-based algorithm [30] comprising search and heuristic functions generates the alternative positions of the end-effector. Its main foundation lays in the selective search of the solution space, instead of using an exhaustive method. As the number of possible end-effector positions increases, the solution space becomes excessively large, which, consequently, vastly increases the computational and memory requirements of the exhaustive search method. It is important to note that the referred solution space is the set containing all possible end-effector positions that lead to feasible robot pose configurations. The operator ergonomic scores for each alternative are being calculated using the SDR simulation tools. To generate the alternatives, EIM divides the virtual 3D workspace in a grid with user-adjustable discretization. Each point of the grid is a possible new position for the robot's end-effector. The points that are outside the working envelope of the robot as well as the points that interfere with the surroundings are automatically discarded. The user can limit the solution's space to a specific volume around the current position of the end effector. By viewing the 3D space as tree-nodes (x,y,z coordinates) (Figure 4), the algorithm iteratively creates random, yet valid, groups of such nodes, noted as branches. It then extends, or'reproduces', the optimal branch, of the currently generated. The selection of the fittest branch is performed by estimating the utility value of each one, first calculating its node sequence utility value and then adding the average utility value of some of its random extensions, or'samples'. A branch's sample is a random sequence of nodes that completes said branch, as they together to form a sequence of nodes or 3D points. This procedure is configured using three, adjustable, parameters:  
* Decision horizon (DH): The size in nodes of each generated branch. The higher its value the more complex each iteration step is, as more assignments are considered and evaluated each time.
* Maximum number of alternatives (MNA): The number of branches created in each iteration. The higher its value, the closer the generated robot positions converge to the optimal solution.
* Sample rate (SR): The plethora of samples examined per generated branch. The higher its value, the better the accuracy of the predicted final utility value of the extended branch.  
Figure 4: EIM—alternatives generation—decision tree.  
For each of the alternative configurations, the expected ergonomic value is calculated by the SDR, using a virtual mannequin that is able to simulate human motion (Figure 5a). EIM generates a robot pose that provides close to optimal ergonomic score, which is then adapted by the robot in real time. It is worth noting that the virtual mannequin has, at least for now, a fixed size and cannot be adapted to the size of the operators.