Smooth-Switching Control of Robot-Based Permanent-Magnet Synchronous Motors via Port-Controlled Hamiltonian and Feedback Linearization

To solve the contradiction between dynamic performance and steady-state performance of the robot system, a smooth-switching control strategy is proposed. By combining robot and motor model, the complete model of the robot driving system is established. The single-loop Feedback Linearization (FL) controller and Port-Controlled Hamiltonian (PCH) controller based on the complete model are derived to ensure the rapidity and stability of the system respectively. A smooth-switching function based on position error is designed. It can ensure the smooth-switching between two controllers and avoid the instability caused by switch-switching. The proposed algorithm can make the robot system have good dynamic and steady performance. Simulation and experiment results demonstrate the effectiveness of the smooth-switch control strategy.


Introduction
With the wide application of robots, position control has become a hot topic. The robot is a nonlinear control system with strong coupling characteristics. Due to the influence of modeling imprecision and external disturbance, the precision of robot end-effector is always a difficult problem. At present, the control of joint robot usually separates the robot from the driving motor. Only the robot dynamics is considered, and the simulation analysis is done at the position-loop level, without considering the actual driver model, which is not easy to be implemented in engineering. The driving motor of joint robot is usually permanent-magnet synchronous motor (PMSM). The control of it is always a hot topic due to its multi-variable and strong coupling characteristics.
PID control is widely used in industry. Many experts and scholars have done a lot of research on PID control [1][2][3][4][5]. P. R. ouyang et al. proposed a position domain nonlinear PD control method, which effectively improved the transient response performance [1]. An online self-tuning PD controller of robot manipulators is designed in reference [4]. It has good performance under large interference. With the development of science and technology, there are numerous nonlinear and intelligent control methods, such as backstepping control [6][7][8], sliding mode control [9][10][11], adaptive control [12][13][14], robust control [15][16][17], H∞ control [9,18], fuzzy control, neural network control, feedback linearization control and so on. These control methods have aroused the interest of many scholars. Kanellakopoulos and Kokotovic et al. proposed backstepping control [6]. Since then, backstepping control has been developed rapidly. Petit et al. adopted the backstepping control method of multi-joint robot tracking control to solve the problems of noise state measurement and high-order state derivative [7]. However, the computational explosion problem of backstepping control is difficult to solve. Sliding mode control has fast dynamic response. It is insensitive to the system model and has high robustness. The single-loop sliding mode control of PMSM based on nonlinear disturbance observer is proposed in reference [9]. In reference [10], a new controller combining neural network with sliding mode control is proposed, which overcomes the requirement of system uncertainty bound by sliding mode controller. However, no matter how optimized, the chattering problem of sliding mode control still exists. It is inevitable that chattering damages the system. Adaptive control can adjust the parameters of the controller automatically. Sayed Bagher Fazeli Asl proposed an adaptive backstepping sliding mode control method, which improved the reaction speed of the system and effectively reduced chattering of the sliding mode [11]. Han et al. taking robot tracking control as an example, adaptive method is adopted to improve the approximation performance of neural network [13]. A new adaptive backstepping control method is proposed in the literature [14], which improves position accuracy and has a good compensation effect for disturbance. However, the design of adaptive controller is very complex, and the stability of adaptive control is difficult to guarantee when the system uncertainty is large. Homayounzade et al. designed a robust controller for the robot system, which can deal with mechanical and electrical uncertainties at the same time, eliminating the limitations of previous robust control methods on system uncertainties [15]. Makarov et al. used H∞ framework to design a two-degree of freedom robot controller [18], which cannot only withstand the uncertainty or change of model parameters, but also predict the future trajectory within a given time range and accurately track the given reference trajectory, with strong robustness. Fuzzy and neural network control have been widely concerned since they were proposed. However, due to the limitation of hardware, they are difficult to apply in practice. Feedback linearization control can adjust the dynamic response time of the system by assigning poles. Cambera et al. designed a feedback linearized controller [19] by using double-loop cascade control to solve the trajectory tracking problem of single-link robot under the action of gravity. A simple learning strategy-based feedback linearization control for uncertain nonlinear systems is proposed in [20]. Yin et al. designed a nonlinear state feedback controller for robots combined with energy shaping [21], which can effectively suppress vibration and reduce motor position oversetting, and theoretically prove its global convergence.
All the above control methods are based on the idea of signal transformation. These methods can make the system have good dynamic response. In general, the steady-state characteristics of systems based on these methods are not very good. In 1989, Ortega and M. Pong proposed passivity-based control (PBC) to study the stability analysis and controller design of nonlinear systems [22]. In 2002, professor R. Ortega et al proposed the passive control method of interconnection damping configuration (IDA-PBC) for the port Hamiltonian system [23]. Professor Haisheng Yu applied Hamiltonian method to permanent-magnet synchronous motor and made good progress [24][25][26]. PBC is based on the view of energy transformation and the research of PBC becomes very popular [5,[27][28][29]. PBC can make the system have good steady-state performance, but its dynamic response is slow. A switching control method based on velocity error is proposed in reference [30], but the chattering of SMC still exists.
In this paper, a novel smooth-switching control strategy is proposed. A arctangent function based on position error is designed to ensure the smooth transition between two controllers. This avoids the risk of instability caused by switch control in the system. When the error is large, the signal controller works to ensure the rapidity of system response. When the system is near steady state, the energy controller plays a role to ensure the steady-state performance of the system. And by combining robot and motor model, a complete model of robot control system is given. It is easy to realize in engineering and simplify the design of the controller. Based on the complete model, feedback linearization controller and Hamiltonian controller of the robot control system are derived. The algorithm is compared with PID and SMC in MATLAB, and compared with PID on robot experimental platform ( Figure 1). The results show that the algorithm has better dynamic and steady performance.
The main contribution of this paper can be summarized as follows: 1. By combining the robot model with the PMSM model, the controller design is simplified, and the engineering implementation is easier. 2. Based on the complete model of robot control system, FL and PCH controller are given. 3. A novel smooth-switching control strategy is proposed to ensure the dynamic and steady performance of the system response.
This paper is organized in the following sections. In Section 2, the mathematical model of the robot drive system is given. Smooth-switching control strategy, feedback linearization controller and Hamiltonian controller are designed in Section 3. In Section 4, the simulation and experiment results verify the effectiveness of the proposed method. The conclusion is summarized in Section 5.

Mathematical Model of Robot Control System
The dynamic equation of the manipulator can be described as [31] D(q)q + C(q,q)q + G(q) = τ L − R fq (1) where q = [q 1 , q 2 , q 3 ] T is the joint position vector of the robot, D(q), C(q,q), G(q) and R f are inertia matrix, Coriolis matrix, gravity matrix and friction matrix of robot respectively, τ L is the vector of the load torques on the PMSMs. The kinematic equation of PMSMs of three-joints robot is described by where τ Lm = ητ L is the vector of the load torques of PMSMs, θ, ω are the position vector and speed vector of motors, J, R = diag {R 1 , R 2 , R 3 } are the matrix of moment of inertia and friction matrix of PMSMs, τ is the electromagnetic torque vector, and η is the matrix of reduction ratio, q = ηθ.
Combine (1) and (2), the mathematical model of robot control system can be obtained.
And the electrical model of the non-salient pole PMSM on the d − q axis is considered. The whole model of the robot control system is presented by the following equation.
where i d , i q and u d , u q are the vector of stator current and stator voltage on the d − q axis. L d , L q and R s is the diagonal matrix of stator inductance and phase winding resistance, n p is the number of pole pairs, Φ is permanent-magnet flux.

Design of Controller
The block diagram of the drive control system of the robot is shown in Figure 2. The motor drive system is added to the robot control block diagram. The q di , q i , i di , i qi of each axis passes through the signal controller and the energy controller to form two voltage signals u ei , u si . In addition, the u ei , u si form the driving voltage(u d , u q ) through the smooth-switching control strategy.

Signal Controller
The traditional feedback linearization controller of robot is shown in Appendix A.1. After combining the robot model with the motor model, the feedback linearization controller is deduced as follows. The mathematical model of robot control system can be redescribed as the following equation with the state vector x = [i d , i q ,q] T and the output vector Now, let α 1 = dy 1 dt , α 2 = d 2 y 2 dt 2 are the intermediate variables, then Then, the equivalent input variable α 1 , α 2 is taken as where k 1 , k 2 , k 3 , k 4 are diagonal constant matrix where each element is greater than 0. We can obtain that the error i d − i * d and q − q * decays exponentially at 0. Combined with Equations (6) and (7), the signal controller can be obtained

Energy Controller
The traditional PCH controller is shown in Appendix A.2. In this part, based on the model of robot drive system (4), the Hamiltonian model of the whole system is derived. Then the Hamiltonian controller for the robot drive system is given.
For the mathematical model (3), define the state vector where p r =Dq is angular momentum vector. Take the mechanical energy of the system as the Hamiltonian function H r (q, p r ) = 1 2 p TD−1 (q)p r +U(q) (10) According to Equations (1), (9) and (10), the Hamiltonian model of the robot can be obtained as followsẋ where For the i-th PMSM, define the input vector u mi = [u di , u qi , −τ Lmi ] T and the state vector

The Hamiltonian function of PMSM is chosen as
The i-th PMSM model can be written as PCH model For the whole control system, the two Hamiltonian systems cascading are still Hamiltonian system. Let the state vector x rm = [x T r , x T m ] T , and the control vector u rm = [τ T , u T m ] T . The Hamilton function is made up of (10) and (12) Then, the PCH model of the whole system can be written aṡ Define the state errorx rm = x rm − x * rm , and the expected Hamilton function where H r (x) = 1 2 p T D −1 (q)p r + 1 2q T K pq , and K p is diagonal matrix.
The system can be described as the following equation with the expected Hamilton function H ḋ Substitutingx rm = x rm − x * rm into Equation (18) leads tȯ By combining Equations (16) and (19), and Consideringẋ * rm = 0, the following equation can be obtained The PCH controller of the robot drive system can be obtained by proper configuration of J a and R a .
where a, R 1 , R 2 is the diagonal matrix to be configured. The Lyapunov function is chosen as V = H d (x rm ). From the reference [24], it can be obtained thaṫ V < 0. Therefore, the energy subsystem is stable.

Smooth-Switching Control
A novel smooth-switching control strategy is proposed in this part. When the error is large, the signal controller plays a role; when the error is small, the energy controller plays a role, and a smooth-switching function is designed in the middle for the transition. First, a smooth-switching function is designed to meet the switching requirements. Then the smooth-switching controller is presented with the function.
The smooth-switching function based on position error is designed as where e i = q i − q di , σ is the scale parameter. The function curve of G(e i ) is shown in the Figure 3 with the different σ.
(a)The response curve of G(e).
where e = [e 1 , e 2 , e 3 ] t is the error vector, u sd , u sq is the output of signal controller (8), and u ed , eq is the output of energy controller (21). Combining Equations (8), (21) and (23),the smooth-switching controller can be obtained. 4 (q −q * )) + L q (R s i q + n p ωL q i q + n p ωΦ)

