Linear inverted pendulum control based on improved ADRC

ABSTRACT An improved active disturbance rejection control (ADRC) strategy is proposed for the control precision improvement of the trolley position and the pendulum angle of the linear inverted pendulum. First, a new nonlinear function with improved continuity and conductivity around the zero point is designed. On the basis of this new function, the control rates of the extended state observer (ESO) and the nonlinear state error feedback (NSEF) of the traditional ADRC controller are improved. Second, with the improved ESO, the various disturbances of the trolley position and the swing angle of the first-order linear inverted pendulum are expanded into two states. These two states are then observed in real time and linearly compensated. Third, with the improved control rate of the NSEF, the nonlinear integration method is adopted to nonlinearly combine the differential and the error differentials and subsequently provide high quality control to the system. Finally, simulation and experimental verification of the linear inverted pendulum control system based on the improved ADRC are conducted. Results show that the proposed control strategy has higher control precision and robustness than the double-closed-loop PID.


Introduction
The inverted pendulum system, as the model base of shipboard radar, rocket launch systems, and satellite attitude control, has been the focus of many research in the past few decades. The inverted pendulum is a typical nonlinear strong coupling system, and it is widely used to verify the performance of control systems. For example, Lan and Fei (2011) proposed the use of a nonlinear dynamic system controller of a double-parallel inverted pendulum based on the state space pole placement method. The reliability of the method was verified through system application. Prasad, Tyagi, and Gupta (2014) used the inverted pendulum system as the control object and compared the control performances of proportion integration differentiation (PID) and linear quadratic regulator (LQR) of a nonlinear system, and the result established the comparative advantage of the LQR control method. Al-Janan, Chang, and Chen (2017) proposed a neural multi-objective genetic algorithm, and its effectiveness in controlling sensitive coupled systems was verified on a double-inverted pendulum system. In general, the positions of the inverted pendulum system and the angle of the swinging rod are coupled to one another. Thus, the control accuracy of the traditional method can be insufficiently high when the two coupling quantities of the CONTACT Lichao Wang wanglc@ahpu.edu.cn trolley position and the swinging rod angle are managed effectively (Mahmoud & Nasir, 2017;Mou & Liu, 2015;Wang, Li, & Tong, 2013). However, problems related to the control precision improvement of inverted pendulums need to be urgently solved. Moreover, the research on inverted pendulums should not only focus on the difficulties of controlling a pendulum as a consequence of its increased number of stages, but studies also need to consider the associated complexities, instability factors, and nonlinear characteristics; thus, a continuous study of new theoretical methods is necessary to extend the knowledge about the above topics (Guo, Wu, & Zhou, 2016;Lin, Qian, & Xue, 2002;Ma, 2015;Xin, Yaz, & Schneider, 2017). The ADRC is a nonlinear control method initially proposed by Han J. Q. 20 years ago. Since then, the popularity of ADRC has increased due to its superior quality and ease of engineering application. An ADRC controller consists of three parts: a tracking differentiator (TD) to arrange transition processes and optimize input signals; an ESO to observe internal and extended states and improve system controllability; and NSEF to provide effective control (Wang & Huang, 2013;Wang, Li, & Tong, 2011). The ADRC controller inherits the advantages (e.g. simplicity, ease of implementation, and robustness) of the PID controller and treats the uncertainties (e.g. internal disturbance and external disturbance, i.e. total disturbance) as internal disturbance, which suggest that certain problems need to be solved (Liu & Li, 2001;Xue & Huang, 2015). The ADRC controller also has the characteristics of simple algorithm and strong anti-interference ability. In particular, the controller design concept re-applies the idea of 'using error to remove error', which allows users to greatly reduce the need to fully understand the internal structure of the system, as means of improving the applicability of ADRCs in practical engineering. Many scholars have studied ADRC from different aspects. Huang and Han (1998) used ESO to apply continuous identification of a system. On this basis, Zhang and Han (2000) investigated the ADRC model compensation mechanism to gradually improve identification accuracy. Wang, Xing, and Ma (2017) designed an improved TD as a feedback channel for ADRC to be used in the coupled system and verified its feasibility by performing experiments. Wang, He, and Sun (2010) designed a decoupling anti-disturbance control scheme for integrating flight propulsion control. Zhao and Gao (2010) studied the specific strategy of applying LADRC to control a non-minimum phase system. On this basis, Zhao, Sun, and Li (2014) and Sun, Li, and Gao (2016) offered a comprehensive and more efficient method for designing ADRCs for non-minimum phase systems.
Although widely used, ADRC is not versatile and its control capability is limited by sampling steps, noise, actuators, disturbances, and so on. To further widen its applicability in different fields, scholars have introduced improvements to ADRC in many aspects. For example, Yang, Cui, and Lao (2016) proposed a method for two-degree-of-freedom TRMS control based on activedisturbance rejection control and input shaping. According to the experimental results, the method was effective against interference under complex coupling conditions. In the time domain, Yu, Wang, and Shao (2016) adjusted the bandwidth of ESO, analyzed the influence of various parameters on the phase margin and crossover frequency of the control system in the frequency domain, and designed a self-disturbance tracking controller. The results of strength simulation have proven the effectiveness of the proposed control performance.
A method for switching the control between linear and nonlinear active-disturbance rejection controllers and methods for parameter tuning and stability analysis were proposed by Li, Qi, and Xia (2016). Overall, owing to the nonlinear relationship between the position of the inverted pendulum system and the angle of the pendulum, dynamic system uncertainties are increased. Furthermore, the traditional ADRC is not fully applicable to the first-order linear inverted pendulum. Therefore, on the basis of a newly constructed nonlinear function, an improved ADRC method for enhanced application to the first-order linear inverted pendulum is proposed, and its good control performance is verified by simulation and experiment.
This paper is organized as follows. First, the mathematical model of the system is compared with the model of the driving motor. Second, the improved new nonlinear function is derived, the improved versions of ESO and NSEF based on the nonlinear function are designed, and an improved version of ADRC based on the improved ESO and NSEF is constructed. Finally, the simulation and experiment results of the improved ADRC and the double-closed-loop PID are compared. The conclusion is presented in the last part of this paper.

