2-DOF robot modelling by SimMechanics and PD-FL integrated controller for position control and trajectory tracking [version 1; peer review: 1 approved with reservations]

Background Due to the high demand of robots to perform several industrial tasks, such as welding, machining, pick and place, position control in robotics has attracted high attention recently. Controllers’ improvement is also continuous specifically in terms of design simplicity and performance accuracy. This research plans to obtain the SimMechanics model of a two-degree of freedom (DOF) robot and to propose an integrated controller of a proportional–derivative (PD) controller and a fuzzy logic (FL) controller. Methodology The SimMechanics model of the 2-DOF robot is obtained using MATLAB SimMechanics toolbox from a CAD assembly design of the 2-DOF robot. Then, the proposed PD-FL integrated controller is designed and simulated in MATLAB Simulink. The PD controller is widely used for its simplicity, but it doesn’t have a satisfactory performance in difficult tasks. Furthermore, the FL controller is also easy for design and implementation even by nonexperts in control theory, but it has the disadvantage of long computational time for multi-input systems due to the increased fuzzy rules. Results The FL controller is integrated with the PD controller for enhanced performance of the 2-DOF robot. The PD-FL integrated controller is developed and tested to control the 2-DOF robot for point-to-point position control and also tip trajectory tracking (TTT) such as triangular TTT and rhombic TTT. Conclusion The PD-FL integrated controller demonstrates enhanced performance compared to the conventional PD controller in both point-to-point position control and TTT. Furthermore, the PD-FL integrated controller has the advantage of less fuzzy rules which helps to overcome the computational time issue of the FL controller.


Introduction
There is a wide use of planar robots in industries to achieve several required tasks, such as welding, handling, machining, polishing, pick and place, etc. Meanwhile, there is a high demand of fast and precise position control for such robots in industries 1 . A dynamic model is required for several types of controllers in order to obtain the optimal parameters of a controller for satisfactory performance. There are many mathematical modelling methods, such as the kinematics method 2 , Newtonian method 3 , Lagrange's equation 4,5 , and Hamilton's principle 6 . However, mathematical modelling is difficult and requires long calculations especially for nonlinear systems; critical and deep discussion of mathematical modelling methods is given in reference 7 . A numerical modelling method was used to obtain SimMechanics models of robots using Simulink and Simscape toolboxes from CAD assemblies [8][9][10] . SimMechanics models are easily obtained and can be simulated and controlled, so they are preferable.
A proportional-derivative (PD) controller was tuned using root locus 11,12 and manually tuned 13,14 for position control of such robots. The manual tuning method helps to dispense about the mathematical model of a system which one of its advantages. However, the PD controller is not perfect for nonlinear and complex systems. A 2-DOF robot was controlled by a proportional-integral-derivative controller (PID) due to its simple structure, but it is not easy to obtain optimal PID parameters to give a satisfactory performance 15 . The linear quadratic regulator (LQR) is an optimal classical control technique and was utilized to control a planar robot with the necessity of a system mathematical model in order to calculate the controller gain 16,17 . The fuzzy logic controller (FLC) is a common control technique in robotics and has continuous increasing interest due to its robustness performance for nonlinear systems and does not require a mathematical model to tune its membership functions and rules 18 . FLC has the disadvantage of computational time due to the fuzzy rules explosion for controlling multi-input systems 19,20 .
Neural network (NN) is an intelligent control technique and can be developed with simple knowledge of the system behavior without a need for a dynamic model which assists to avert the complexity of the mathematical modelling 21 . NN was used to control a 2-DOF robot in terms of links' position 22 . However, NN require many hidden layers in its network to provide an accurate position control which needs long time for training 23 . Sliding mode controller (SMC) is a robust controller and was employed for position control of a 2-DOF robot 24,25 . However, sliding mode controller has the chattering issue which is a serious disadvantage 26,27 . Integrated controllers which consist of more than on control technique were also used for position control of 2-DOF robots such as FLC-SMC 28,29 , FLC-PID 30 , and FLC-NN 31 . There are many other control techniques were critically discussed in the literature 32 .
Based on the discussed previous studies, the mathematical modelling of robots is a serious problem faces researchers and control engineers either the difficulty of mathematical operations or the challenge of obtaining accurate models. Therefore, the first objective is to obtain the SimMechanics model of the 2-DOF robot from the CAD assembly design via SimMechanics environment in MATLAB (RRID:SCR_001622); an open access alternative is GNU Octave (RRID:SCR_014398). The second objective is to design the PD-FL integrated controller to control the 2-DOF robot in terms of point-to-point position control of the links, triangular TTT and rhombic TTT. The remaining sections of this paper are as follows: section 2 describes the system and the SimMechanics model. Section 3 explains the proposed controller design. Section 4 presents the results and discussion. Section 5 is the conclusion.

System and the SimMechanics model
A schematic diagram of the 2-DOF robot is shown in Figure 1 which consists of two links with 50-cm length of each link and a 4.5 cm 2 cross-sectional area. The movement of this robot is only on the horizontal plane. The tip position of the robot is computed based on Equation 1.
The CAD assembly of the 2-DOF is designed as shown in Figure 2. The CAD assembly is used to generate the SimMechanics model of the 2-DOF robot. The SimMechanics model is obtained starting by building the CAD assembly design of the robot and export the CAD assembly and save it in the format of 'XML' file. Then, the assembly 'XML' file is imported to the MATLAB SimMechanics toolbox using the 'smimport' function. The steps of generation the SimMechanics model is explained in detail in Figure 3. The SimMechanics model of the 2-DOF robot is presented in Figure 4. The SimMechanics model was generated and used in previous research such as in reference 9 and reference 10.

