*2.1. Modeling in CoppeliaSim Edu*

An open kinematic chain model was created in CoppeliaSim Edu, in Figure 2, composed of modules featuring 6 degrees of freedom.

**Figure 2.** A model created in CoppeliaSim Edu.

The purpose of this model was especially calculating the inverse task from an arbitrary spatial trajectory the effector is to travel under 37 s. Joint coordinate vector data *ϕ* = [*ϕ*1, *ϕ*2,... , *ϕ*6] <sup>T</sup> are obtained using a sampling period of *T*sp each 0.005 s. The only (software-imposed) limitation is the degree of freedom itself, namely the possibility of rotation in the <−π, +π> interval. This problem had to be subsequently addressed since it was causing a discontinuity in the simulation's operation as per the condition (18) and was thus disrupting the continuity of the trajectory on the models in the environments into which data were imported., i.e., Matlab, SolidWorks, but the same would have been the case in other environments, too.

#### *2.2. Modeling in Matlab*

The kinematic model in Figure 3 was created in Matlab using the Simscape/Multibody toolbox, the dimensions of which reflect the reality and are given in Table 1. The module diameter or volume need not be of interest when making a kinematic assessment, as it has no effect on kinematic parameters.

**Figure 3.** Model created in Matlab-Simulink using the Simscape/Multibody toolbox.

The model is composed of individual blocks that define its parts. In a nutshell, the model consists of a base identical to the "base" of the reference system and the individual blocks representing the *ri* vector (a kinematic chain segment). As we can see in Figure 1, the "vector *r* I" block then consists of the "URM" module and a passive joint part. The modules are connected in places where each joint represents its own Cartesian system of the module, starting in point *Oi*. In this experiment, the last part of the passive joint, vector *r*7, was considered to be an effector. A measuring device (sensor 7) is connected to the effector *r*7, checking physical quantities (position, velocity, acceleration). Such measuring devices can be mounted on other modules, too. The Euler's angles' values are also available in three consecutive rotations around the axes, often marked *ZYX*. The values apply to the effector and are the result of the final product of the individual spatial transformations

(8), as is usually the case with the open kinematic chain [27]. A model constructed in this way is then visualized in the Mechanics explorer window and appears in the form as seen in Figure 4.

**Table 1.** Dimensions table of the robotic arm of Figure 2 and also Figure 3, Figure 4, respectively.


<sup>1</sup> Effector (last part of the passive joint).

**Figure 4.** (**a**) Model visualization with hints of dimensions in Matlab-Simulink using the Simscape/Multibody toolbox. (**b**) Detail URM with a passive joint.

#### *2.3. The Problem of a Sudden Change in Data Continuity and Its Solution in Matlab*

The task was to use the computational core of CoppeliaSim Edu and apply it to the inverse kinematic task, to calculate the joint coordinates of *ϕ* = [*ϕ*1, *ϕ*2, ... , *ϕ*6] <sup>T</sup> for the entered trajectory. When the joint coordinates data were imported, in some cases, the above-mentioned problem with value repolarization emerged as a result of the softwareimposed limitation on the joint rotation. In other words, in the case of a requirement arising from the calculation, the range of the degree of freedom upon exceeding the rotation values in the <−π, +π> interval must be switched to the value with the opposite sign to remain in the defined working interval. The values above the upper limit +π will rise again, but this time starting with the lower value of −π. Moreover, the opposite values below the lower limit −π will fall again, this time starting from the upper value of +π. This sudden change causes deformation or even computational instability of the *p*<sup>7</sup> trajectory of the effector, see

Figure 5. With time derivations of the position, the characteristics of instantaneous velocity and accelerations are deformed even more.

**Figure 5.** Illustration of the *p*<sup>7</sup> = [*p*7x, *p*7y, *p*7z] <sup>T</sup> position vector (effector) depending on the joint coordinate vector *ϕ* = [*ϕ*1, *ϕ*2, *ϕ*3, *ϕ*4, *ϕ*5, *ϕ*6] <sup>T</sup> and its effect on the trajectory: (**a**) before repolarization; (**b**) after repolarization; the value of the joint coordinate vector depending on time *ϕ* = [*ϕ*1, *ϕ*2, *ϕ*3, *ϕ*4, *ϕ*5, *ϕ*6] T; (**c**) before repolarization; (**d**) after repolarization; effect on the trajectory; (**e**) before repolarization; (**f**) after repolarization.