Modelling of the linear inverted pendulum
The linear inverted pendulum is driven by a single motor as a single-input and double-out coupling system. When modelling a linear inverted pendulum system, the following assumptions are often made: (1) the pendulum is vertical when it is balanced; (2) the system has a rigid motion and ignores elastic potential; and (3) the system also ignores the friction coefficient of the trolley movement and the pendulum swing. An inverted pendulum model is shown in Figure 1.
The model is linearized, as shown in formula (2).  where x is the displacement of the trolley, θ is the angle of the pendulum and the angle vertical direction in the clockwise direction, M is the mass of the trolley, m is the mass of the pendulum, l is the centroid of the pendulum to the length of the two ends, and F is the force received by the trolley.

Servo motor modelling
A simplified model of the AC servo motor is obtained on the basis of the following assumptions on the inside part of the motor: (1) Stator winding has a three-phase symmetrical mechanism, and the three phases have a Y-shaped distribution in space and are mutually different by 120°.
(2) The saturation and associated losses of the stator core and the rotor core are excluded.
(3) A no-damper-winding on the rotor exists, i.e. the permanent magnet does not have a damping effect. (4) The air-gap magnetic field generated by the stator winding is sinusoidal, but harmonics is not considered. (5) The saturation and related losses of the stator core and the rotor core are both ignored. (6) With regard to the effect of magnetic saturation, the magnetic circuit in space is linear. The dynamic equation of motion is obtained as follows: where T e is the electromagnetic torque generated by the motor, T l is the load torque generated by the motor, B is the friction coefficient of the motor, ϕ is the angular position of the motor rotor, and J is the moment of inertia of the AC servo motor. The dynamic characteristic structure is shown in Figure 2, i q represents torque current.