Simulink Results
To verify the effectiveness of the smooth-switching control strategy, the simulation is done in Matlab. According to the pole assignment principle and a large number of experiments in the actual system, the controller parameters are selected as follows: Case 1: To verify the effectiveness of smooth-switching control strategy and the stability of Hamilton controller (PCH) and Feedback Linearization controller (FL), the curve of unit step response is made. In addition, the scale parameter σ of smooth-switching function is set to 0.01. The results are shown in Figure 4. The simulation results show that the system is stable with the controller PCH or FL. In addition, the characteristics of both controllers are obvious. FL controller has a fast response speed but poor steady-state performance. On the contrary, PCH controller has a poor response speed but a good steady-state performance. In addition, the Smooth-switching controller has the rapidity of Feedback Linearization (FL) controller and the stability of Hamilton (PCH) controller. It can also be obtained by analyzing the performance index (Table 1) of the system. The rising time of the smooth-switch control of the three joints are 0.35 s, 0.34 s and 0.42 s respectively, which are close to FL and far less than PCH. The tracking errors of smooth-switching are close to that of PCH, and much less than that of FL.  Case 2: To verify the tracking effect of the controllers, set the desired trajectory of the three joints as q 1 = 1 + 0.5sin(πt), q 2 = 1 + 0.5sin(πt) and q 3 = 1 + 0.5sin(πt). In addition, the scale parameter σ of smooth-switching function is set to 0.01. The tracking error curves is shown in Figure 5. Obviously, all three controllers can make the error converge to 0. It can be seen from Table 2 that smooth-switching control makes the robot system has fast rise time (0.35 s, 0.36 s, 0.39 s) and small tracking error(±5.0 × 10 −4 rad, ±3.3 × 10 −4 rad, ±1.5 × 10 −4 rad). The advantages of the smooth-switching control strategy is demonstrated again. Therefore, whether the input is a step signal or a sinusoidal signal, the smooth-switching control strategy can make the system perform well in both dynamic and steady state.
Case 3: To verify the influence of scale parameters σ on the system, the error curves under different σ are made by taking joint 1 as an example (Figure 1). It can be found from the Figure 6 that the smaller σ is, the faster the smooth-switching controller is closer to the signal controller. The smaller the σ, the faster the transition. The smaller σ ensures the speediness and stability of the system and avoids the instability caused by switching control.         Case 4: To verify the superiority of the algorithm, the smooth-switching control is compared with PID and sliding mode control (SMC). The trajectory tracking error curves of the three control methods are shown in Figure 7. In addition, the performance indexes of the system are shown in Table 3. The simulation results show that the smooth-switching control method is more excellent in both dynamic performance and steady-state performance.

