Optimizing Membership Function Tuning for Fuzzy Control of Robotic Manipulators using PID-Driven Data Techniques

— In this study, a method for optimizing membership function tuning for fuzzy control of robotic manipulators using PID-driven data techniques is presented. Traditional approaches for designing membership functions in fuzzy control systems often rely on the experience and knowledge of the system designer, which can lead to suboptimal performance. By utilizing data collected from a PID control system, the proposed method aims to enhance the precision and controllability of robotic manipulators through improved fuzzy logic control. A Mamdani-type fuzzy logic controller was developed and its performance was simulated in Simulink, demonstrating the effectiveness of the proposed optimization technique. The results indicate that the method can outperform conventional P control systems in terms of overshoot reduction while maintaining comparable transient response specifications. This research highlights the potential of the PID-driven data-based approach for optimizing membership function tuning in fuzzy control systems and offers valuable insights for the development and evaluation of fuzzy logic control in robotic manipulators. Future work may focus on further optimization of the tuning process, evaluation of system robustness under various operating conditions, and exploring the integration of other artificial intelligence techniques for improved control performance.


INTRODUCTION
Robotic arms play a crucial role in various industries, including healthcare, by performing a wide range of tasks. One of the main challenges in controlling these systems is minimizing errors during arm movement towards a desired point. In practice, repetitive arm movements from the same position can result in repeated errors with a range of constant values across cycles. To address this issue, a theoretical approach is necessary to improve the movement of the arm from one location to another [1].
Previous research has demonstrated the usefulness of controlling robotic arms in automating welding processes for stainless steel and commercially pure titanium [2]. Various robot motion control systems have been developed to regulate the movement of robotic arms [3]. This study utilized GrblGru to construct a 5-axis robotic arm and studied its operation using the basic G-code instruction set [4]. Other tools, such as MATLAB GUI and Arduino IDE, can also be used to control small robots, such as in simulations of a robot picking up an object [5]. This research may have implications for developing a robotic system for collecting COVID-19 specimens to assist medical personnel in the future [6].
Developers of mechanical robotic arms design both mechanical and motor control systems [6]. Motor control design is a vital aspect of many industrial and mechanical applications. Research efforts focus on developing motor control systems that can respond quickly, accurately, and with minimal overshoot, typically using DC servo motors [7], DC motor control [8]- [11], BLDC motors [12]- [15], and other electronic control systems. Commonly used control methods include PID control systems [16]- [21], the Ziegler-Nichols method [22]- [25], and the CHR tuning method [26], [27]. Improvements in PID control have been made in controlling robotic arms, such as using the Fuzzy Neural Network Algorithm [28] to design the gain of PID control [29] and adjusting the input to the system to increase flexibility. Other controllers used to improve the internal control system of robotic arms include adaptive fuzzy systems or developed fuzzy PID controller systems [30]- [34], optimal control [35]- [40], adaptive sliding mode [41]- [46], and adaptive neural network tracking control [47]- [60].
In controlling a robotic arm, the operator must define the motion path for the arm. Two main types of control are used in this process: point-to-point control [61]- [65] and trajectory tracking control [66], [67], each with its advantages and disadvantages. Repetitive controls [68] are a common aspect of robotic arm control, in which the same task is performed repeatedly. However, this can result in errors in the movement of the robotic arm due to the repetition of motion. To address this issue, iterative learning control [68]- [75], repetitive control, and run-to-run control are often utilized in the system design.
Fuzzy logic type 2 has only been applied in the balancing of a wheelchair [76], but it has demonstrated flexibility in control and has been used to adjust the gain in other control systems such as sliding mode controllers [77] and PID control systems [78], [79]. Fuzzy logic, in general, has a wide range of applications, including designing controllers for regulating the rotation of motors [80], electric fans [81], quadrotors [82],  [83], Internet of Things (IoT) systems [84], and medical decision-making [85].
Finding the optimal membership function for fuzzy logic controllers is crucial in controller design, but achieving accuracy using personal expertise or data analysis alone can be difficult. Various techniques have been developed to address this issue, including the KNN Classifier [86], a control algorithm (CA) module, a learning algorithm (LA) module, an artificial neural network (ANN) algorithm [87], and a genetic algorithm [88]. Each technique has its own strengths and limitations, and designers must consider the information used for learning and membership function design when choosing a method. Simulink is a tool that can be used to design controllers for linear, non-linear, continuous, or discrete systems.
This study proposes a method for designing the membership functions of a fuzzy logic controller using a PIDdriven data acquisition technique and multiple polynomial regression with bisquare weights. This approach has been demonstrated to be effective in identifying suitable membership functions for the robot system being controlled, and it can be applied in practical applications. The performance of the proposed fuzzy logic controller is compared with P control, showing that the former outperforms the latter in terms of accuracy and efficiency, making it a viable option for controlling robot systems.