Design of the new nonlinear function
The nonlinear function, which is used for both TD and ESO, comprises the core content of the entire ADRC design. The commonly used nonlinear function is the fal(e, a, δ) function, which is expressed as The fal(e, a, δ) function is derived at segmentation point δ to verify conductivity at the segmentation point.
The left and right derivatives differ at the segmentation point, and the same is true at the other segmentation point, which indicate non-steerability of the original function. Moreover, even if the fal(e, a, δ) function is continuous at the origin and the segmentation point, it is not steerable at these two positions. Owing to the lack of good continuity and smoothness, the fal(e, a, δ) function is updated to one that is steerable at the origin and breakpoints and with good continuity and smoothness.
The interpolation fitting method of combining polynomial and trigonometric functions is adopted because the parameter δ in the nfal(e, a, δ) function is typically less than 1. In this interval, sin e exhibits better stability than tan e, while tan e exhibits better performance than e 3 . These convergence and interpolation mechanisms ensures that the function is continuous and steerable at the zero point. The fitting process needs to satisfy the conditions of continuous conduction. Thus, the following formulas are established:  Subsequently, we can derive the expression of the nfal(e, a, δ) as function (9).
An analysis of the algebraic form of the nfal(e, a, δ) function indicates that the coefficient of the e 2 term, which has been set at the time of interpolation fitting, is zero. Moreover, the two functions of l 1 sin e and l 3 tan e are present in the formula, which implies that the convergence of the new function after interpolation fitting can be further improved.
In the comparative simulations between the fal(e, a, δ) and nfal(e, a, δ) functions, δ = 0.01 and a = 0.25. The function curves are shown in Figure 3. In the figure, the fal function has an inflection point at x = ±0.1. In general, the nfal function has better continuity and smoothness than the fal function.
Then, the performance of the nfal(e, a, δ) function with different values of a and δ is verified. The first set of values is δ = 0.01, a = 0.1, 0.25, 0.5, 1, whereas the second set is δ = 0.01, 0.05, 0.1, 0.2. The results are shown in Figure 4 The value of a affects the nonlinearity of the above function. The smaller the value is, the higher the nonlinearity of the fal function will be. The nonlinearity of the function increases at a = 1. However, an inflection point is observed at x = ±0.1, while smoothness is apparent at a = 1. Thus, smoothness can be improved, but the degree of nonlinearity is insufficient. According to research experience, the value of a is generally between [0, 1]. Additionally, d is the width of the linear interval of the function, which is related to the error range. The value of d should be set as small as possible. However, if the value is too small, then high-frequency fluttering will occur. According to research experience, the value of d is generally between [0.01, 0.2].

TD design
Considering that the angle of the pendulum is nearly zero, the speed and the amplitude of the change are both small, and thus, the initial error can be neglected. TD corresponds to the transition process of trolley displacement X, and it uses the nonlinear function for the smooth approximation of the generalized derivative of the input signal. The transition process is arranged according to the reference input to obtain smooth input signal, and the algorithmic expression is where t is the input signal, h is the integration step, and u = fhan(x 1 − X r , x 2 , r, h 0 ). Its tabular algorithm is where X r is the input of a given target position, x 1 is tracking signal of X r , h is integration step size, and r is tracking speed factor. The parameters that need to be set are simulation step h and tracking factor r. Parameter h is used to determine tracking accuracy. The larger the value is, the better the tracking accuracy will be. However, a value that is too large will cause signal phase loss. The setting principle is therefore applied to ensure that the signal is not lost as much as possible. Meanwhile, parameter r will affect the tracking speed of the output signal. The larger the value is, the better the value will be, but overmodulation will occur. Similarly, the setting principle is applied to obtain a small value as much as possible while ensuring tracking speed.