Experimental Results
Due to the limitation of experimental conditions, the algorithm is validated only in the position loop on the robot platform ( Figure 1). The experimental platform was provided by Qingdao mangrove technology Co., Ltd. The experimental platform consists of MATLAB, Googol motion control card, servo driver and robot. The structure of the experimental system is shown in Figure 8. The three pitch joints of the robot are taken as the research objects. The robot parameters are shown in Table 4.  Figure 9. The performance indexes of the system are shown in Table 5. Figure 9a shows that FL controller makes joint 1 have fast dynamic response. However, in the steady-state process, the tracking error is large, and chatter occurs between 20-25 s. And there is a big overshoot at the beginning. Overshoot is caused by the inaccuracy of robot model. The dynamic response of PCH controller is slow. However, the steady-state performance of PCH controller is good and the error is small. In addition, the smooth-switching controller has fast dynamic response and good steady-state performance. Figure 9b shows that joint 2 based on FL controller has obvious chatter in 15-30 s. In addition, FL controller reaches steady state earlier than PCH controller. smooth-switching control has the advantages of both fast dynamic response and no chatter. Figure 9c shows that under the action of FL controller, the position error of joint 3 is greater than that of PCH controller. When the position of joint 3 reaches the maximum value and minimum value, the error contrast is obvious. The smooth-switching controller has the same response speed as FL controller and the same position error as PCH controller. Table 5 shows the rise time and tracking error of the robot's three joints under the control of FL, PCH and smooth-switching. Smooth-switching has a rise time similar to FL and a tracking error similar to PCH. Therefore, smooth-switching has the advantages of FL and PCH.
The experimental results further confirm the effectiveness of the algorithm. Case 6: On the robot platform, the experimental results of PID are obtained, and the comparison with smooth-switching is shown in Figure 10. The rise time and tracking error of the system are shown in Table 6. The experimental results show that the rise time of Smooth-switching control is shorter than that of PID and the jitter error is smaller.    (a)The curve of joint 1.

Conclusions
Aiming at the joint robot system driven by permanent-magnet synchronous motor, a smooth-switching control strategy based on position error is proposed. The feedback linearization control improves the dynamic response of the system. In addition, the PCH control ensures the steady-state performance of the system. The arctangent function is used to ensure the smooth-switching process. Simulation results show that compared with PID and SMC, the algorithm designed in this paper has better dynamic performance and steady-state performance. The experimental results on the robot platform show that the algorithm can make the manipulator reach the equilibrium point faster than PID, and has less jitter. However, it is very difficult to prove the Lyapunov stability of the algorithm, and there are many kinds of switching curves. In future research, we will try to find the optimal switching curve, and prove the stability of the algorithm in theory.  Acknowledgments: Thanks to Herong Wu and Manager Xisheng Zhou of Qingdao mangrove technology Co., Ltd for providing the experimental equipment.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: PMSM permanent-magnet synchronous motor PCH Port-Controlled Hamiltonian FL Feedback Linearization