Since the precision of the trajectory traveled by any manipulator is critical in practical applications, it was necessary to somehow address this problem. Either through a laborintensive rewriting of the imported data upon each change in the defined trajectory subject to the presence of those repolarizations in the joints or through a suitable solution. One such solution is the so-called repolarize, described below.

#### *2.4. Composing a Repolarize*

The search for a suitable and undemanding solution to this situation rested on the following conditions:


For these reasons, we were trying to apply different approaches in the simulation, starting with a change in the initial data *ϕ* = [*ϕ*1, *ϕ*2, *ϕ*3, *ϕ*4, *ϕ*5, *ϕ*6] T, which was very labor-intensive. The rate limiter has not met the expectations either [28] in switching the data flow at the moment of reaching the limits of the angles of rotation +/−π, because the characteristics of the *p*<sup>7</sup> trajectory were undulated anyway. Rate limiter is a marginalized derivation of an infinitely small difference to a difference of finite size. Or similar approaches based on a sequential omission of the undesired sample, such as in [29]. Or through averaging the values [30,31]. Neither of the approaches mentioned in this case has met our expectations. The best, if not ideal, results were finally achieved by the system working on this principle Figure 6 and explained in Figure 7. Joint coordinate data were measured in the sampling period *T*sp every 0.005 s.

When the data were uploaded, it was first necessary to establish the moment of repolarization *t*<sup>r</sup> with the precision of *δ* = +/−0.0025 s when the variable *ϕ*(*t*) = 0, i.e., cuts through the time axis. Under the assumption of reaching the upper or the lower working interval limit <−π, +π> of the joint coordinate. The variable at the output from the repolarize is *ϕout*(*t*). It was necessary to meet the following conditions:

$$t \le t\_1 | \varphi\_{out}(t) = \varphi(t) \tag{15}$$

$$t\_1 < t\_2 \tag{16}$$

**Figure 7.** Plotted repolarization of rotation in the joint.

Conditions for identification of the sign and carrying out repolarization over time *tr*:

$$t \ge t\_2 \left| \varphi\_{out}(t) = \begin{cases} 2\pi - \varrho(t), \ \varrho(t) < 0 \\ \varrho(t) - 2\pi, \ \varrho(t) > 0 \end{cases} \right. \tag{17}$$

For the condition that can be considered discontinuation in the angle variable data *ϕ(t)*, the following applies:

$$\frac{\left|\varphi\left(t+T\_{sp}\right)-\varphi(t)\right|}{T\_{sp}} = \frac{2\pi}{T\_{sp}}\tag{18}$$

The model was thus "excited" by the values of the joint coordinate vector *ϕ*(*t*)=[*ϕ*1(*t*), *ϕ*2(*t*), . . . , *ϕ*n(*t*)]T obtained from the model created in CoppeliaSim Edu in the period of time *T*sp. Under the condition of the prescribed maximum permissible deviation [Δmax x, Δmax y, Δmax z] = +/−0.0035 m between the real trajectory and the one calculated on the basis of inverse kinematics. The data of joint coordinates *ϕ*(*t*) correspond to the effectors of the trajectory traveled. The trajectory is made of a system of fixed points *A*s{*x*As, *y*As, *z*As}, where the sample *s*-<1; 7383> in Cartesian space Figure 8. Its real shape is shown in Figure 2.

**Figure 8.** A vector difference **Δ** between the calculated position of the position vector of the *p*<sup>7</sup> effector and the position of the *A*s points.