II. METHOD
A. Designing System Fuzzy logic control system design can be challenging, particularly in designing or configuring membership functions. However, this problem can be addressed through membership function tuning by observing the behavior of the system using a closed control system, and then using the obtained value to design the membership function.
An easier way to collect the behavior of the system while it is being controlled is to estimate the value of the membership function in the fuzzy logic system using the value obtained from controlling the original system. The membership function tuning process typically involves designing a closed feedback system first, followed by taking the difference between the error value and the control input of the system and normalization. Based on these values, a membership function is designed in the fuzzy logic system.
If the designed membership function can control the system stably, it can be applied to the system; otherwise, the storage conditions must be redesigned. Fig. 1 provides a block diagram of the overall membership function tuning process. The workflow in this research involves constructing a closed loop system, inserting a setpoint signal, storing and normalizing the obtained parameters from the system response, and checking the stability of the membership function in controlling the system. If the membership function is found to be unstable in the controlling the system, the setpoint is redesigned, and the iteration process is repeated to determine the optimal membership function tuning that aligns with the response of the system. Once stability is achieved, the membership function is applied to the designed system, completing the process of membership function tuning.   Fig. 1 in terms of normalization. The process will end once the membership function table meets the acceptable criteria. The proposed method can be applied to any tuning method or technique in theory.
To obtain the membership function of the system, the working process involves several steps described in the topic of optimizing membership function tuning, which consists of seven steps in total. First, a feedback control system is designed. Second, the signal received from the feedback control system is stored. Third, the maximum and minimum values are determined. Fourth, the dataset is set to be within the range of −100% to 100%. Fifth, the criteria for rounding the decimal point are established. Sixth, the dataset level is specified in the membership function. And finally, the membership function is constructed for the fuzzy logic system. If the designed system tests the membership function and stabilizes the system, the operation is considered complete. If not, the system control conditions must be modified or adjusted to the polynomial regression equation.

B. Robotic manipulator Seiko D-Tran RT3200
The Seiko D-Tran RT3200 robot is a cylindrical type robot that is widely used in various industrial applications. Fig. 3 shows an example of this robot along with its controller device.  The Seiko D-Tran RT3200 robot used in this research, as shown in Fig. 3 and Fig. 4, has a system equation designed as a discrete time with a sampling rate of 0.055 seconds. Previous studies have been conducted on the control of this robot, including works by P. Chotikunnan and B. Panomruttanarug [74], P. Chotikunnan et al. [75], and P. Chotikunnan and R. Chotikunnan [89].

Controller Box LabVIEW
These studies present a model of the system equation denoted as (1), with the coefficients listed in Table 1 representing the variables of the robotic arm.

III. PID CONTROLLER DESIGN
In the development of closed motor control systems [90]- [94], controlling the response of the system is a crucial aspect. The Proportional-Integral-Derivative (PID) control system [95]- [98] has been continuously improved and widely used. The PID control system utilizes the PID controller, as shown in Fig. 5, and is well known for its simple structure and effective performance in various control applications. It consists of three sub controllers, the Proportional (P) controller, the Integral (I) controller, and the Derivative (D) controller. Although the PID control system operates as a continuous-time controller in theory, it needs to be adapted to a discrete-time controller when implemented in microcontroller systems. The control input estimate to the system is represented by (2).
In this study, the control inputs, denoted as , consist of the proportional gain ( ), integral gain ( ), and derivative gain ( ), as shown in the basic structure of feedback control in Fig. 6. The control input is restricted to a range of -100 to 100, and the discrete transfer function equation is utilized to determine the system. The saturation of the control input is also taken into account.  In this study, a PID controller was employed to regulate the motor system in joints R, T, and Z using CHR tuning to achieve minimal overshoot. The system design was investigated by P. Chotikunnan and R. Chotikunnan [89]. The R values or R conditions for joint R, joint T, and joint Z were found to be 12.75, 21.33, and 20.11, respectively. These values indicate that the P controller system should be utilized for control because the R value is greater than 10. The gain for each axis of the PID system as a P controller system is presented in Table 2 for joint R, joint T, and joint Z.

