*2.2. Original Work*

This research work explores the integration of machine learning algorithms into a discrete event controller as a trigger function in order to accomplish a better performance in the overall assembly cycle.

Three main challenges have been addressed in this work:


The main contribution of this paper is the methodology for evaluating contact state classification using one and two force/torque sensors as a single feature vector for a single controller. Few works use two sensors to feed two separate controllers, meanwhile most of the literature presents the use of only one sensor. Our approach considers a twelve component vector to increase the number of features to input data into the DNN classifier.

It has been found that the second sensor helps the systems perform better on contact state recognition. This methodology also considers the Success Ratio evaluation of the peg-in-hole assembly cycle. An increase in performance due to the use of machine learning classifiers was demonstrated. An automated robot cell sequence for assembly was modeled as a discrete event system. We found that, using this methodology instead of standard automation logic, the discrete event controller is able to overcome positioning errors in more assembly cycles.

#### **3. Methodology**

The methodology used in this research is based on an automated assembly cycle, such as a real manufacturing environment. To simplify the investigation, only the final assembly stage is considered, when the robot has picked up the parts, carried them to approach closely and executed the final assembly.

The problem to be analyzed assumes the existence of a positioning error or misalignment between the peg and the hole. This error during the attempt to assemble causes a high force contact state and a stop command to the robot in order to avoid damage.

Therefore, in a traditional automation system, an error recovery sequence must be programmed to deal with unexpected situations. In this case, when using force/torque sensors, one of the great issues to address is the nonlinear behavior during the constrained motion. This makes it difficult to estimate the positioning error.

The methodology is summarized as follows: an error recovery sequence inspired by human behavior is defined. A positioning error region is defined and selected according to the force/torque measurements caused by the interaction forces. The contact states are defined to simplify the experiment. A classification problem is defined where DNN are proposed.

To train the DNN, a data set is gathered running the error recovery sequence with a finite number of positioning errors. The data sets are used to train the DNN models and other machine learning algorithms for comparison purposes. The DNN trained model is evaluated using different data sets. Finally, the DNN models are integrated into the automatic sequence. The methodology is tested by running the assembly cycle a certain number of times to determine the assembly success ratio.

The error recovery sequence is shown in Figure 1. A similar approach was considered in [7]. A positioning error is defined empirically as in [23,32]. Considering how a human would approach recovery form positioning error, the following actions can be described in six stages:


**Figure 1.** Assembly Sequence. (**a**) Frontal contact. (**b**) New orientation. (**c**) Perform lateral search. (**d**) Orientation for assembly. (**e**) Insertion. (**f**) Adjustment during insertion.

These stages can be represented as an assembly sequence modeled as a discrete event system (DES). This model simplifies the control strategy that will facilitate the constraint motion commands [33]. The discrete events are graphically represented based on Petri-Nets as in [21]. This helps visualize the sequence of actions considered in the control strategy.

#### *3.1. Positioning Error*

The positioning error can be described as the sum of positioning inaccuracies during the initial actions of the process [34]. This can be considered a random positioning error that in normal circumstances would cause a fatal error in an automated sequence or rejection of the assembled product. The next equation describes the positioning error:

$$
\hat{p}\_p = p\_p + e \tag{1}
$$

where *p*ˆ*<sup>p</sup>* is the sum of the random error *e* and the desired position *pp*. *e* as a position vector according to the deviation from the center of the hole can be described as follows:

$$e = [e\_x \ e\_y \ e\_z \ e\_n \ e\_\beta \ e\_\gamma]^T \tag{2}$$

The error *e* has an infinite number of values. To simplify the investigation in this research, a finite number of values are defined. In some works, such as [16] one finds the use of only four error positions around the hole but of different distances along the orthogonal axis in the plane. In [23], eight regions are selected based on experimentation. For this research, eight defined positioning errors in the orthogonal plane to the assembly direction are considered. We will use these defined positions to show how the controller decides in which direction to move after the first impact and classification of the contact state.

The direction of insertion is along the Y axis, so the X-Z plane is where the eight positioning errors are defined. Then the error vector *e* is simplified as

$$e = \begin{bmatrix} \mathbf{e}\_x \ \mathbf{e}\_z \end{bmatrix}^T \tag{3}$$

The eight defined errors can be expressed in polar notation as *er* = 4*mm* , *θ* = *i* × 45◦, where *er* is the magnitude, *θ* is the angle, and *i* is a number from 0 to 7 corresponding to one of the defined error positions. Figure 2a shows a graphical representation of the error positions around the hole, and Figure 2b shows the representation of the peg with a positioning error in the +*Z* axis direction.

**Figure 2.** X-Z plane (**a**) Eight locations around the hole. (**b**) Peg with +Z positioning error.

The simplification of the positioning errors leads one to consider this problem a supervised learning classification problem where machine learning algorithms can be used.