The mutual calibration of the models was done for the initial position of the robotic arm effector over time *t* = 0 s, *ϕ*(0) = [0, π, 0, *π*, 0, *π*] <sup>T</sup> radians see position in Figure 4, *p*<sup>7</sup> = [0.167397, 0, 1.102644]<sup>T</sup> meters. In order to check the models' correctness, the vector difference Δ = [Δ*x*, Δ*y*, Δ*z*] <sup>T</sup> between the position of the position vector effector *p*<sup>7</sup> = [*p*7x, *p*7y, *p*7z] <sup>T</sup> and the position of the *A*<sup>s</sup> points, composing the trajectory, shown in the graph of Figure 9 (Matlab), Figure 12 (SolidWorks) over the period of time *T*sp. This

was done for each vector component. The following applies to Δ vector components, its norm Δ and the instantaneous time *t* of the sample in seconds:

Δ*<sup>x</sup>* = *xAs* − *p*7*x*(*ϕ*) (19)

$$
\Delta\_y = y\_{As} - p\_{\overline{\gamma}y}(\overline{\pm}) \tag{20}
$$

$$
\Delta\_z = z\_{As} - p\_{7z}(\mathfrak{p}) \tag{21}
$$

$$t = 0.005(s - 1)|s \in \langle 1; 7383 \rangle \tag{22}$$

$$\|\mathbf{A}\| = \sqrt{\Delta\_x^2 + \Delta\_y^2 + \Delta\_z^2} \tag{23}$$

**Figure 9.** (**a**) The chart showing the difference Δ*x*, Δ*y*, Δ*<sup>z</sup>* between the real trajectory (composed of the *A*s{*xAs*, *yAs*, *zAs*} points) and the one calculated (from the components of the position vector effector *p*7x, *p*7y, *p*7z) in Matlab; (**b**) norm (size) of the vector **Δ**.

As we can see, the CoppeliaSim Edu software complied with the tolerance range requirement +/− 0.0035 m for each vector component, for the inverse calculation of the joint coordinate data *ϕ*(*t*) with respect to the trajectory consisting of a finite set of *A*<sup>s</sup> points. The characteristics of physical quantities from sensor 7 in the model see Figure 3 (position, velocity, acceleration) are shown in Figure 10. We note that this is a different data set (different trajectory) than the one used in the illustration of Figure 5.

**Figure 10.** Effector values measured in Matlab: (**a**) position vector *p*<sup>7</sup> = [*p*7x, *p*7y, *p*7z] <sup>T</sup> depending on the joint coordinate vector *ϕ*(*t*); (**b**) velocity vector *v*<sup>7</sup> = [*v*7x, *v*7y, *v*7z] <sup>T</sup> depending on the joint coordinate vector *ϕ*- (*t*); (**c**) acceleration vector *a*<sup>7</sup> = [*a*7*x*, *a*7*y*, *a*7*z*] <sup>T</sup> depending on the joint coordinate vector *ϕ*--(*t*) and (*ϕ*- (*t*))2; (**d**) Euler's angles (*γ, β*, *α*) depending on the joint coordinate vector *ϕ(t).*

#### *2.5. Modeling in SolidWorks*

In order to carry out structural changes, various structural compositions of the robotic arm composed of the URM modules are created in SolidWorks are shown in Figure 11. This mechanically detailed model corresponding to the reality was in the same dimensional configuration Table 1, as was used for making a comparison of kinematic indices and also the Δ*x*, Δ*y*, Δ*<sup>z</sup>* difference between the real and the calculated trajectory.

**Figure 11.** Model created in SolidWorks.

In this case, too, the graph of Figure 12 has confirmed that the requirement for a tolerance range of +/−0.0035 m for each vector component was adhered to by the inverse calculation of the joint coordinate data *ϕ*(*t*) with respect to the trajectory composed of a finite set of the *A*s points.

**Figure 12.** (**a**) A graph showing the Δ*x*, Δ*y*, Δ*<sup>z</sup>* difference between the real trajectory (composed of *A*s{*x*As, *y*As, *z*As} points) and the one calculated (from the components of the position vector effector *p*7x, *p*7y, *p*7z) in SolidWorks; (**b**) norm (size) of the vector Δ.