IV. FUZZY LOGIC CONTROL SYSTEM
This study aims to design a fuzzy logic control system that regulates the motion of a robotic arm motor using the Mamdani method to estimate the control input. The system control program is simulated in Simulink, as shown in Fig.  11. The design rules for input signal 1, input signal 2, and output signal are defined in this study. For example, input signal 1 represents the system error signal with 5 accompanying rules, while input signal 2 represents the difference value of the error signal with 5 rules. Both inputs range from -1 to 1 units, while the output signal has 9 rules defining its range also from -1 to 1 units. The membership function of input 1 and input 2 for all 5 rules and the output for all 9 rules are established and presented in Fig. 8, Fig. 9, and Fig. 10, respectively. Finally, the functionality of the designed membership function table is tested using the fuzzy inference method and the Mamdani fuzzy rule system method, which is determined after optimizing the membership function tuning.    In this study, the input values for the joints R, T, and Z are limited to a range of -1 to 1 due to the saturation of the input in Fig. 11. The parameter KFI, representing the error range, is calculated using (61).
The control input saturation limit for all 3 joints is set to -100 to 100, with a value of 100 for KFO. The values are scaled within the range of -1 to 1 for simplicity, and the output gain is set to 100. The power of the system can be adjusted within the range of -100% to 100% based on the operation of the system. Membership function optimization is a crucial aspect of designing a stable fuzzy logic control system [99]- [101]. This study utilizes multiple polynomial regression with the bisquare weighting method to optimize membership function tuning and derive the membership function. The objective is to estimate the behavior of the closed system, which is controlled by the robot with the PID system, and subsequently evaluate the system. The process involves deriving values from the polynomial models' equations and determining the membership function tuning to obtain suitable results for the membership function table used in the fuzzy logic controller.

A. Polynomial models
Polynomial regression analysis is a type of regression analysis that is used to examine the relationship between one or more dependent variables ( ) and independent variables ( ). When dealing with non-linear variables, it is necessary to follow the same preliminary steps, which involve collecting data to determine the dependent variable ( ) and the independent variable ( ), and expressing this relationship in the form of (3).
The order of the polynomial is represented by + 1 and the degree of the polynomial is represented by .
This research is to determine the degree of the polynomial in = 3 and = 3 and to use the robust technique of the Bisquare weights method to estimate the data required to solve the equation in the polynomial system. A regression model of degree 3, also known as a quadratic model, in two variables and is given by (4).
The command function fit([ , ], , 'poly33', 'Normalize', 'Bisquare') in the matlap program can be used to find the conditions where is the value of input I, is the value of input II, and is the value of the output to be estimated. The value of can be obtained from the fit function of the MATLAB program, which displays the parameters in the simulation results.

B. Membership function tuning
Training algorithms are utilized to determine the membership function of a system using data storage techniques in a control system that can control the behavior of the system. The preliminary data is analyzed in order to design a suitable membership function system through the execution of a search process for all 7 steps, as follows.

Design feedback control
A controller is created in this step to make the system that needs to be controlled a feedback control system. The PID control system can be used to easily adjust the system in order to find the membership function in the fuzzy logic system. This feedback control can be designed in the program MATLAB/Simulink as shown in Fig. 12. By setting the signal setpoint, a smooth function signal in the form of a sin wave is designed to bring the signal value to the control system that needs the membership function of fuzzy logic and to collect the data from the feedback control system, which consists of the error ( ), the derivative of the error (), and the control input (̌).