Improved ESO design
The improved ESO design based on the first-order linear inverted pendulum comprises the core of the improved ADRC. The improved ESO can estimate unknown external disturbances and generate feedback for the output, and it is compensated in the feedback to achieve object reconstruction. The two identical parameters of ESO1 and ESO2 are used in the structure. The algorithmic expression of ESO1 is where ε 1 is observation error; u is control output; β 11 , β 12 and β 13 are the gains of the improved ESO; a 1 , a 2 and a 3 are the nonlinear factors, where a 1 = 0.5, a 2 = 0.25, a 3 = 0.125 in general;b 0 is the estimated value of the compensation factor, where b 0 = 2.485; and δ is the filtering factor, where δ = 0.01. The three key parameters of β 11 , β 12 , β 13 need to be set because their values will affect the disturbance estimation of the system lag. The larger the value is, the smaller the lag will be. However, a value that is too large will result in an overshoot and oscillation of the total disturbance estimation value and further cause oscillation of the control amount. When β 11 and β 22 change slightly, a negligible effect on control performance will likely be observed; by contrast, when the change is too large, the system will oscillate. In setting the ESO parameters, the values should also accord with overall control requirements to ensure stability. On the basis of research experience, system bandwidth should be set to β 11 , β 12 and β 13 , and the improved ESO should satisfy the following equations:

Improved NSEF design
NSEF is an error-nonlinear algorithm controller between TD and ESO state variable estimates. The amount of compensation of the total disturbance of ESO and that of NSEF constitutes the control amount of the system. The traditional NSEF only uses the proportional and differential aspects of error signals for nonlinear calculation, whereas the optimized NSEF can add the integral part of the signal to improve control precision and enhance system immunity and robustness. Given that the swing range of the swing lever angle θ is small during control and the swing lever's initial position is set to zero, the errors of Z 21 and Z 22 of swing lever angle θ and angular velocityθ are used as inputs in NSEF by default. The algorithmic expression of NSEF is u 0 = β 21 nfal(e 1 , α 1 , δ 1 ) + β 22 nfal(e 2 , α 2 , δ 1 ) +β 23 nfal(Z 21 , α 3 , δ 1 ) + β 24 nfal(Z 22 , α 4 , δ 1 ) where e 1 and e 2 are the differentials of two error signals, and a 1 , a 2 , a 3 , and a 4 are nonlinear factors. The values of a are as follows: a 1 = 0.75, a 2 = 0.5, a 3 = 0.25, a 4 = 0.125. Meanwhile, β 21 , β 22 , β 23 and β 24 are the gains of trolley position error, trolley position differential error, pendulum error, and pendulum error differential, respectively. The five parameters of β 21 , β 22 , β 23 , β 24 , and δ 1 need to be set in the optimized NLSEF.

Improved ADRC design
To realize stable control, the control of the trolley displacement must take into account the control of the pendulum angle. We assume that the compensation input of the control law of the system control voltage is the sum of the disturbances of two identical but independent expansion observers, with trolley displacement and swing angle are used as the inputs. The same but independent expansion observers are used to compensate the disturbances. The structure is shown in Figure 5. In the figure, X r is the target position input; x 1 is the X r tracking signal; x 2 is the differential signal of X r ; i q is control quantity; Z 11 and Z 12 are the state estimation outputs of trolley position and trolley speed, respectively; and Z 13 is established with trolley position as the output. The disturbance estimation of the system equations of Z 21 and Z 22 is the state estimation output of the pendulum angle and the pendulum angular velocity, respectively. Additionally, Z 23 is the disturbance estimation of the system equation established by the pendulum angle as the output.

