Enhancing robustness and noise rejection in flexible joint manipulators: an optimized sliding mode controller with enhanced gray wolf optimization for trajectory tracking

The objective of this study is to enhance the performance of a nonlinear three-rigid-link manipulator (RLM) with a focus on trajectory tracking, robustness against disturbances and noises, and adaptability to joint flexibility. To achieve this, we have employed an optimized sliding mode controller with a proportional integral derivative (PID) sliding manifold. The tuning process involves selecting the critical gains of the controller that minimizes the integral time absolute error (ITAE), serving as the objective function (OBJF) to optimize the performance of the robot manipulator. To identify the optimal gains of the controller, we have utilized a new optimization algorithm known as memory enhanced linear population size reduction gray wolf optimization (MELGWO). The efficacy of this algorithm is compared to other existing optimization methods in the literature. Moreover, this research has delved into the impact of joint flexibility on the robot system’s performance. Encouragingly, the results demonstrate that the optimized SMC–PID with MELGWO adaptation can effectively address joint flexibility while maintaining acceptable performance levels.


Introduction
Robotic manipulators are employed in the current industrial environment to enhance product quality as well as productivity, accuracy, speed, and flexibility in the workplace.Robotic manipulators are rapidly being used in risky, tedious, or repetitive industrial processes, despite the complicated and tough requirements of industrial applications.Material picking and placing is one of the essential uses of mechanical robotic manipulators.These manipulators can also be used for welding, assembling, manufacturing, painting, and other operations in the car industry, as well as for handling radioactive and biohazardous materials during robotically assisted surgery.Manufacturing needs to be more effective and highquality, and this requirement has motivated the development of more robust and sophisticated robotic manipulators [1][2][3][4].
The adoption of flexible link manipulators (FLMs) and flexible joint manipulators (FJMs) have witnessed a notable surge in recent times, attributed to their extensive applicability across domains encompassing industry, medicine, aerospace, instrumentation, satellites, and industrial automation.These manipulators are progressively replacing rigid links characterized by larger dimensions and greater mass within diverse industrial sectors [5].Furthermore, the design of flexible and lightweight manipulators offers advantages such as enhanced maneuverability and reduced power consumption.Nonetheless, these systems pose challenges in terms of modeling, measurement, stabilization, and control, primarily attributed to the oscillations exhibited by flexible links [6].
The importance of mathematical modeling for multi-DOF manipulators is necessary in any practical control process; the mathematical model of the manipulator is normally developed using the Lagrangian approach [7][8][9][10].In general, mathematical modeling is really challenging and time-consuming, especially for strongly coupled Technical Editor: Adriano Almeida Gonçalves Siqueira.
546 Page 2 of 17 multi-input multi-output systems; Recent research offers a thorough and comprehensive critical analysis of mathematical modeling methods [2].Using a numerical modeling method, the powerful MATLAB Simulink and Simscape toolboxes were utilized to create SimMechanics models of robotic manipulators from CAD assemblies [1,9,10].Simscape multibody models are favored because they are simple to get, and they can be simulated and controlled [1,5,[11][12][13][14].Using simulation software has several advantages, including understanding of how the multi-DOF robotic manipulator systems work in a simulated environment and avoiding the complexity of mathematical formulations.
Sliding mode control (SMC) is a widely utilized nonlinear control strategy employed to guide state trajectories toward predetermined sliding surfaces through the application of discontinuous control inputs [10,[15][16][17][18][19].Nevertheless, the SMC law's discontinuity can lead to the manifestation of the chattering effect, characterized by the occurrence of high-frequency oscillations in the controlled variable.This phenomenon has the potential to disrupt the stability of the controlled system or substantially reduce the actuators' operational lifespan [10,15].
Numerous strategies have been proposed in the literature to address the chattering phenomenon [20].One of the approaches involves approximating the SMC's discontinuous control with a continuous counterpart.Although this technique effectively reduces tracking error, it comes at the cost of compromising the overall efficiency of SMC by generating a pseudo-sliding mode instead of the desired ideal sliding mode [20].An alternative solution to mitigate chattering entails employing the higher-order sliding mode control approach.This method confines the discontinuity to a derivative of the control variable, incorporating these derivatives with respect to time up to a specified order in addition to the sliding variable.Notably, this approach exhibits favorable suitability for application in electromagnetic or mechanical systems due to its continuous nature of control action [20].
The existing literature encompasses various studies exploring the sliding mode controller and its diverse applications.For instance, a comparative investigation conducted by prior researchers [21] evaluated the performance of the SMC controller in comparison to the PID controller.The outcomes indicated that the SMC exhibited a faster and more robust response, albeit with a relatively larger control signal than the PID controller.
Geng et al. [22] explored three distinct types of non-singular terminal sliding mode controllers implemented on a robotic arm subject to external disturbances.Through simulation results, they demonstrated the efficacy of the proposed modifications in enhancing the controller's convergence rate while reducing the magnitude of the control input signal.
In a study conducted by Mohammad-Reza Moghanni-Bavil-Olyaei et al. [23], a comparative analysis was performed between the sliding mode control (SMC) with proportional-derivative (PD) surface and the block backstepping control approach.The aim of this comparison was to evaluate the trajectory tracking performance of a singlelink flexible-link flexible-joint manipulator (SFLFJM).
An additional research endeavor focused on an integrated second-order SMC controller and the application of an algorithm for designing the control scheme for manipulator robots.This study aimed to evaluate the practicability of the proposed controller and confirm its effectiveness in terms of convergence and robustness.Satisfactory results were obtained through experiments conducted on a real industrial robot, validating the algorithm's practicality and effectiveness [10,20].
Numerous studies have investigated the concept of adaptive sliding mode control [24][25][26].Additionally, there have been several studies that explore the integration of fuzzy logic with sliding mode control (SMC) [27][28][29].To enhance the performance of SMC control, Genetic Algorithms (GA) were utilized to determine optimal parameters for a conventional SMC controller [30,31].Vijay and Jena devised a Particle Swarm Optimization (PSO)-based backstepping sliding mode controller and observer for robot manipulators [32].PSO was employed to tune sliding surface parameters of SMC combined with an Artificial Neuro Fuzzy Inference System (ANFIS) and adjust the membership functions of Takagi Sugeno fuzzy SMC, respectively [33,34].A novel approach in [35] introduced the combination of a PSO algorithm with super-twisting SMC to eliminate chattering.Medjghou et al. introduced an optimized extended Kalman filter with integral type 2 fuzzy SMC using Biogeographybased optimization (BBO) [36].Oliveira et al. proposed using gray wolf optimization (GWO) with a chaotic basis to tune robust higher-order SMC for the position control of a robot manipulator [37].To find the best control parameters for the fuzzy controller in APIDFSMC and control uncertain systems, the GA-based adaptive PID fuzzy sliding mode control strategy (APIDFSMC-GA) is introduced [38].With a proportional-integral-derivative-type nonsingular fast terminal sliding mode control, an adaptive robust controller for uncertain nonlinear systems is designed to provide the essential attributes of rapid transient response, finite-time convergence, negligible steady-state error, and chattering cancellation [39].Different optimization techniques, such as the Antlion Optimization Algorithm (ALO), Sine Cosine Algorithm (SCA), gray wolf optimizer (GWO), and Whale Optimizer Algorithm (WOA), are used to control the nonlinear 2-DOF system in a sliding mode controller (SMC) with PID surface [15].
In the context of scientific research and technical applications, the use of evolutionary algorithms (EAs), a type of efficient and effective optimization approach, has recently grown in popularity.Modern practical optimization issues are usually non-convex, discontinuous, or even non-differentiable, which makes it difficult for traditional optimization techniques, like gradient-based approaches, to handle these types of problems [40][41][42].
Natural processes are used by swarm-based optimization algorithms (SOAs) to drive a search toward the optimal solution.Instead of using just one solution for each iteration, SOAs use a population of solutions, in contrast to simple optimization algorithms like stochastic process and hill climbing.The difference between SOAs and these algorithms in this regard is substantial.A population of solutions is processed at each iteration, and a population of solutions is also created each iteration [41,42].
The gray wolf optimizer (GWO) is a new developed metaheuristic algorithm inspired by nature, characterized by a small number of parameters for tuning [40].However, the original GWO and its variants may encounter challenges such as lack of population diversity, premature convergence, and difficulty in achieving a balance between exploration and exploitation.To address these limitations, a new variant called Memory Enhanced Linear Population Size Reduction GWO (MELGWO) is proposed [41].This variant incorporates memory to retain better solutions, evolutionary operators to enhance exploration, and a stochastic local search technique.Additionally, a linear population size reduction strategy is employed to maintain a diverse population and prevent premature convergence.As iterations progress, the swarm size is gradually reduced to minimize redundant exploration.The local search component significantly improves the exploitation capability of GWO, resulting in the generation of more wolves near the best solutions in the memory swarm [41].Through the integration of these features, the MELGWO algorithm demonstrates superior performance compared to the original GWO algorithm, effectively addressing the limitations and achieving enhanced optimization results.
This study encompasses the utilization of the Lagrangian method and the Simscape Multibody toolbox within MAT-LAB to construct a comprehensive model of a 3-DOF RLM.To validate the fidelity of this model, the investigation commences with an analysis of open-loop system responses for both the mathematical and Simscape representations, elucidated in Sect. 2. In Sect.3, the formulation of a Sliding Mode Controller (SMC) with a PID sliding surface is elaborated.Section 4 expounds on the employment of the memory enhanced linear population size reduction gray wolf optimizer (MELGWO) metaheuristic optimization technique, designed to confer overall robustness, stability, and exceptional tracking performance to the closed-loop three-link maneuver system.A meticulous examination of the proposed controller's efficacy in mitigating disturbances and noise, along with its resilience against variations in payload mass, is undertaken in Sect. 5. Furthermore, the adaptability of the controller to the maneuver's joint flexibility is discussed.Finally, Sect.6 encapsulates the study's key findings and concluding remarks.
In the entire study, all vectors are written with bold lowercase letters and all matrices are written with uppercase letters.

Modeling the three DOF rigid-link robotic manipulator
The model of the 3-DOF rigid-link manipulator derived from the Lagrangian method depends on the kinetic and potential energies of the links.The more complex the problem, the more variables, assumptions, and iterations we might need to make, and this takes long derivation time.On the other side, the powerful tool Simscape Multibody that is fully integrated with MATLAB and Simulink, enables rapid modeling, simulation, and analysis of systems.
The Simscape modeling and validation of the Lagrange's model with Simscape model are included in the following subsections.

Lagrange mathematical modeling
By considering the kinetic and potential properties of the mechanical system, the Lagrange's equations of motion can be obtained.Figure 1 illustrates a system comprising three linkages and three joints, denoted as J 1 , J 2 , and J 3 .The lengths of the links are represented as l 1 , l 2 , and l 3 , while their masses are indicated by m 1 , m 2 , and m 3 , respectively.A comprehensive listing of these properties is provided in Table 1.
In the context of the manipulator, the dynamic model can be expressed as follows: where (t), ̇ (t), ̈ (t) denote the vectors of joints angles, joints velocities and joints accelerations, B( ) is the iner- tia matrix, , ̇ is the vector of centrifugal and Coriolis forces, g ( ) is the gravitational force vector, is the vector of input torques and D is the vector of external disturbances which is assumed to be bounded with ‖D‖ ≤ d , where d is a positive constant.
Using the information given in Table 1, the entries of the inertia matrix are as follows: (1) where m L is the payload mass.The elements of the centrifugal and Coriolis force vector are defined by: (4) The components of the gravity force vector are as follows: where g is acceleration of gravity.

MATLAB Simscape multibody model
The use of Simscape add-on products grants access to more sophisticated parts and analysis tools, which aid in the design and analysis of control systems.The created model can be parameterized using MATLAB variables and expressions, while Simulink is employed to develop control schemes for our physical system.The process of developing the Simscape model encompasses several sequential stages, as outlined below: (9)  I. System Solver In this phase, the comprehensive configuration of mechanical and simulation parameters for the entire system is undertaken.Factors such as acceleration, the gravity vector, linearization delta, and the global frame are defined.Furthermore, the specification of the solver configuration, utilizing the Runge-Kutta method, is executed.II.Link Creation Within the framework of the Simscape toolbox, the "Brick Solid" block is employed.This block functions as a representation of a solid structure, integrating geometry, inertia, mass, graphics elements, and associated frames.Notably, it serves as the fundamental unit for constructing rigid bodies.During this stage, the intrinsic attributes of the links, encompassing geometric dimensions and mass properties, are meticulously defined.III.Creation of Joints Within the Simscape toolbox, the "Revolute Joint" block is utilized to establish a revolute joint connecting two frames.This specific joint configuration enables rotational motion along a singular degree of freedom.IV.Frame Transformations The integration of rigid transformations assumes a pivotal role in defining fixed 3D transformations between frames.These transformations encompass both translational and rotational components, thereby accommodating diverse combinations of translational shifts and rotational adjustments.
The MATLAB Simscape model, which represents the entire rigid link manipulator (RLM) system is shown in Fig. 2.
To validate the accuracy of the mathematical model, a comparative analysis is conducted between the openloop behaviors of the mathematical model and the MAT-LAB Simscape model.This evaluation is performed under varying input torque conditions of 0.5Nm , 1Nm , and 1.5Nm for each joint, as depicted in Fig. 3.The responses of the Lagrange model are compared with those of the Simscape model in Fig. 4. Evidently, a significant congruence between the two responses is observed, substantiating the suitability of the Simscape model for subsequent investigations.

Sliding mode controller with linear PID sliding surface
Selecting the sliding surface function is a necessary step before designing a sliding mode controller.Then, an equivalent controller and switching mode controller should be constructed depending on the states of the dynamical system.The basic principle behind this kind of control is to place, regardless of the initial conditions, the representative point of the system's evolution on a hypersurface of the phase space, representing a set of static relationships between the state variables.There are two components in the sliding mode control as described in Eq. ( 14).
where (t) is the continuous part of the controller (called the equivalent controller) and (t) is the discontinuous part (called the switching mode controller).
The PID sliding surface for the existing SMC can be specified with Eq. ( 15).where K p , K i andK d are positive definite diagonal matrices.Furthermore, e(t) = d (t) − m (t) is the tracking error vector with d (t) , m (t) denote the desired and the measured angular position vectors.
To find the continuous equivalent controller (t), it is necessary that ̇ (t) = 0 .Applying this, we arrive at the fol- lowing equation:  1) and (15).
The switching mode control law (t) is chosen to be of the following form [43][44][45] where is a positive definite diagonal matrix and (•) is the signum vector function.
To find the minimum values of the controller gains that ensures the system stability we consider the following positive definite Lyapunov function candidate: Using Eqs. ( 1), ( 15), ( 16) and ( 17), the time derivative of V is upper bounded as follows where min {•} is the minimum eigen value of the matrix {•}.
The structure of Eq. ( 19) proves that the system is globally exponentially stable, and the system reaches the sliding surface in a finite time provided that Since the signum function causes chattering in practice, it will be replaced here with the saturated vector function , where is a very small positive constant.This replacement changes the state of the system stability, and the system becomes globally ultimately bounded stable.The later causes the system states converge to the sphere defined by‖ ‖ ≤ .Since the sliding surface is a stable system, the ultimate bound of the tracking error will be ‖e‖ ≤ min {Kp} .
Due to the later and to improve the system performance, the elements of the diagonal matricesk p ii ,k I ii ,k dii , ii and the value of are to be optimized with the metaheuristic optimization algorithms.

The MELGWO algorithm
The gray wolf optimizer (GWO) algorithm [40] suffers from slow convergence and being trapped in local optima when applied to multi-modal optimization problems.To address these limitations, a modified version of GWO called MELGWO was proposed [41].The modifications include a memory swarm to store the best solutions found during iterations, evolutionary operators to enhance search efficiency, stochastic local search, and Linear population size reduction technique (LPSR) into the basic GWO algorithm to improve its capabilities for both exploitation and exploration, and to maintain a better balance between the two.The following ( 16) subsections describe the procedures of exploration and exploitation of the proposed algorithm, also the pseudocode is described in Algorithm ( 1).

Initialization and fitness evaluation
Initially, the algorithm identifies the three wolves with the lowest cost function values in the population, denoted as X , X and X , corresponding to the alpha, beta, and delta wolves, respectively.During each iteration, these three wolves are regarded as the leaders and are assumed to contain the optimal solution.All wolves randomly move toward these leaders to explore the region for the optimum.The position of each wolf (i.e., i = 1, 2, ..., N P ) is updated in every iteration using Eqs.( 20)-( 23) [40,41], where N P represents the population size.
where j represents the index for the dimensions of the prob- lem and ranges from 1 to D .denotes a coefficient that grad- ually decreases from 2 to 0 as the iterations progress.The term rand represents a random number generated from a uni- form distribution between 0 and 1 .The calculated positions of the ith wolf, X 1 , X 2 , and X 3 , correspond to the directions toward the alpha, beta, and delta leaders, respectively, during the random movement.Since the ith wolf can only occupy one position, its position after the iteration is determined by taking the average of X 1 , X 2 , and X 3 [40,41] as follows.
The value of X i,j , representing the position of the ith wolf in the jth dimension, is compared with the lower and upper bounds of the jth variable.If X i,j is outside the range defined by these bounds, it is set to the corresponding limit.

Memory swarm modification
The memory swarm of wolves is designed to store the present position and corresponding cost function value of the explorer swarm wolves, including the initial best solutions (20) 546 Page 8 of 17 (alpha, beta, and delta).The memory swarm is updated with better wolves from the explorer swarm after performing evolutionary operations.

Evolutionary operators
The incorporation of evolutionary operators into the gray wolf optimizer (GWO) algorithm's explorer swarm can improve its search efficiency.Among the evolution-based algorithms, Differential Evolution (DE) has simple principles, few parameters, and is widely used.DE consists of three primary processes: mutation, crossover, and selection.
After selecting an individual (target vector, X j ), two weight variances are applied to the population to provide variation.The mutation operator is defined as listed in Eq. ( 25) [41] where X alpha and X j represent the position of the best wolf and a random wolf.To ensure that wolves can evolve in a way that benefits their development, an optimal variation factor must be created.A dynamic scaling factor listed in Eq. ( 26) [41] is developed to increase the algorithm's explora- tion ability during the initial search process, allowing it to escape local optima and strengthen the local search in later iterations.
where f max , f min , It max and It represents the maximum and minimum values of F , maximum number of iterations and current iteration number, respectively.The target vector, X j , is then crossed over with the cor- responding variation vector V (t+1) j to generate a test individual, U (t+1) j as listed in Eq. ( 27) [41] where a stochastic tech- nique is employed to ensure that at least one bit of U (t+1) j is different from the variation vector, V (t+1) j .where V j , U j and X j represent the variation, trial, and target vectors and P c is the probability of crossover.The process of selecting between trial and target vectors involves the implementation of a greedy strategy.Once mutation and crossover have been performed, the resulting trial vector, U (t+1) j , is compared with the target vector, X t j .The superior vector is then chosen as the new solution, as illustrated in Eq. ( 28) [41].( 25)

Stochastic local search
The implementation of stochastic local search is executed in proximity to half of the wolves that have been randomly selected.For the ith wolf within the memory swarm, the local search process entails several steps.Initially, the nearest neighboring wolf is identified among all the wolves within the memory swarm, based on the Euclidean distance between their respective positions within the search space.The corresponding position of the nearest neighbor is denoted byX n,j , where j = 1, 2, ..., D.
During step 2 of the process, a local or temporary wolf (referred to asX t,j , where j = 1, 2, ..., D ) is stochastically generated based on the cost function of the nearest neighbor.If the cost function of the nearest neighbor is less than or equal to that of the current ith wolf, the temporary wolf is generated using Eq. ( 29) [41], which generates a new neighbor that lies between the i th wolf and its neighbor.Conversely, if the cost function of the nearest neighbor is higher than that of the ith wolf, the temporary wolf is gen- erated using Eq. ( 30) [41], which generates a new neighbor that is situated away from the nearest neighbor.
In this study, the acceleration coefficient, denoted as c 1 , has a fixed value of 2 .The position of the particle, X t,j , is assessed for satisfaction of the specified bounds.If any of the bounds are violated, the corresponding value of X t,j is adjusted to the violated bound.

Linear population size reduction technique
LPSR involves removing members of the wolf population by utilizing a linear equation.At iteration 1 , the wolf popu- lation size is P int , while the final wolf population size is represented as P min .The wolf population size for the suc- ceeding generation, N G+1 , is calculated using Eq. ( 31) [41].
In this study, P min is defined as the minimum number of wolves, which is determined by the algorithm's parameters or can be specified by the user.For this research, P min is (28) set to 10 .The current number of function evaluations is represented by NFE , while the maximum number of func- tion evaluations is denoted as MaxNFEs.

Enhancing the controller performance through optimization
All of the simulations provided in this study have been run in MATLAB/SIMULINK with the ODE45 solver,listed in Eq and the simulation time is taken to be 5 s.Equations (32), (33) and (34), list the desired trajectories of the links.The integral time absolute error (ITAE) is listed in Eq. ( 35) served as the objective function of the tuning process.A representation of the SMC-PID optimization process is shown in Fig. 5. Table 2 lists the various parameters of the MELGWO and the other algorithms in literature have been utilized to optimize controller gains.
The curves of objective function values versus iteration for MELGWO and other optimization techniques from literature study such as Particle Swarm Optimization (PSO), Golden Jackal Optimizer (GJO), Enhanced Artificial Bee Colony with Multi-elite Guidance (MELGWO), Genetic Algorithm (GA), Artificial Bee Colony (ABC), Sine Cosine Algorithm (SCA), Jellyfish Search Optimizer (JSO), Arithmetic Optimization Algorithm (AOA), Whale Optimizer Algorithm (WOA), Differential Evolution (DE), and gray wolf optimizer (GWO) are depicted in Fig. 6.   the sliding surface and switching mode gains in the controller have been specifically chosen to ensure the system stability.The process of selecting these values incorporated several factors, including the physical properties of the system such as inertia and weight of each link, as well as the system dynamics, desired performance, and stability criteria.These considerations were crucial in determining the lower bounds that would guarantee the stability of the system and ensure its proper functioning.
On the other hand, the upper bound values were selected in a more approximate manner.While these values have not been derived through a rigorous optimization process, they were carefully chosen to establish a reasonable range for the parameters without violating any operational constraints.The intent behind this selection was to encompass a broad range of feasible values that could be explored for experimentation and analysis purposes.7a, b, c demonstrates the trajectory tracking of each link and Fig. 7d shows the X-Y plot of end-effector.As it can be seen, the desired and actual trajectories are nearly identical.The controller exhibits superior tracking performance, as evidenced by the objective function values of links 1, 2, and 3. Which are 0.002709, 0.005522 and 0.000042, respectively.

Comprehensive performance assessment
A robust controller must eliminate measured and unmeasured noise and disturbance and be adaptable to any uncertainties in the system [3].Therefore, disturbance and noise rejection and adaptability to mass uncertainty in the payload have been investigated and provided in this section.Furthermore, the effect of the joint's flexibility is also investigated.

Disturbance and noise rejection
The dynamic disturbance signal and noise, listed in Eqs.(36) and (37), are injected at the output of each controller and sensor of joint at the same time as shown in Fig. 8. where i=1:3 and i , i correspond to the applied torques and measured angles, respectively.
The systems performance is checked for varying percentage (per) values from 1% to severe conditions of 5% percent- age of disturbance and noise.The corresponding objective function values of the optimized controller with MELGWO to the variation in percentage of disturbance and noise are listed in Table 5.
The controller has been designed to minimize the error-based OBJF, and its effectiveness is evident from the observed percentage of increase in OBJF values.This increase ranges from 0.829% under conditions of low dis- turbance and noise to 43.108% under conditions of severe disturbance and noise.

Adaptability to the variation in mass of payload
The primary objective of a maneuvering system is to perform the task of gripping and manipulating objects with diverse masses using its end-effector.When there is a change in the mass of the end-effector, it introduces a new configuration to the system, necessitating the need for a robust controller.The robust controller is essential to mitigate the impact of variations in the end-effector mass and ensure stable and reliable performance [3].The mass of the payload has been incrementally increased by 0.1 kg, ranging from 0.1 to 0.5 kg, in order to evaluate the robustness of the controllers.OBJF values corresponding to the increasing payload mass (Table 6).
The optimized controller utilizing the MELGWO algorithm demonstrates resilience in the face of payload mass variations.Through analysis, it is observed that the OBJF values exhibit an inflation ranging from 1.903% under low uncertainty conditions to 27.7028% under severe uncertainty conditions.This indicates that the controller maintains its performance and robustness even in challenging situations with significant uncertainties.

Effect of joint flexibility
In this section, we will examine the effectiveness of the optimized controller approach in dealing with the impact of joint flexibility.To simulate the system, we utilize the Simscape Multibody toolbox, which allows us to model the three joints as flexible elements.These joints exhibit internal mechanics characterized as listed in Table 7.This configuration enables us to analyze how the controller responds when joint flexibility is present and assess its ability to adapt to such conditions.Figure 9a, b, c shows the error in the trajectories of link 1,2 and 3, respectively, and Fig. 9d shows the X-Y plot of end-effector.It can be observed that the proposed controller demonstrates exceptional tracking performance with 0.0068, 0.0192 and 0.2162 objective function value for each link, respectively.This indicates the controller's capability to effectively handle flexible joint manipulator (FJM), ensuring precise and smooth trajectory tracking.

Conclusion
The optimization of a sliding mode controller with a proportional integral derivative (PID) surface has been achieved by employing an enhanced gray wolf optimizer algorithm (MELGWO).The selection of the optimal parameters of the sliding surface poses a challenge due Fig. 8 The optimized manipulator subjected to disturbance at controller output and noise at sensors  to the vast search space, leading many existing optimization algorithms to become trapped in local optima and fail to identify the optimal parameters for the sliding surface and switching mode controller gain.The MELGWO algorithm is chosen for its exceptional exploratory and exploitative techniques, enabling it to find the best solution.The convergence analysis conducted in this study provides evidence of the MELGWO algorithm's exceptional capability to overcome local minima through its proficient exploration and exploitation techniques.This algorithm demonstrates superiority over other algorithms mentioned in the existing literature in terms of its ability to navigate and escape from local minima solutions.
The investigation focuses on disturbance and noise rejection, as well as robustness against uncertainty in payload mass.The proposed controller demonstrates the ability to mitigate the effects of disturbances and noises, maintaining the objective function (OBJF) at a minimum even in highly noisy and disturbed systems.The controller effectively minimizes the OBJF, with the percentage increase in OBJF values ranging from 0.829% under conditions of low disturbance and noise to 43.108% under conditions of severe disturbance and noise.Additionally, the optimized controller exhibits resilience to variations in payload mass analysis, with the percentage increase in OBJF values ranging from 1.903% under low uncertainty conditions to 27.7028% under severe uncertainty conditions.Furthermore, the adaptability of the controller to joint flexibility is evaluated, demonstrating superior tracking performance with minimal vibration in the movement of the end effector.

Fig. 1
Fig. 1 Representation of the three-link robotic model

Fig. 2
Fig. 2 MATLAB Simscape model of the robotic manipulator

Fig. 5
Fig. 5 Schematic representation of the optimization process

Fig. 6
Fig. 6 Convergence history of the optimization process versus iteration

Fig. 7
Fig. 7 Tracking trajectory curves for a link 1, b link 2, c link 3 and d X − Y plot of the end-effector

Fig. 9
Fig. 9 The trajectory tracking curves of the FJM system: a Link 1, b Link 2, c Link 3, and d the X − Y plot of the end-effector

Table 1
The physical parameters of the three-link robotic manipulator i Moment of Inertia ( kgm 2 ) 0.0033

Table 3
displays the parameters of the robotic system model's upper and lower search spaces, together with the MELGWO optimized values.The lower bound values for

Table 3
The search space and best parameters of the controller using MELGWO algorithm Table 4 presents the best, average, and worst objective function values obtained by the MELGWO optimizer in comparison to other meta-heuristic algorithms in the literature where ten separate runs of each algorithm have been performed.It is notable that the MELGWO algorithm has produced the minimum results overall runs with the lowest standard deviation with the lowest objective function values.The later finding illustrates how the MELGWO method outperforms other algorithms in the literature in terms of result superiority and robustness.Figure Table provides a comprehensive list of the obtained

Table 4
Objective function of MELGWO Algorithm compared with other algorithmsBold indicates the specific values that denote the results achieved through the application of the present algorithm

Table 5
OBJF variation against the percentage of disturbance and noise

Table 7
The internal mechanical properties of the FJM configuration Author contribution MIA done Simscape modeling, writing-conceptualization and methodology, original draft preparation, and optimization developing.AMMA done writing-original draft preparation and preparation of figures.SE helped in preparation of figures and supervision, writing-reviewing and editing.KAFM contributed to original draft preparation, investigation, writing-reviewing and editing.KRA helped in idea, mathematical modeling, preparation of figures, writingconceptualization and methodology, writing-reviewing and editing and supervision.All authors have reviewed the manuscript.Funding Open access funding provided by The Science, Technology & Innovation Funding Authority (STDF) in cooperation with The Egyptian Knowledge Bank (EKB).Open access funding provided by The Science, Technology & Innovation Funding Authority (STDF) in cooperation with The Egyptian Knowledge Bank (EKB).