###### Abstract
Yet, because of their paper-based nature, they are imprecise and time-consuming [24]. Time-of-flight cameras and other vision-based person-tracking technologies allow automated posture assessment. They provide an inexpensive technique to evaluate the ergonomics of the operator on the work floor. In addition to human kinematics sensing, a variety of models have been developed to measure the body's dynamics [25; 26; 27]. Due to their intricacy, however, such models are usually impossible to construct online and may only be used offline. In this work, we propose a novel framework for postural optimization that improves worker comfort. In this framework, we attempt to find the optimal location for the robot's end-effector by the Particle Swarm Optimization (PSO) algorithm to reduce the ergonomics to the most optimal value [28]. The PSO algorithm is a better fit for our work as compared to other intelligent algorithms because of its simplicity, high execution efficiency, and ability to handle nonlinear problems. Additionally, it avoids the need for complicated mathematical formula derivations and parameter selection [29]. The ergonomic value is measured by the REBA (Rapid Entire Body Assessment) score system because it provides a quantitative, rapid, and brief explanation of a posture's overall ergonomic status [30]. There is no restriction in using the calculation method of ergonomics during human-robot collaboration, and according to the needs of the research, other measurement methods such as RULA (Rapid Upper Limb Assessment) or OWAS can be used. While there are various methods available for evaluating the risk of musculoskeletal disorders, the REBA method was chosen since it can give a quantitative measure for the ergonomic state of the worker's posture. Another reason for choosing REBA is because we want a full body posture assessment. Since the value of the REBA score in the lower limb was always equal to 1 and the users in this study were always in a standing position while working with the robot, we omitted the calculation of the lower limb. We conducted a user study with 20 participants to validate the proposed method in an assembly task, which is the most widely used type of task in human-robot collaboration in the industry. The collaborative task was set up in a virtual reality environment (VR) since it allows developers to quickly establish and test the many interactive scenarios before actually building them. Another advantage is safety due to the lack of physical risks associated with interacting with real robots, especially at the early stages of system development. Other advantages are low cost and no robot maintenance costs [31; 32; 33]. Additionally, the virtual environment provides a close-to-reality simulated environment to study task performance in work environments and workers' ergonomics [34; 35]. The rest of the paper is organized as follows. The problem statement is formulated in Section 2. The methodology is described in Section 3. The implementation is detailed in Section 4, including the human-robot collaborative task, hardware, and software. The user study to validate the proposed method is presented in Section 5. The discussion and conclusion are given in Sections 6 and 7.