scieee AI-readable full text Open interactive document viewer

NARX neural network for safe human-robot collaboration using only joint position sensor

Sharkawy, Abdel-Nasser,Ali, Mustafa M.

Abstract

EconStor is a publication server for scholarly economic literature, provided as a non-commercial public service by the ZBW.

Full text

Sharkawy, Abdel-Nasser; Ali, Mustafa M. Article NARX neural network for safe human-robot collaboration using only joint position sensor Logistics Provided in Cooperation with: MDPI – Multidisciplinary Digital Publishing Institute, Basel Suggested Citation: Sharkawy, Abdel-Nasser; Ali, Mustafa M. (2022) : NARX neural network for safe human-robot collaboration using only joint position sensor, Logistics, ISSN 2305-6290, MDPI, Basel, Vol. 6, Iss. 4, pp. 1-16, https://doi.org/10.3390/logistics6040075 This Version is available at: https://hdl.handle.net/10419/310284 Standard-Nutzungsbedingungen: Die Dokumente auf EconStor dürfen zu eigenen wissenschaftlichen Zwecken und zum Privatgebrauch gespeichert und kopiert werden. Sie dürfen die Dokumente nicht für öffentliche oder kommerzielle Zwecke vervielfältigen, öffentlich ausstellen, öffentlich zugänglich machen, vertreiben oder anderweitig nutzen. Sofern die Verfasser die Dokumente unter Open-Content-Lizenzen (insbesondere CC-Lizenzen) zur Verfügung gestellt haben sollten, gelten abweichend von diesen Nutzungsbedingungen die in der dort genannten Lizenz gewährten Nutzungsrechte. Terms of use: Documents in EconStor may be saved and copied for your personal and scholarly purposes. You are not to copy documents for public or commercial purposes, to exhibit the documents publicly, to make them publicly available on the internet, or to distribute or otherwise use the documents in public. If the documents have been made available under an Open Content Licence (especially Creative Commons Licences), you may exercise further usage rights as specified in the indicated licence. https://creativecommons.org/licenses/by/4.0/ Citation: Sharkawy, A.-N.; Ali, M.M. NARX Neural Network for Safe Human–Robot Collaboration Using Only Joint Position Sensor. Logistics 2022,6, 75. https://doi.org/10.3390/ logistics6040075 Academic Editors: Ieva Meidut˙ e- Kavaliauskien˙ e, ¸Semsettin Çi˘gdem and Renata ˇ Cinˇcikait˙ e Received: 27 June 2022 Accepted: 12 October 2022 Published: 18 October 2022 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. Copyright: © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). logistics Article NARX Neural Network for Safe Human–Robot Collaboration Using Only Joint Position Sensor Abdel-Nasser Sharkawy 1,2,* and Mustafa M. Ali 1 1Mechatronics Engineering, Mechanical Engineering Department, Faculty of Engineering, South Valley University, Qena 83523, Egypt 2Mechanical Engineering Department, College of Engineering, Fahad Bin Sultan University, Tabuk 47721, Saudi Arabia *Correspondence: [email protected] or [email protected] Abstract: Background: Safety is the very necessary issue that must be considered during human-robot collaboration in the same workspace or area. Methods: In this manuscript, a nonlinear autoregressive model with an exog-enous inputs neural network (NARXNN) is developed for the detection of collisions between a manipulator and human. The design of the NARXNN depends on the dynamics of the manipulator’s joints and considers only the signals of the position sensors that are intrinsic to the manipulator’s joints. Therefore, this network could be applied and used with any conventional robot. The data used for training the designed NARXNN are generated by two experiments considering the sinusoidal joint motion of the manipulator. The first experiment is executed using a free-of-contact motion, whereas in the second experiment, random collisions by human hands are performed with the robot. The training process of the NARXNN is carried out using the Levenberg–Marquardt algorithm in MATLAB. The evaluation and the effectiveness (%) of the developed method are investigated taking into account different data and conditions from the used data for training. The experiments are executed using the KUKA LWR IV manipulator. Results: The results prove that the trained method is efficient in estimating the external joint torque and in correctly detecting the collisions. Conclusions: Eventually, a comparison is presented between the proposed NARXNN and the other NN architectures presented in our previous work. Keywords: human–manipulator collaboration; collision detection; NARX neural network; joint position sensor; training and testing; evaluation and effectiveness 1. Introduction During the collaboration between a human and manipulator, safety is the most relevant issue that needs to be considered in the procedural design. This is because when the human is close to the manipulator, injuries are expected to happen. Therefore, a safety system must exist for the robotic manipulator. The main challenge is to implement a cheap system, and at the same time, it should be easily adapted to the robot and have high effectiveness. Safety is also taken into accounts in the control system design of human–robot collaboration (HRC). Researchers have put forth many efforts to develop a system for HRC safety, whether as a collision avoidance method or as a collision detection method. The classifications of these methods are presented in Figure 1. Collision avoidance methods depend on the depth sensors and vision system, as presented in Refs. [ 1 – 6 ]. A proximity sensor-based approach was also proposed by Lam et al. in [ 7 ]. In this approach, five sensors of contactless and capacitive types and implemented antennas were used. These types of methods need modifications in the robot’s body, and the cost of the sensors is high. Logistics 2022,6, 75. https://doi.org/10.3390/logistics6040075 https://www.mdpi.com/journal/logistics Logistics 2022,6, 75 2 of 16 Logistics 2022, 6, x FOR PEER REVIEW 2 of 16 Figure 1. The classification of the safety methods of HRC. Collision avoidance methods depend on the depth sensors and vision system, as presented in Refs. [1–6]. A proximity sensor-based approach was also proposed by Lam et al. in [7]. In this approach, five sensors of contactless and capacitive types and implemented antennas were used. These types of methods need modifications in the robot’s body, and the cost of the sensors is high. Collision detection methods are classified into two types: model-based and databased. Model-based methods depend mainly on the dynamic parameters of the robot’s model, whereas the data-based methods are based on data. The proposed approach in the current paper is a data-based method; therefore, most of our concentration focuses on these types of methods. Model-based methods are classified into two approaches: disturbance observer and impedance control law-based methods. In [8,9], the disturbance observer was presented. The approach depends on the signals of the torque sensors of the manipulator’s joints. Thus, this method could be applied and uses only collaborative robotic manipulators that contain joint torque sensors. Morinaga and Kosuge in [10] developed a collision-detection method depending on the impedance controller. Their approach used the torque signal (the error between the actual and the desired input torques of the robotic manipulator). The problems with the methods based on the robot’s model are that these methods are inaccurate and uncertain because there is uncertainty in the dynamic parameters determination [11–14]. Therefore, this negatively influences the effectiveness of the method to detect the collisions, and the fault alarms are increased [11]. In addition, the calculations of the inverse dynamics are very complex [15]. Data-based methods were considered for collision detection between a human and a manipulator. These methods depend on fuzzy logic and neural networks. In [16], Dimeas et al. used the fuzzy-logic-based method for collision detection. Their system was designed depending on the signals of both the joint position and the torque sensors. Their method was applied to a 2-DOF planar robot, and it was efficient in detecting the collisions. However, it can only be applied and used with the collaborative robots that contain a joint torque sensor. Furthermore, they used one fuzzy system for each joint, which means that they needed seven fuzzy systems if they applied their method to a 7-DOF robot. Therefore, this is very complex and needs more time and effort. In [14], S. Lu and his group used the NN-based approach for the detection of collisions. Their developed Different HRC Safety Methods Collision Avoidance Vision System Proximity Sensor Collision Detection Model-Based Disturbance Observer Impedance Control Law Data-Based Fuzzy Logic Neural Networks Figure 1. The classification of the safety methods of HRC. Collision detection methods are classified into two types: model-based and databased. Model-based methods depend mainly on the dynamic parameters of the robot’s model, whereas the data-based methods are based on data. The proposed approach in the current paper is a data-based method; therefore, most of our concentration focuses on these types of methods. Model-based methods are classified into two approaches: disturbance observer and impedance control law-based methods. In [ 8 , 9 ], the disturbance observer was presented. The approach depends on the signals of the torque sensors of the manipulator’s joints. Thus, this method could be applied and uses only collaborative robotic manipulators that contain joint torque sensors. Morinaga and Kosuge in [ 10 ] developed a collision-detection method depending on the impedance controller. Their approach used the torque signal (the error between the actual and the desired input torques of the robotic manipulator). The problems with the methods based on the robot’s model are that these methods are inaccurate and uncertain because there is uncertainty in the dynamic parameters determination [ 11 – 14 ]. Therefore, this negatively influences the effectiveness of the method to detect the collisions, and the fault alarms are increased [ 11 ]. In addition, the calculations of the inverse dynamics are very complex [15]. Data-based methods were considered for collision detection between a human and a manipulator. These methods depend on fuzzy logic and neural networks. In [ 16 ], Dimeas et al. used the fuzzy-logic-based method for collision detection. Their system was designed depending on the signals of both the joint position and the torque sensors. Their method was applied to a 2-DOF planar robot, and it was efficient in detecting the collisions. However, it can only be applied and used with the collaborative robots that contain a joint torque sensor. Furthermore, they used one fuzzy system for each joint, which means that they needed seven fuzzy systems if they applied their method to a 7-DOF robot. Therefore, this is very complex and needs more time and effort. In [ 14 ], S. Lu and his group used the NN-based approach for the detection of collisions. Their developed system was designed based on the history of the joint angles of the manipulator and the two external sensors (the base, and the wrist force/the torque sensors). Their method was investigated using 1-DOF and 2-DOF robotic manipulators. The effectiveness in the calculations of their method was presented by executing only one collision by the manipulator, but it was not investigated by using many random collisions. Kim et al., in [ 17 ], proposed a versatile modularized NN to Logistics 2022,6, 75 3 of 16 detect collisions with a collaborative manipulator. The momentum observer torques were required for their method. In [ 18 ], four NN architectures were proposed: the auto regressive NN, the recurrent NN (RNN), the convolutional long short-term memory NN (CLSTMNN) and the mixed CLSTMNN. These architectures were designed based on position, velocity, and motor current. In our previous work presented in [ 19 – 24 ], four NN architectures were designed and trained for the collision detection. These architectures were (1) multilayer feedforward NN having one hidden layer (MLFFNN-1), (2) multilayer feedforward NN having two hidden layers (MLFFNN-2), (3) the cascaded forward NN (CFNN), and (4) the recurrent NN (RNN). MLFFNN-1 was developed using both the position and torque sensors that are intrinsic to the manipulator’ joints. Thus, the application of this structure is only with the collaborative robotic manipulators that possess joint torque sensor. The experimental investigation of this structure was applied to the 1-DOF, 2-DOF planar, and 3-DOF robotic manipulators. The other three structures (MLFFNN-2, CFNN, and RNN) were developed using the position sensor only of the manipulator’s joint. Thus, the applications of these structures are with any conventional robot. MLFFNN-2 was investigated experimentally using 1-DOF and 2-DOF planar robotic manipulators, whereas CFNN and RNN were investigated experimentally using the 1-DOF manipulator. The effectiveness and the performance measure of these architecture were presented in different conditions and used different data from the training ones. From this discussion, a data-based method is a desirable solution for the detection of robot collisions with humans. This type of method should avoid the explicit knowledge of the dynamic parameters of the robot model and the complex calculations of the inverse dynamics. Furthermore, it should be applied to any conventional robot, and its effectiveness (%) must be presented with the use of many different conditions and cases. The work of the current paper is considered as an extension to our previous work presented in [ 19 – 24 ]. The main contribution and novelty of the current paper is discussed as follows. A NARXNN is developed to detect human–manipulator collisions. The NARXNN is designed depending only on the signals of the position sensors that are intrinsic to the manipulator’s joints. This qualifies the proposed method to be used with any conventional robot. The training of the designed NARXNN is executed using data with and without collisions and using Levenberg–Marquardt learning. The knowledge of the dynamic parameters of the robot model such as the inertia forces, the Coriolis and centrifugal forces, and the gravitational forces, is not needed in the proposed method, and these parameters are not available in most of the current robots. The test and the verification of the trained NARXNN are carried out using the same data that are used for the training. Furthermore, its effectiveness is investigated using different data and conditions from the training ones, considering many random collisions with the manipulator. The experiments are performed using KUKA LWR IV manipulator considering only one joint’s motion. However, the method can be applied with all joints of the robotic manipulator. The obtained results reveal that the trained NARXNN is an efficient method in estimating and detecting the collisions. A comparison is presented between the developed NARXNN and other previous NN architectures discussed in [ 19 , 20 ]. In addition, a comparison with other previously published methods is executed. The rest of this manuscript is outlined as follows. Section 2discusses the dynamics of the manipulator joints, why the NN is used, and the followed methodology/steps in the current work to detect the collision. Section 3shows the design of the proposed NARXNN, and Section 4illustrates the training and the testing of the designed NARXNN using the same data. Section 5discusses the trained NARXNN’s evaluation considering many random collisions with the manipulator and using different data and conditions from the training ones. In Section 6, a comparison between the NARXNN and other NN architectures used for detecting the collisions is presented. Finally, Section 7provides the main points that are discussed in this manuscript with some future work. Logistics 2022,6, 75 4 of 16 2. Dynamics of Manipulator Joints The external torque of the manipulator’s joint τext is determined from the dynamics equation of the manipulator as follows [25,26]: τext =M(θ).. θ+Cθ,. θ. θ+G(θ)−τ(1) The symbols used in this equation are defined in Table 1. Table 1. The meaning of the symbols used in the dynamic Equation (1). Symbol Meaning θ∈RnA vector representing the positions of the manipulator joints . θ∈RnA vector representing the velocities of the manipulator joints .. θ∈RnA vector representing the accelerations of the manipulator joints M(θ)∈Rn×nThe inertia matrix of the manipulator Cθ,. θ∈Rn×nThe Coriolis and centrifugal matrix of the manipulator G(θ)∈RnThe gravity vector of the manipulator τ∈RnThe actuator torque of the manipulator joints nThe number of the links or the joints of the manipulator As discussed in the introduction part, the parameters of this equation are not known in most of the current robots. This leads to difficulty in determining the external joint torque [ 15 ]. Furthermore, the techniques depending on the dynamic robot model are uncertain and inaccurate [ 11 – 14 ]. Therefore, this negatively influences the effectiveness for the detection of the collisions that occur between the human and manipulator. According to this, a method depending on the NN’s structure is developed to save human–manipulator collaboration. The NN is efficient in approximating any function, whether linear or nonlinear [ 27 – 29 ]. In addition, it can be generalized under different conditions. The NN-based approach solves the inverse dynamics problems of the manipulator efficiently [ 30 – 32 ]. From the different NN architectures, NARXNN is proposed. NARXNN is the dynamic and recurrent NN, and it possesses the connections of feedback enclosing several network layers [ 33 , 34 ]. The structure of this NN is the nonlinear generalization of the well-known ARX models. This NN predicts the time series very well [ 35 , 36 ] and is widely used with the nonlinear dynamic systems [37,38]. In the current work, this NARXNN is trained using the Levenberg–Marquardt (LM) algorithm. The LM algorithm [ 39 , 40 ] is a second-order optimization method that has the advantage of fast convergence. In addition, it approximates the method of Newton. The LM algorithm can achieve a fast learning speed of the method of classical Newton and at the same time the convergence of the gradient descent [ 39 , 41 ]. Compared with other training algorithms, LM converges with less repetitions/iterations and in a shorter time. However, this algorithm needs larger data. For solving this issue, enough data are used in the current work. The followed steps and methodology with the proposed NARXNN for the detection of the robot collisions with humans are presented in Figure 2. All these steps are discussed in detail in the next sections. Logistics 2022,6, 75 5 of 16 Logistics 2022, 6, x FOR PEER REVIEW 5 of 16 Figure 2. The followed steps and methodology with the proposed NARXNN. 3. NARXNN Design In this section, the design of the NARXNN for the detection of the robot collisions with humans is presented in detail. The same sinusoidal motion presented in the previous work [19,20] is used here in the current work. This motion is executed using frequencies that are variable and are commanded to the E1′s joint of the KUKA LWR IV manipulator, as shown in Figure 3. Two experiments are considered. In the first experiment, the motion of the robot joint is free of contact, whereas in the second experiment, the human hand performs some random collisions with the robot during its motion. Figure 3. The setup for experiments with the KUKA LWR IV robot. This figure is taken from our previous work presented in [19,20]. The NARXNN is designed depending only on the positions’ sensors that are intrinsic to the manipulator’s joint. Therefore, the application and the use of this method are for any conventional robot. The main criteria to select the inputs of the NARXNN to achieve Step 1 NARXNN Design Step 2 NARXNN Training [Using Data with and without collision] Step 3 Trained NARXNN Testing and Verification Step 4 Trained NARXNN Evaluation (%) [Using different data and conditions and many random collisions] Using Data without collision: threshold (𝜏)is defined Using Data with collision: The collision is investigated based on threshold (𝜏) E1 Joint Figure 2. The followed steps and methodology with the proposed NARXNN. 3. NARXNN Design In this section, the design of the NARXNN for the detection of the robot collisions with humans is presented in detail. The same sinusoidal motion presented in the previous work [ 19 , 20 ] is used here in the current work. This motion is executed using frequencies that are variable and are commanded to the E1 0 s joint of the KUKA LWR IV manipulator, as shown in Figure 3. Two experiments are considered. In the first experiment, the motion of the robot joint is free of contact, whereas in the second experiment, the human hand performs some random collisions with the robot during its motion. Logistics 2022, 6, x FOR PEER REVIEW 5 of 16 Figure 2. The followed steps and methodology with the proposed NARXNN. 3. NARXNN Design In this section, the design of the NARXNN for the detection of the robot collisions with humans is presented in detail. The same sinusoidal motion presented in the previous work [19,20] is used here in the current work. This motion is executed using frequencies that are variable and are commanded to the E1′s joint of the KUKA LWR IV manipulator, as shown in Figure 3. Two experiments are considered. In the first experiment, the motion of the robot joint is free of contact, whereas in the second experiment, the human hand performs some random collisions with the robot during its motion. Figure 3. The setup for experiments with the KUKA LWR IV robot. This figure is taken from our previous work presented in [19,20]. The NARXNN is designed depending only on the positions’ sensors that are intrinsic to the manipulator’s joint. Therefore, the application and the use of this method are for any conventional robot. The main criteria to select the inputs of the NARXNN to achieve Step 1 NARXNN Design Step 2 NARXNN Training [Using Data with and without collision] Step 3 Trained NARXNN Testing and Verification Step 4 Trained NARXNN Evaluation (%) [Using different data and conditions and many random collisions] Using Data without collision: threshold (𝜏)is defined Using Data with collision: The collision is investigated based on threshold (𝜏) E1 Joint Figure 3. The setup for experiments with the KUKA LWR IV robot. This figure is taken from our previous work presented in [19,20]. The NARXNN is designed depending only on the positions’ sensors that are intrinsic to the manipulator’s joint. Therefore, the application and the use of this method are for any conventional robot. The main criteria to select the inputs of the NARXNN to achieve the Logistics 2022,6, 75 6 of 16 high performance of the NN are (1) the smallest mean squared error (MSE), and therefore (2) the smallest training error. There are three inputs, and they are defined as follows: (1) The current position error of the joint e θ(k) , presenting the difference between the desired and the actual value of the joint’s position; (2) The previous position error of the joint e θ(k−1); (3) The actual velocity of the joint . θac(k). The actual velocity of the joint is obtained from the KUKA robot controller (KRC). However, this velocity could be determined via the numerical differentiations of the joint’s position. The inputs for the case of a collision and for the in case of free-of-contact motion are shown in Figure 4. Logistics 2022, 6, x FOR PEER REVIEW 6 of 16 the high performance of the NN are (1) the smallest mean squared error (MSE), and therefore (2) the smallest training error. There are three inputs, and they are defined as follows: (1) The current position error of the joint 𝜃(𝑘), presenting the difference between the desired and the actual value of the joint’s position; (2) The previous position error of the joint 𝜃(𝑘−1); (3) The actual velocity of the joint 𝜃󰇗𝑎𝑐(𝑘). The actual velocity of the joint is obtained from the KUKA robot controller (KRC). However, this velocity could be determined via the numerical differentiations of the joint’s position. The inputs for the case of a collision and for the in case of free-of-contact motion are shown in Figure 4. (a) (b) Figure 4. The selected inputs of the designed NARXNN. (a) The current error of the joint’s position. (b) The actual velocity of the joint. Figure 4. The selected inputs of the designed NARXNN. (a) The current error of the joint’s position. (b) The actual velocity of the joint. In Figure 4, the red color curves represent the inputs in the case there is a collision, whereas the blue color curves represent the inputs in the case there is no collision. The Logistics 2022,6, 75 7 of 16 spikes marked by the small blank circle represent the collisions. More details about these inputs are found in our previous work in Ref. [19]. The NARXNN architecture includes three types of layers as in the following order: the layer of input, the layer of hidden neurons that is nonlinear, where its activation function is the hyperbolic tangent (tanh), and the layer of output that is also nonlinear, where its activation function is the hyperbolic tangent (tanh). The output layer estimates the external joint torque τ0 ext . The input delay vector is [0 1] , and the output delay vector is [1 2] . This proposed architecture is presented in Figure 5. The equations representing the feedforward part of the NARXNN are given as follows. Logistics 2022, 6, x FOR PEER REVIEW 7 of 16 In Figure 4, the red color curves represent the inputs in the case there is a collision, whereas the blue color curves represent the inputs in the case there is no collision. The spikes marked by the small blank circle represent the collisions. More details about these inputs are found in our previous work in Ref. [19]. The NARXNN architecture includes three types of layers as in the following order: the layer of input, the layer of hidden neurons that is nonlinear, where its activation function is the hyperbolic tangent (tanh), and the layer of output that is also nonlinear, where its activation function is the hyperbolic tangent (tanh). The output layer estimates the external joint torque 𝜏 󰆒. The input delay vector is 󰇟0 1󰇠, and the output delay vector is 󰇟1 2󰇠. This proposed architecture is presented in Figure 5. The equations representing the feedforward part of the NARXNN are given as follows. Figure 5. The developed NARXNN structure. The inputs are the current error of the position, the previous error of the position, and the actual velocity of the joint. The output is the estimated external joint’s torque. The output of the hidden neuron 𝑗 that is in the hidden layer is given by 𝑦=𝜑ℎ=𝜑󰇭𝑤   𝑥+(𝑐𝜏 󰆒(𝑘−1)󰇮 (2) where 𝑥 represents the inputs to the NN. 𝑥=1, 𝑥=𝜃 (𝑘), 𝑥=𝜃 (𝑘−1), and 𝑥= 𝜃󰇗(𝑘). 𝜏 󰆒(𝑘−1) is the previous value of the estimated external joint of NARXNN. 𝑤 is the weight between the input 𝑖 and the hidden neuron 𝑗, and 𝑐 is the weight between the input 𝜏 󰆒(𝑘−1) and the hidden neuron 𝑗. The activation function of the hidden layer is given by 𝜑ℎ=tanhℎ (3) The estimated external torque by the NARXNN, 𝜏 󰆒, is calculated by 𝜏 󰆒= 𝜓(𝑂 )=𝜓󰇭𝑏   𝑦 󰇮=tanh󰇭𝑏   𝑦 󰇮 (4) where 𝑏 is the weight between the hidden neuron 𝑗 and the estimated output of the NARXNN. The external joint’s torque 𝜏 is given/provided by KRC and is used only for training the designed NARXNN architecture. In any other type of robot where 𝜏 is not given/existing, the external collision’s force can be measured by any type of external force sensor. The error of training 𝑒(𝑡) must be very small. This error is calculated from the following equation: 𝑒(𝑡)=𝜏−𝜏 󰆒 (5) The training process of the designed NARXNN architecture is discussed in detail in the next section. Figure 5. The developed NARXNN structure. The inputs are the current error of the position, the previous error of the position, and the actual velocity of the joint. The output is the estimated external joint’s torque. The output of the hidden neuron jthat is in the hidden layer is given by yj=ϕjhj=ϕj 3 ∑ i=0 wjixi!+ (cj1τ0 ext(k−1)!(2) where xi represents the inputs to the NN. x0= 1, x1=e θ(k) , x2=e θ(k−1) , and x3=. θac(k) . τ0 ext(k−1) is the previous value of the estimated external joint of NARXNN. wji is the weight between the input i and the hidden neuron j , and cj1 is the weight between the input τ0 ext(k−1)and the hidden neuron j. The activation function of the hidden layer is given by ϕjhj=tanhhj(3) The estimated external torque by the NARXNN, τ0 ext, is calculated by τ0 ext =ψk(O) = ψk n ∑ j=0 b1jyj!=tanh n ∑ j=0 b1jyj!(4) where b1j is the weight between the hidden neuron j and the estimated output of the NARXNN. The external joint’s torque τext is given/provided by KRC and is used only for training the designed NARXNN architecture. In any other type of robot where τext is not given/existing, the external collision’s force can be measured by any type of external force sensor. The error of training e(t) must be very small. This error is calculated from the following equation: e(t) = τext −τ0 ext (5) The training process of the designed NARXNN architecture is discussed in detail in the next section. Logistics 2022,6, 75 8 of 16 4. NARXNN Training Then Testing In this section, the training process of the designed NARXNN is presented. In addition, the test of this trained NN structure is investigated. The following steps and methodology in these processes are summarized as follows: (1) Collect the data with and without collisions from the experiments with the KUKA LWR robot. (2) Initialize the parameters of the NARXNN and select the suitable number of hidden neurons. (3) Train the designed NARXNN, using the collected data with and without collisions. (4) After the training is completed, check the performance of the NARXNN by investigating the resulting MSE. (5) If the resulting MSE is a high value and is not satisfactory, go again to step 2. (6) If the resulting MSE is very small and close to zero (satisfactory), perform the following: â 6.1 Test the trained NARXNN by using the data without collisions that is used for training and check the training/approximation error. â 6.2 If this training/approximation error is a low value and is satisfactory, calculate the collision threshold and then go to step 7. â 6.3 If this training/approximation error is a high value and is not satisfactory, go again to step 2. (7) Test the trained NARXNN using the data with collision that is used for the training process and check the collisions using the determined collision threshold. (8) Check the effectiveness (%) of the trained NARXNN by performing many random different collisions with the robot based on the determined collision threshold. All these steps are discussed and presented in detail in this section and the next sections. The collected data from the executed experiments of the KUKA LWR manipulator in the first case where the motion has no collisions and in the second case where the collisions exist are used for training the designed NARXNN. The training occurs using the LM algorithm in MATLAB and using Intel(R) Core(TM) i5-8250U CPU @ 1.60 GHz processor. The number of pairs of input–output that are collected and used for the training process are 56358. These data are divided randomly into three parts: the first part comprising 80% is for training, the second part comprising 10% is used to make the validation, and the last part also comprising 10% is used to make the testing process. After investigating many different initializations of weights and many different numbers of the hidden neurons for finding the best parameters that achieve the high performance of the NARXNN, we obtained the following: (1) The hidden neuron number was 25. (2) The iteration/repetition number was 1000. (3) The lowest MSE was 0.34353. The equation used for calculating this MSE is given as follows: MSE =∑n i=1 (τext(i)−τ0 ext(i))2 n(6) (4) The training time was 34 min and 28 s. This time had no importance because the important aim is to obtain a very well trained NARXNN that can detect and identify the robot’s collisions with humans efficiently. In addition, the training occurs offline. The resulting MSE from the training process of the designed NARXNN is presented in Figure 6. As shown in Figure 6, the resulting MSE is low and settles at the value of 0.34353. This proves that the designed NARXNN is trained well and is qualified for estimating the external joint’s torque. Logistics 2022,6, 75 15 of 16 10. Morinaga, S.; Kosuge, K. Collision Detection System for Manipulator Based on Adaptive Impedance Control Law. In Proceedings of the 2003 IEEE International Conference on Robotics & Automation, Taipei, Taiwan, 14–19 September 2003; pp. 1080–1085. 11. Jung, B.; Koo, J.C.; Choi, H.R.; Moon, H. Human-robot collision detection under modeling uncertainty using frequency boundary of manipulator dynamics. J. Mech. Sci. Technol. 2014,28, 4389–4395. [CrossRef] 12. Min, F.; Wang, G.; Liu, N. Collision Detection and Identification on Robot Manipulators Based on Vibration Analysis. Sensors 2019,19, 1080. [CrossRef] [PubMed] 13. Indri, M.; Trapani, S.; Lazzero, I. Development of a Virtual Collision Sensor for Industrial Robots. Sensors 2017 ,17, 1148. [CrossRef] 14. Lu, S.; Chung, J.H.; Velinsky, S.A. Human-Robot Collision Detection and Identification Based on Wrist and Base Force/Torque Sensors. In Proceedings of the 2005 IEEE International Conference on Robotics and Automation, Barcelona, Spain, 18–22 April 2005; Volume i, pp. 796–801. 15. Cho, C.; Kim, J.; Kim, Y.; Song, J.-B.; Kyung, J.-H. Collision Detection Algorithm to Distinguish Between Intended Contact and Unexpected Collision. Adv. Robot. 2012,26, 1825–1840. [CrossRef] 16. Dimeas, F.; Avendano-valencia, L.D.; Aspragathos, N. Human–Robot collision detection and identification based on fuzzy and time series modelling. Robotica 2014,33, 1886–1898. [CrossRef] 17. Kim, D.; Lim, D.; Park, J. Transferable Collision Detection Learning for Collaborative Manipulator Using Versatile Modularized Neural Network. IEEE Trans. Robot. 2021,38, 2426–2445. [CrossRef] 18. Czubenko, M.; Kowalczuk, Z. A simple neural network for collision detection of collaborative robots. Sensors 2021 ,21, 4235. [CrossRef] 19. Sharkawy, A.-N.; Aspragathos, N. Human-Robot Collision Detection Based on Neural Networks. Int. J. Mech. Eng. Robot. Res. 2018,7, 150–157. [CrossRef] 20. Sharkawy, A.-N.; Mostfa, A.A. Neural Networks’ Design and Training for Safe Human-Robot Cooperation. J. King Saud Univ. Eng. Sci. 2021, 1–15. [CrossRef] 21. Sharkawy, A.-N.; Koustoumpardis, P.N.; Aspragathos, N. Manipulator Collision Detection and Collided Link Identification based on Neural Networks. In Advances in Service and Industrial Robotics. RAAD 2018. Mechanisms and Machine Science; Nikos, A., Panagiotis, K., Vassilis, M., Eds.; Springer: Cham, Switzerland, 2018; pp. 3–12. 22. Sharkawy, A.-N.; Koustoumpardis, P.N.; Aspragathos, N. Neural Network Design for Manipulator Collision Detection Based only on the Joint Position Sensors. Robotica 2020,38, 1737–1755. [CrossRef] 23. Sharkawy, A.-N.; Koustoumpardis, P.N.; Aspragathos, N. Human–robot collisions detection for safe human–robot interaction using one multi-input–output neural network. Soft Comput. 2020,24, 6687–6719. [CrossRef] 24. Sharkawy, A.-N. Intelligent Control and Impedance Adjustment for Efficient Human-Robot Cooperation. Doctoral Dissertation, University of Patras, Patras, Greece, 2020. 25. Murray, R.M.; Li, Z.; Sastry, S.S. A Mathematical Introduction to Robotic Manipulation; CRC Press: Boca Raton, FL, USA, 1994; ISBN 9780849379819. 26. Sharkawy, A.N.; Koustoumpardis, P.N. Dynamics and computed-torque control of a 2-DOF manipulator: Mathematical analysis. Int. J. Adv. Sci. Technol. 2019,28, 201–212. 27. Haykin, S. Neural Networks and Learning Machines, 3rd ed.; Pearson: London, UK, 2009; ISBN 9780131471399. 28. Nielsen, M.A. Neural Networks and Deep Learning; Determination Press: San Francisco, CA, USA, 2015; Available online: http: //neuralnetworksanddeeplearning.com/ (accessed on 18 May 2022). 29. Sharkawy, A.-N. Principle of Neural Network and Its Main Types: Review. J. Adv. Appl. Comput. Math. 2020 ,7, 8–19. [CrossRef] 30. Smith, A.C.; Hashtrudi-Zaad, K. Application of neural networks in inverse dynamics based contact force estimation. In Proceedings of the 2005 IEEE Conference on Control Applications, Toronto, ON, Canada, 28–31 August 2005; pp. 1021–1026. 31. Patiño, H.D.; Carelli, R.; Kuchen, B.R. Neural Networks for Advanced Control of Robot Manipulators. IEEE Trans. Neural. Networks 2002,13, 343–354. [CrossRef] 32. Goldberg, K.Y.; Pearlmutter, B.A. Using a Neural Network to Learn the Dynamics of the CMU Direct-Drive Arm II; Carnegie Mellon University: Pittsburgh, PA, USA, 1988. 33. Leontaritis, I.J.; Billings, S.A. Input-output parametric models for non-linear systems Part I: Deterministic non-linear systems. Int. J. Control 1985,41, 303–328. [CrossRef] 34. Boussaada, Z.; Curea, O.; Remaci, A.; Camblong, H.; Bellaaj, N.M. A nonlinear autoregressive exogenous (NARX) neural network model for the prediction of the daily direct solar radiation. Energies 2018,11, 620. [CrossRef] 35. Mohanty, S.; Patra, P.K.; Sahoo, S.S. Prediction of global solar radiation using nonlinear auto regressive network with exogenous inputs (narx). In Proceedings of the 2015 39th National Systems Conference, NSC 2015, Greater Noida, India, 14–16 December 2015. 36. Pisoni, E.; Farina, M.; Carnevale, C.; Piroddi, L. Forecasting peak air pollution levels using NARX models. Eng. Appl. Artif. Intell. 2009,22, 593–602. [CrossRef] 37. Zibafar, A.; Ghaffari, S.; Vossoughi, G. Achieving transparency in series elastic actuator of sharif lower limb exoskeleton using LLNF-NARX model. In Proceedings of the 4th RSI International Conference on Robotics and Mechatronics, ICRoM 2016, Tehran, Iran, 26–28 October 2016; pp. 398–403. Logistics 2022,6, 75 16 of 16 38. Bouaddi, S.; Ihlal, A.; Ait mensour, O. Modeling and Prediction of Reflectance Loss in CSP Plants using a non Linear Autoregressive Model with Exogenous Inputs (NARX). In Proceedings of the 2016 International Renewable and Sustainable Energy Conference (IRSEC), Marrakech, Morocco, 14–17 November 2016; pp. 1–4. 39. Du, K.; Swamy, M.N.S. Neural Networks and Statistical Learning; Springer: Berlin/Heidelberg, Germany, 2014; ISBN 9781447155706. 40. Marquardt, D.W. An Algorithm for Least-Squares Estimation of Nonlinear Parameters. J. Soc. Ind. Appl. Math. 1963 ,11, 431–441. [CrossRef] 41. Hagan, M.T.; Menhaj, M.B. Training Feedforward Networks with the Marquardt Algorithm. IEEE Trans. Neural. Networks 1994 ,5, 2–6. [CrossRef] [PubMed] 42. ISO/TS 15066; Robots and Robotic Devices–Collaborative Robots 2016. International Organization for Standardization: Geneva, Switzerland, 2016; pp. 1–40. 43. Sharkawy, A.-N.; Koustoumpardis, P.N. Human–Robot Interaction: A Review and Analysis on Variable Admittance Control, Safety, and Perspectives. Machines 2022,10, 591. [CrossRef] 44. Briquet-Kerestedjian, N.; Wahrburg, A.; Grossard, M.; Makarov, M.; Rodriguez-Ayerbe, P. Using neural networks for classifying human-robot contact situations. In Proceedings of the 2019 18th European Control Conference, ECC 2019, Naples, Italy, 25–28 June 2019; pp. 3279–3285. 45. Franzel, F.; Eiband, T.; Lee, D. Detection of Collaboration and Collision Events during Contact Task Execution. In Proceedings of the IEEE-RAS International Conference on Humanoid Robots, Munich, Germany, 19–21 July 2021; pp. 376–383.