Control design
The 2-DOF robot is controlled by the PD-FL integrated controller. The PD controller is selected due to its simplicity of design and it is widely used. The PD parameters can be easily tuned based on trial and error 13,14 , Equation 2 shown the PD control transfer function. Two PD controllers are designed as the    PD controller is single input single output. The parameters of the two PD controllers are manually tuned and the better performance is achieved by the parameters tabulated in Table 1.
FL controller is an intelligence control technique that depends on expressing the system behaviour. FL uses errors as its input variables and assigns the input into partial degrees of membership functions (MFs) 33 . The MF amplitude varies between 0 and 1. The fuzzy rules are expressed in the form of IF-THEN to describe the relation between inputs and outputs depended on the MFs. The MFs are designed and tuned in terms of range, numbers, and shape as shown in Figure 5 for the two inputs and outputs, they are described by "positive big" (PB), "positive medium" (PM), "positive small" (PS), "zero" (ZE), "negative big" (NB), "negative medium" (NM), and "negative small" (NS). Then, the fuzzy rules are tuned to describe the system errors depended on the MFs and to decide what fuzzy output should be, Table 2 describes the fuzzy rule-base. Table 2 shows the fuzzy rules reduction from 49 rules to 25 rules. The fuzzy rules reduction improves the computational time and simplifies the FL controller design.
The 2-DOF robot model and proposed PD-FL controller is shown in Figure 6. The outputs of the two PD controllers are the fuzzy inputs, and the fuzzy outputs are the robot inputs. The first PD controller controls link 1 and the second PD controller control link 2. The two PD controllers initially control the robot and minimize the errors, which do not reach NM and NB regions. Thus, there is no effectiveness of the fuzzy rules for NM and NB of errors which helps to minimize the fuzzy rules number from 49 to 25. This fuzzy rules' reduction solves the issue of the computational time and also simplifies the FL controller design. The proposed PD-FL integrated controller  Table 2. Fuzzy rules of FL controller for the 2-DOF robot based on error 1 (e 1 ), error 2 (e 2 ), output 1 (u 1 ), and output 2 (u 2 ).

Results and discussion
This section presents and discusses the results of point-to-point position control and the TTT.

Point-to-point position control
The performance of the PD-FL integrated controller and the conventional PD controller is shown in Figure 7 for the first link of the 2-DOF robot by the blue line and the red line, respectively. The PD-FL integrated controller demonstrated great improvement in terms of "rise time" (T r ), "settling time" (T s ), "overshoot" (OS), and "steady state error" (e ss ) compared with the PD controller alone as analyzed in Table 3.
The PD controller has better performance for link 2 than link 1 as shown in Figure 8, this is because link 2 is a load to link 1 which makes the control of link 2 easier than control link 1 for the PD controller. However, the PD-FL integrated controller has better performance than the PD controller for link 2 as it has shorter rise time (T r ) and settling time (T s ), also it has less overshoot as described in Table 4. Based on the results of point-to-point position control of the 2-DOF robot, it is obvious that the PD-FL integrated controller is better than the conventional PD controller as it has shorter rise time (T r ), shorter settling time (T s ), and less overshoot for link 1 and link 2.

Tip trajectory tracking
The PD-FL integrated controller is tested for TTT of the 2-DOF robot for triangular TTT and rhombic TTT as follows.

Triangular tip trajectory tracking
The triangular TTT of the 2-DOF is shown in Figure 9 for the PD-FL controller and the PD controller, The triangular TTT starts and ends based on the following trajectory points (X,Y): (1.0,0.0), (0.9,−0.1), (0.9,0.1), (1.0,0.0). It can be seen that the TTT of the PD-FL controller trajectory is nearer to the reference than the TTT of the PD controller. Based on the X and Y errors of both controllers in Figure 10, the improvement of the PD-FL integrated controller for the triangular TTT is also noticeable. The maximum Y error of the PD-FL integrated controller is less than 6 millimeters, but it is more than 9 millimeters for the PD controller. The X error of the PD-FL integrated controller is also smaller than the X error of the PD controller as presented in Figure 10.  Figure 11 shows the rhombic TTT of the 2-DOF robot. It is clearly shown that the PD-FL integrated controller is better than the PD controller in tracking the tip of the 2-DOF robot as it is closer to the tip reference trajectory. Furthermore, the maximum Y error of the PD controller tracking is about 8 millimeters while the maximum Y error of the PD-FL controller is less than 4 millimeters as shown in Figure 12. The X error of the PD controller is also larger than the X error of the PD-FL integrated controller as presented in Figure 12. Thus, the PD-FL integrated controller performance for the rhombic TTT of the 2-DOF robot is better than the PD controller.
The discussed results of the point-to-point position control and the TTT demonstrate the improvement of the proposed controller in terms of fast response and accuracy. Normally, the faster response is the more overshoot and larger tip position error. However, the proposed PD-FL integrated controller has a faster response and reduces the overshoot and the tip position error of the 2-DOF robot. Furthermore, the proposed controller has the advantage of design simplicity compared with other integrated controllers.

Conclusion
The aim of this research was to obtain the SimMechanics model of the 2-DOF robot using MATLAB SimMechanics Toolbox from the CAD assembly design. Then, the PD-FL integrated controller was designed to control the 2-DOF robot in terms of       acceleration as well as the dynamic factors of the robot.

Is the work clearly and accurately presented and does it cite the current literature? Yes
Is the study design appropriate and is the work technically sound? Partly

If applicable, is the statistical analysis and its interpretation appropriate? Partly
Are all the source data underlying the results available to ensure full reproducibility? Partly

Are the conclusions drawn adequately supported by the results? Yes
Establishing and converting 3D models from CAD design environment to MATLAB environment is not prominent because this problem has been done for a long time and with more complex robot models, more degrees of freedom.