Store the signal received from the feedback control system
The signal data or system behavior is stored in the data set of the desired path, actual path, error ( ), derivative of error (), and control input (̌) as shown in Fig. 12. In order to use this data for estimation in finding the membership function, initial variables must be set for the estimation, including the number of membership functions input I (α), which is the total number of rules defined in input 1, the number of membership functions input II (σ), which is the total number of rules defined in input 2, and MB output (γ), which is the total number of rules defined in the output of the fuzzy logic to design the system. The analysis of the data system is not limited to a certain number of data sets, but if the data set is not sufficient, it may be necessary to increase the number of data for analysis. This data can be brought in at specific times for analysis.

Determine the maximum and minimum value
The data set contains error ( ), derivative error (), and control input (̌). To analyze the amplitude of each data set and ensure it is within the specified limits, the maximum and minimum values can be obtained by using (5)-(10).
After obtaining the highest and lowest values, they are compared in order to find the highest value point as in (11), and then the highest value point in each data set is found as in (12)- (14).

Set the range of the dataset to be in the range -100%-100%
In this action is to establish a consistent range for all datasets within the design system for convenient usage. The data level can be transformed to fall within the range of -100% to 100% using (15), (16), and (17).

Establish the criteria for rounding the decimal point
After determining the range of a dataset to be -100% to 100%, a program can be developed to round off the decimal numbers using (18). To begin this process, the decimal portion must first be identified using (19), (20), and (21), and then the values can be entered into (22), (23), and (24) as a computational condition for the use of (18), which will produce the rounded result. In this study, the value of τ is set to 0.4, indicating the decimal point at which the program should truncate the fraction.

Specify the data set level in MB
To determine the level of a dataset, the procedure is to transform a dataset within the range of -100% to 100% into a dataset within a range that does not exceed the number of input membership functions I (α), the number of input membership functions II (σ), and the number of output membership functions (γ), which can be calculated using (25), (26), and (27).
After calculating the range of the system, round the number of membership functions using (28), (29), and (30).
The next step is to determine the maximum and minimum value of the number of membership functions using (31) - (36).
After identifying the highest and lowest values, compare these two values in order to find the point with the greatest value using (11). Then, find the point with the greatest value in each dataset using (37) -(39)

Construction of the membership function for the fuzzy logic system
To determine the result of the membership function table, the dataset must be arranged in order of the defined level of the membership function. The membership function can be calculated using (40).
After that, substituting the number of membership functions into (40) will result in a dataset of the membership function level of the value of input I in (43) and input II in (44). These values can then be substituted into the estimated equation f_poly(x,y) in (4) to obtain the solution for the membership function of the output of the system in (45).
By considering in ̆̇ has an odd number of members, the position of the column at the center of the table is the position of ̆( + ) throughout the row and the value of 0 is greater than 50%. The original position of the table can be improved using this (58).
is the gain used to determine the input range of each system, which has been estimated in this research and can be calculated using the following (61).
This equation represents the gain ( ) utilized to design the range of the input signal for the system.

VI. SIMULATION RESULTS
This section presents two simulation results. This simulation system uses a robotic manipulator as the simulation model, which has a total of 3 system equations. The details of the simulation system are provided in the following section. The program can be processed and written in Simulink form, as shown in Fig. 6. and Fig. 11.