Simulation analysis
The cascade control of the PID control system has the advantages of small overshoot, good stability, and good anti-interference performance. In the experiment, the improved ADRC is compared with the double-closedloop PID for the first-order linear inverted pendulum. The designed inner-end inverted pendulum with doubleclosed-loop PID control system uses feedback correction control for the inner ring, while the feedback correction mechanism uses the PD controller as the X regulator. To suppress interference, a proportional link is integrated into the forward channel. Moreover, the outer loop control uses the PD controller as the θ regulator. To enable the system to have good tracking ability, unit feedback is used to form the outer loop feedback channel, in which the feedback coefficient is K = 1.
The parameters of the first-order linear inverted pendulum system are as follows: trolley mass is M = 1 kg; swing bar is m = 1 kg; the distance from the two ends of the pendulum to the centroid is l = 0.3 m; gravitational acceleration is g = 10 m/s 2 ; sampling period is h = 0.005 s; the initial position of the trolley is X = 0 m; the initial angle of the swing rod is θ = 0 rad; and the reference position of the trolley is X = 0.1 m. The simulation of the first-order linear inverted pendulum is conducted under the conditions of no interference and white noise interference. The parameters used in the simulations of the double-closed-loop PID and the improved ADRC are shown in Table 1.
As shown in Figures 6 and 7, the range values of control force u without interference for the double-closedloop PID and the modified ADRC are [−0.31, 0.35] (N) and [−0.21, 0.27] (N), respectively. The trolley position adjustment times are 3.22 and 6.13 s, and the overshoots of the trolley position are 13.5% and 0%, respectively. The corresponding adjustment times of the pendulum angle are 3.81 and 5.96 s. These findings indicate that the improved ADRC performs better than the double-closed-loop PID based on trolley position and pendulum simulations. The Table 1. Double-closed-loop PID and improved ADRC parameters for the linear inverted pendulum.   The comparisons of the control curve parameters of the double-closed-loop PID and the improved ADRC are shown in Table 2. As shown by the results, the improved ADRC has better speed and robustness than the doubleclosed-loop PID with less control, mainly because the latter has not been designed with an observer for the  control object. Moreover, in using the double-closed-loop PID, the 'sum of disturbance' of trolley displacement and swing angle is not observable in real time, the adjustment time is too long, and the anti-interference ability is relatively poor. In addition, the improved ADRC is based on the new function type, and the improved ESO of the linear function can guarantee real-time observation of system errors and provide high-quality control through improved NLSEF, thus ensuring rapid adjustment and good anti-interference ability.

Experiment analysis
In the linear inverted pendulum system, only the AC servo motor drives the system. This mechanism is analyzed for the linear inverted pendulum by comparing the improved ADRC, which is based on the new nonlinear function, with the double-closed-loop PID control drive motor (AC servo motor). The parameters of the AC servo motor used in the system are shown in Table 3. Figure 10(a), (c), and (e) show the control curves of the modified ADRC with AC servo motor, while Figure 10(b), (d), and (f) show those of the double-closed-loop PID. In these figures, red represents reference value, while blue represents tracking values. 'cts' is the unit of motor resolution in the ordinate of the graph. The resolution of the motor used in this experiment is 1024 cts, which means that 1024 cts is a rotation of the motor.  By contrast, in the double-closed-loop PID, the signal takes approximately 0.3 s to reach stability, and it overshoots by 16%. Figure 10(e) and (f) show the sinusoidal velocity signal with amplitude of 3000 cts/sec and frequency of 1 Hz. The speed response curve of the improved ADRC is essentially the same (i.e. no phase lead or lag), and tracking error is nearly non-existent. By contrast, in the doubleclosed-loop PID, speed amplitude is greater than fixed amplitude, which indicates phase lag, and the tracking error is large.
The comparative results show that the improved ADRC has better control precision than the double-closed-loop PID. The findings can be attributed to the improved ESO, which is based on the improved nonlinear function, that can accurately observe errors. Moreover, the improved NLSEF can render high-quality control, thus ensuring control accuracy of the improved ADRC.

Conclusion
In this study, an improved active disturbance rejection controller is designed and implemented for the linear inverted pendulum. First, Newtonian mechanics is used to establish the mathematical model of the linear inverted pendulum and the model of the driving motor. Second, a nonlinear function with improved smoothness at the origin is derived by the formula, and the reasonable parametric range of the nonlinear function is determined by simulation. Third, the new nonlinear function is used to design the improved ESO and the improved NSEF. The improved ESO1 and ESO2 can estimate the values of the pendulum angle and the position of the trolley, respectively. The improved NSEF applies nonlinear calculation to the ratio, differential, and integral of the error signal, thus obtaining good control efficiency and effect. Finally, the superior overall performance of the improved ADRC over the double-closed-loop PID is verified through comparative simulations of the linear inverted pendulum.  The experimental comparisons of the motor of the firstorder linear inverted pendulum confirm that the obtained performance improvement is based on the newly proposed nonlinear function. The improved ADRC has better robustness and control accuracy than the double-closedloop PID.

Disclosure statement
No potential conflict of interest was reported by the authors.