# EMG-Assisted Algorithm to Account for Shoulder Muscles Co-Contraction in Overhead Manual Handling
## 2 Materials and Methods
### Musculoskeletal Model  
A modified OpenSim [13] generic model [19] of the shoulder was used for this study. The model had 10 degrees of freedom (DOF) with 29 musculo-tendon units (MTU) of which 17 actuated the GH joint. Some MTUs were represented by multiple pathways, e.g., anterior, middle, and posterior deltoids. First, an uncalibrated model was created by scaling the generic model to each participant's anthropometry using marker positions during a static pose. The joint generalized coordinates and moments were calculated using inverse kinematics and inverse dynamics, respectively, while the MTUs lengths and moment arms were estimated using muscle analysis in Opensim. The trial data were batch processed using the Pyosim and Pyomeca libraries in Python [27; 28].  
A personalized model was then created by calibrating the MTU parameters of the scaled uncalibrated model. The calibration step aimed to adjust MTU parameters to minimize the sum of the inverse dynamic joint moment tracking quadratic error and the ratio of GH joint shear to compressive contact forces using a simulated annealing algorithm (See Appendix A). To this avail, the experimental EMG was used as an input of a forward dynamics analysis to predict joint moments for each given set of MTU parameters. For this step, a calibration dataset was used. This dataset consisted of one trial per subject using a 6-kg load. A penalty was applied whenever an MTU's normalized fiber length reached non-physiological values outside the range of [0.5, 1.5]. For this step, lines of action were grouped based on their function and anatomical classification. Each group received the same EMG signal. Accordingly, lines of action of the same muscle were calibrated using the same EMG signal. Teres minor was grouped with the infraspinatus, as they were expected to have similar functions [29]. Since the experimental data on muscles actuating the sternoclavicular and acromioclavicular joints was limited, we chose to focus this study on the GH joint. The DOFs of the calibrated model included only those of the GH joint, and its muscles were limited to the GH 17 lines of action. Out of these lines, only teres major and coracobrachalis were not calibrated. However, as they are not the main actuators of the GH joint, there influence on the calibration step results was expected to be minimal.  
The muscle activations and forces were estimated using three different methods:  
* Static optimization on the uncalibrated model (SO),
* Static optimization on the calibrated model (SOcal),
* EMG-assisted method on the calibrated model in CEINMS (EMGA).  
For all methods, no constraints regarding GH dislocation were implemented while predicting muscle activations. Nevertheless, the calibration process for SOcal and EMGA implicitly tuned the MTU parameters to favor a smaller shear to compressive GH joint reaction ratio during the calibration step. SO and SOcal cost function was the sum of squared activations using the algorithm implemented in Opensim. For these two methods, residual actuators were implemented at all DOFs to ensure finding a solution [30]. The last method (EMGA) sought to adjust existing experimental excitations (i.e., EMG linear envelopes) when available and to synthetize the excitations for the remaining lines of action.  
Activations were predicted from the excitations using the EMG-to-activation model described by [PERSON] and [PERSON] [31]. The adjusted and synthetized excitations simultaneously minimized three terms [32]:  
* Inverse dynamics joint moments tracking error,
* The sum of experimental excitations tracking error for all experimental excitations,
* The sum of squared excitations for the 17 lines of actions.  
These three terms were combined in a single cost function. The weighting coefficients for each term were chosen to reach a good balance between tracking joint moments and excitations, following the method explained by [PERSON] et al. [32].