A. First result
In the first set of results, the signal data or system behavior is stored in the data set of the desired path, actual path, error ( ), derivative of error (), and control input (̌) as shown in Fig. 13 and Fig. 14 for Joint R, Fig. 15 and Fig. 16 for Joint T, and Fig. 17 and Fig. 18 for Joint Z. In order to use this data for estimation in finding the membership function, initial variables must be set for the estimation, including the number of membership functions input I (α), which is the total number of rules defined in input 1, the number of membership functions input II (σ), which is the total number of rules defined in input 2, and MB output (γ), which is the total number of rules defined in the output of the fuzzy logic to design the system. The analysis of the data system is not limited to a certain number of data sets, but if the data set is not sufficient, it may be necessary to increase the number of data for analysis. This data can be brought in at specific times for analysis.
The first set of results in this study displays the system behavior data, which includes the desired path, actual path, error ( ), derivative of error (), and control input (̌). The data are shown in Fig. 13 and Fig. 14 for Joint R, Fig. 15 and Fig. 16 for Joint T, and Fig. 17 and Fig. 18 for Joint Z. To estimate the membership function, the initial variables such as the number of membership functions input I ( ), which is the total number of rules defined in input 1, the number of membership functions input II ( ), which is the total number of rules defined in input 2, and MB output ( ), which is the total number of rules defined in the output of the fuzzy logic system must be set. In this study, the setpoint value was a sine wave with a frequency of 0.1592 Hz and an amplitude of 100 for 30 seconds.  The membership function for the robot system was designed by estimating the obtained data using the multiple polynomial regression with bisquare weight method, as shown in Fig. 14 Table 3 was then used to derive the values, and the resulting membership function table is presented in Table 4.
The membership function for the robot system was designed by estimating the obtained data using the multiple polynomial regression with bisquare weight method, as shown in Fig. 16 Table 3  was then used to derive the values, and the resulting  membership function table is presented in Table 5.    The membership function for the robot system was designed by estimating the obtained data using the multiple polynomial regression with bisquare weight method, as shown in Fig. 18.  Table 3 was then used to derive the values, and the resulting membership function table is presented in Table 6.

B. Second result
The simulation results showed that using a step input profile for the control of Joint R, Joint T, and Joint Z with fuzzy logic, as depicted in Fig. 19, Fig. 20, and Fig. 21, produced a responsive output to the design signal, outperforming the P controller when utilized with a step input because of its ability to reduce overshoot. In conclusion, the multiple polynomial regression with bisquare weighting method proved effective in designing the membership function for the robot system.   The simulation results in Fig. 19, Fig. 20, and Fig. 21, along with Table 7, demonstrate the transient response of the system to a step input motion in the R, T, and Z axes. The findings indicate that the fuzzy logic control resulted in a response time of 0.22, 0.22, and 0.66 seconds in the respective axes, while the P control had an overshoot of 4. 35, 9.17, and 20.03%. Furthermore, the settling time for the system was better than 0.11, 0.495, and 0.33 seconds for fuzzy logic control, respectively. These results suggest that the membership function evaluation method used in the system is comparable to the control method used to collect data.
The use of fuzzy logic control demonstrated better controllability of the system than P controls, which were the primary means of collecting learning data. Additionally, the results indicate that fuzzy logic control performs well in both overshoot and settling time, although P control is better in the rise time. However, having an overshoot in a high system may limit the system's usability in real-life applications. If the P control system is to be used, further tuning may be required to reduce the overshoot in the movement of the system. In summary, the simulation results showed that using the multiple polynomial regression method for optimizing the membership tuning function for fuzzy control with PID-Driven data techniques led to a stable and effective control system with comparable performance to the original closed control system. This approach also eliminates the need to rely solely on the experience of the control system designer in designing the membership functions. However, the multiple polynomial regression technique used to obtain the membership function results in a symmetrical form, which may not be suitable for systems requiring an asymmetrical membership function. The study provides important implications for the development and improvement of fuzzy logic control in robotic manipulators, and the simulation data for Joints R, T, and Z, along with the resulting membership function tables and transient response specifications, are presented in detail in the study.

VII. CONCLUSION
In this study, a fuzzy logic control system was developed for regulating the movement of a robotic arm motor using the Mamdani method and simulated in Simulink. The input and output signals' design rules were defined, and membership functions were established through multiple polynomial regression with the bisquare weighting method. Results indicated a reduction in overshoot ranging from 5-20% for each joint compared to the P control system, demonstrating the potential of fuzzy logic control in precision tasks such as industrial automation or medical robotics. However, the study's scope is limited to robotic arm motor movement, and the conclusions might not be directly applicable to other systems. The membership function evaluation method showed similar performance to the data collection control method, but further exploration and justification are needed. Future research should focus on optimizing membership function tuning, assessing the fuzzy logic control system's robustness and effectiveness under different conditions, and exploring synergies with other artificial intelligence approaches, such as reinforcement learning or neural networks, to advance robotic control systems.