Here, however, certain changes in the shape of the course can be observed, which is logical, as we are dealing with two different software environments and the model structure itself as well. The norm, i.e., the size of the vector of deviation from the original trajectory Δ already has a permanent value of 0.0025 m here, and no significant minima can be seen in the three places where the trajectory "breaks" see Figure 2. The characteristics of physical quantities corresponding to the effector in the model see Figure 11 (position, velocity) are illustrated in Figure 13.

**Figure 13.** Effector values generated in SolidWorks: (**a**) position vector *p*<sup>7</sup> = [*p*7x, *p*7y, *p*7z] <sup>T</sup> depending on the joints coordinate vector *ϕ*(*t*); (**b**) velocity vector *v*<sup>7</sup> = [*v*7x, *v*7y, *v*7z] <sup>T</sup> depending on the joints coordinate vector *ϕ*- (*t*).

As we can see, the characteristics of position and velocity alike Figure 13a,b, corresponding to the effector in the model of Figure 11, are similar to the characteristics shown in Figure 10a,b.

#### **3. Results**

The robotic arm model was created in CoppeliaSim Edu in order to obtain the joints coordinates, corresponding to a description of the spatial trajectory consisting of the fixed points *A*s{*xAs*, *yAs*, *zAs*} with a permissible deviation of +/−0.0035 m from the original trajectory.

Results obtained in Matlab are shown in Figures 9 and 10. Figure 9 shows the difference Δ*x*, Δ*y*, Δ*<sup>z</sup>* between the real trajectory (consisting of the *A*s{*xAs*, *yAs*, *zAs*} points) and the one calculated (from the components of the position vector effector *p*7*x*, *p*7*y*, *p*7*z*). On the other hand, Figure 10 shows the values measured on the effector, namely:


Figure 5 shows the importance of using the repolarize. Otherwise, the joint coordinate data must be edited manually prior to their import, as was the case with SolidWorks.

The results obtained in SolidWorks are shown in Figures 12 and 13. Figure 12 shows the Δ*x*, Δ*y*, Δ*<sup>z</sup>* difference between the real trajectory (consisting of the *A*s{*xAs*, *yAs*, *zAs*} points) and the one calculated (from the position vector effector components of *p*7*x*, *p*7*y*, *p*7*z*). On the other hand, Figure 13 shows the values generated on the effector, namely:


#### **4. Discussion**

Based on the above results, we can conclude that the currently available software environments offer not only relatively powerful visualization tools but also those enabling various kinds of physical computations. The quality of results depends not only on the sophistication of the software and its preferable use but also on correct parameter specification, on the defined conditions and on the application of the software to its maximum potential. The aim of our work was especially to enable the comparison of data from the position kinematics in Matlab and in SolidWorks, subject to the same initial joint coordinate vector *ϕ*(*t*). This has enabled us to check the designed models and to detect eventual structural discrepancies such as counter-rotation of the URM module or an undesirable shift of structural elements.

Matlab made it possible to choose the manner of processing the imported data, to align the sampling step with the CopeliaSim imported data step and thus ensure that a particular input datum actually corresponded to the given output value over the same time. It was possible to additionally construct a system to accommodate some changes in the input data Figure 6 and thus to make the work involved in input data changes more effective. The difference between the real and the calculated trajectory was quantified using the **Δ** vector. Figure 9b shows that the vector size **Δ** reaches its maxima at the maximum effector velocities.

In SolidWorks, the difference between the real and the calculated trajectory **Δ** was already different in nature; see Figure 12. Here, the **Δ** vector size has a permanent value and changes only slightly; no significant minima are observed here in the places where the trajectory "breaks", as shown in Figure 2.

**Author Contributions:** Draft concept and formal analysis, J.S., M.Š., Š.O.; model design and data processing in CoppeliaSimEdu, Z.B.; model design and data processing in Matlab, Š.O.; model design and data processing in SolidWorks, M.Š. and L.H.; supervision, methodology and project administration, J.S., J.D., P.D., T.S. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was supported by the Slovak Research and Development Agency under Contract no. APVV-18-0413. This paper was prepared with the support of the grant project KEGA 025TUKE-4/2019.

**Conflicts of Interest:** The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

### **Abbreviations**

List of the most important quantities:


## **References**

