# Turning Motion Control Design of a Two-Wheeled Inverted Pendulum Using Curvature Tracking and Optimal Control Theory

- 63 Downloads

## Abstract

This paper presents a control design method for implementing planar turning motion of a two-wheeled inverted pendulum with an input delay. The control task requires that the inverted pendulum is kept stabilized during the whole turning motion process along a pre-settled curve. Firstly, by using the theory of planar curve, key observations about the motion law of the two-wheeled mobile chassis are made and they are used to set up a dynamical trajectory tracking target. Then, by adjusting the parameters in the tracking target and the weights in the quadratic performance criterion, the optimal integral sliding mode controller based on a linear quadratic regulator is designed for keeping the vehicle body stabilized and tracking a circular path for the two-wheeled inverted pendulum. An illustrative example is given to demonstrate the validity of the theory with numerical simulation.

## Keywords

Two-wheeled inverted pendulum Input delay Curvature tracking Optimal control Dynamical tracking target## Mathematics Subject Classification

49N05 49N35## 1 Introduction

Two-wheeled inverted pendulum (TWIP, for short) is a general term for mechanical models driven by two wheels with a rod of pendulum mounted on the chassis. It is a self-balancing system and has some remarkable superiorities, such as simple structure, good dexterity, true zero turning radius, small footprint, low cost and low energy consumption [1]. Thus, it has been more and more widely used in human transporters and humanoid robots. However, the dynamics analysis and motion control design of TWIP systems are still challenging, because a TWIP is an essential nonlinear and under-actuated system, and the two wheels of the TWIP are subjected to nonholonomic constraints when the wheels move by rolling rather than slipping. The nonholonomic constraints of a TWIP are described by the motion equations of the mobile chassis, which not only restrain the motion displacement, but also the motion velocity that is not integrable. The flexibility of nonholonomic systems is superior to the holonomic ones, because the state of a mechanical system with nonholonomic constraints can be reached to any location in the displacement space. Thus, in some applications, nonholonomic structures are intentionally introduced to the manipulating device to implement intricate motion functions [2]. Usually, the nonholonomic systems are firstly transformed into chain normal forms. Then, different kinds of control methods, based on chain systems, can be used to design controllers for the original nonholonomic systems [3, 4]. In addition to the chain normal form, power form and Goursat normal form are two other kinds of normal forms, which can be also used to deal with nonholonomic systems [5, 6]. However, the designed controllers based on these kinds of normal forms are focused on speeds, rather than forces or moment of force, which are more aligned with an actual motion control problem of the nonholonomic mechanical system. Thus, the motion equations and dynamics equations of a nonholonomic mechanical system should be simultaneously considered in the control design for implementing a given motion task.

Stabilization of the inverted pendulum is a pre-requisite in many control applications of a TWIP, whereas the strong nonlinearity of the inverted pendulum is a major difficulty in the control design. For some nonlinear Lagrangian mechanical systems, the Chernousko’s decomposition method and its extension [7, 8] have been used for designing constrained feedback control to implement prescribed control objectives. Especially, for a pendulum-like system, a time-optimal feedback control with several switchings which is not greater than one for any initial condition was proposed in [9]. When the external disturbances and system uncertainties are taken into consideration, different kinds of robust control design methods have been designed to stabilize the TWIP, such as combined control with a decoupled LQR controller and two state variable controllers [10, 11]; nonlinear disturbance observer-based dynamic surface control [12]; sliding mode control [13, 14]; adaptive backstepping control [15] and so on. For the motion control design problem of the TWIP, most of the available works about controller design usually use the given longitudinal and yaw rotational speeds as tracking targets. Based on the dynamics equations of the TWIP, neural network-based control [16], fuzzy logic control [17] and adaptive control combined with some classical control methods have been proposed to design trajectory tracking controllers to track the given longitudinal and yaw rotational speeds target [18, 19, 20, 21, 22]. However, few works on the TWIP are devoted to design controllers for implementing a given motion trajectory curve in the Cartesian frame. The main difficulty for this motion control problem is that the relationship between the target trajectory curve and the forward and yaw rotation speeds of the TWIP is not clear. In [23, 24], for example, the forward and yaw rotational speeds are considered as the intermediate variables, which are denoted as the control input of the motion equations and the control output of the dynamics equations simultaneously. Then, a composite controller for implementing a given motion task is designed by using direct/indirect adaptive fuzzy control to track the trajectory path, plus a sliding mode control to render the stabilizing process of the vehicle body with strong robustness. In [25], two high gain observers are proposed for estimating the forward and yaw rotational speeds of a two-wheeled mobile robot without an inverted pendulum. Then, an adaptive output feedback tracking controller is designed to implement the circular motion by using the estimated velocities. In addition, time delays in controllers and uncertainties from modeling or measurement or perturbation are usually inevitable in real applications, but they are usually ignored in the literature [1]. The most popular methods to deal with input delay are related to the prediction-based compensation control strategy [26, 27, 28]. However, input delay is very important especially when some robust controls with high-frequency switching mechanism such as sliding mode controls are used, where the existence of input delay would lead to reversed control if the input delay is ignored. In fact, TWIP is a natural high-frequency vibration system, when the rod of pendulum is stabilized at the unstable equilibrium point. As shown in [27], a very small input delay may enlarge the vibration amplitude of the TWIP system remarkably in the trajectory tracking problem by using integral sliding mode control. Therefore, the input delay, although very small, is one of our major concerns in the control design of a TWIP.

The parameters and variables of the TWIP

Notation | Definition |
---|---|

\(T_\mathrm{l}\), \(T_\mathrm{r}\) | Torques provided by wheel actuators acting on left and right wheels |

\(\theta _\mathrm{l}\), \(\theta _\mathrm{r}\) | Rotational angels of the left and right wheels |

\(x_o\), \(y_o\) | The coordinates of point |

\(\varphi \) | Tilt angle of the pendulum |

\(\theta \) | Heading angle of the TWIP |

| Movement distance of the TWIP |

\(M_\mathrm{w}\) | Mass of the wheel |

| Radius of the wheel |

| Mass of the intermediate body |

| Gravity acceleration |

| Distance from the point |

| Height of the intermediate body |

| Distance between the two wheels along the axle center |

\(I_\mathrm{w}\) | Moment of inertia of the wheel along the wheel axis direction |

\(I_\mathrm{wd}\) | Moment of inertia of the wheel about the |

\(I_\mathrm{B}\) | Moment of inertia of the intermediate body along the wheel axis direction |

\(I_Z\) | Moment of inertia of the intermediate body about the |

| The forward speed of the TWIP, and \({\dot{x}}=v\) |

\(\omega \) | The yaw rotational speed of the TWIP, and \({\dot{\theta }}=\omega \) |

## 2 Problem Statement

Figure 1 is a schematic diagram of the TWIP model, with the parameters and variables of the TWIP described in Table 1. Two kinds of equations are used to describe the motion of the TWIP: One is the equations featuring the motion of the chassis, and the other is the equations characterizing the dynamical behaviors of the whole TWIP.

*v*, \(\omega \) be the lateral speed, forward speed and yaw rotational speed of the mobile chassis, respectively. Then, \({\dot{x}}_o=v\mathrm{cos}\theta \), \({\dot{y}}_o=v\mathrm{sin}\theta \), and the motion equations, namely Eq. (1), are equivalent to the following equations

## 3 Key Observations about Motion Equations

For clarity in presentation, the turning motion is made in a plane, and \(\dot{\theta _\mathrm{r}}>\dot{\theta _\mathrm{l}}>0\) is assumed to be true, so that the mobile chassis turns to the left in the plane, as shown in Fig. 2. A key observation of this paper is that a pair of known rotational speed \((\dot{\theta _\mathrm{r}},\dot{\theta _\mathrm{l}})\) of the two wheels determines uniquely a motion trajectory curve \((x_o(t),y_o(t))\) to the center point *O*, and conversely a known motion trajectory curve \((x_o(t),y_o(t))\) of the center point *O* determines uniquely a pair of rotational speed \((\dot{\theta _\mathrm{r}},\dot{\theta _\mathrm{l}})\) to the two wheels. More precisely, one has

### Theorem 3.1

*O*, \(k_o(t)\) be the relative curvature of the trajectory curve,

*v*and \({\dot{\theta }}\) be the forward speed and yaw rotational speed of the mobile chassis, respectively. Then,

### Proof

*O*is

*t*, and can also be transformed to a function with respect to the length arc variable, described by

*r*(

*s*), the trajectory curve \((x_o(t),y_o(t))\) can be easily calculated.

*t*, one has

*s*is the arc length variable. Then, the tangent vector of \(\varGamma (s)\) must be an unit vector due to

### Lemma 3.1

For a given motion task path \(\varGamma (s)=(x_o(s),y_o(s)),~s\in [0,l]\), the one-to-one smooth mapping (20) can be used for designing a trajectory tracking target \(\varGamma (t)=(x_o(\phi (t)),y_o(\phi (t)))\), which has zero initial velocity and zero terminal velocity.

## 4 Controller Design Based on Curvature Tracking and Optimal Control

The control problems of a TWIP can be roughly classified into two categories: trajectory planning and controller design, which are usually studied separately in the literature. In this section, trajectory planning plays a very important role in the controller design.

### 4.1 A Dynamical Trajectory Tracking Target

Note that the dynamics equation (3) merely described the relationship between the control variables and the forward speed and yaw rotation speed of the TWIP, and the position coordinate \((x_o(t),y_o(t))\) is implemented indirectly by the forward speed and yaw rotation speed. Therefore, any tracking error of position with two position coordinates \(x_o(t)\) and \(y_o(t)\) may cause inward movement or outward movement, and consequently, tracking \((x_o(t),y_o(t))\) may lead to large error of the position with the increases of the error accumulation. However, the smooth curvature function \(k_o(t)\) fully determines the shape of a trajectory curve \(\varGamma (t)=(x_o(t),y_o(t))\), the difference between two curve expressions with the same curvature is nothing but tangential speed. This means that when \(k_o(t)\) is tracked, \(\varGamma (t)\) is tracked accordingly no matter what the tangential speed is. Thus, for the trajectory tracking problem, it is very important to keep \(k_o(t)\) well tracked, while the speed *v*(*t*) of the TWIP can be either slow or not slow. Due to \(\omega (t)=k_o(t)v(t)\), the relationship among the actual yaw rotational speed, actual forward speed and the curvature of the actual motion trajectory curve, \(k_o(t)\) is tracked if the dynamical tracking target \({\tilde{\omega }}(t)=k_o(t)v(t)\) is tracked. Let \({\tilde{v}}={\dot{\phi }}(t)\) be chosen as a static tracking target of *v*(*t*) with a smooth function \(\phi (t)\) satisfying (19). Then, one has

### Theorem 4.1

*v*(

*t*) be the actual forward speed of the TWIP. Then, the dynamical trajectory tracking target for implementing the motion task of walking along the given curve \(\varGamma (s)\) can be designed as

As a matter of fact, \({\tilde{v}}\) is a pre-determined tracking target, which can be pre-adjusted for better control effect in an actual problem. However, the so-called dynamics tracking target \({\tilde{\omega }}\) is state-dependent with the actual forward speed, which is varying dynamically from moment to moment.

### 4.2 Optimal Integral Sliding Mode Control Design

Because Eqs. (6) and (7) are decoupled, the controllers \(u_1(t-\tau )\) and \(u_2(t-\tau )\) can be designed separately.

*J*, the tilt angle error can be forced to be small enough, when an optimal control is applied. Hence, the linearization error is small and can be considered as bounded. Moreover, for clarity, let \({\tilde{v}}={\dot{\phi }}(t)\) be the tracking target of the forward speed

*v*(

*t*) with \({\dot{\phi }}=l\beta ^2 t\mathrm{e}^{-\beta t}\). So

*v*(

*t*) becomes small if the target speed is small by using a small number \(\beta \). It follows that the yaw rotational speed \(\omega (t)\) is small enough, and consequently, \(\varDelta \mathbf{A }\mathbf{X }(t)\) becomes small enough, when the quadratic performance criterion (24) is minimized. In this way, there is a constant \(D_1 > 0\) such that

*J*is

The optimal state of system (32) and the open-loop state of system (5) actuated by the open control \(u_{10}(t-\tau )\) are the optimal states for implementing the original turning motion task. The linearization errors and system uncertainties are dealt with using the switched control parts \(u_{21}(t-\tau )\) and \(u_{11}(t-\tau )\). Thus, the original turning motion control problem of the TWIP can be well implemented by using the proposed control method from a theoretical perspective.

In summary, the controller for the turning motion of a TWIP can be designed as follows.

### Theorem 4.2

## 5 An Illustrative Example

Figure 3 shows that the tilt angle of the pendulum becomes small enough and is stabilized after a short transient. Figures 4 and 5 present the time history of the tracking error of the forward speed and the yaw rotational speed, respectively. Figure 6 shows that the actual motion trajectory is extremely closed to the target trajectory curve, when the dynamical tracking target \({\tilde{\omega }}=k_o(t)v(t)\) is applied, and the location error is very large if the rotational speed target is chosen as a nondynamic target \({\tilde{\omega }}=\frac{{\dot{x}}_{o}\ddot{y}_{o}-\ddot{x}_{o}{\dot{y}}_{o}}{{\dot{x}}_{o}^2+{\dot{y}}_{o}^2}\). The so-called nondynamic target is pre-designed by using the pre-determined trajectory curve, which cannot be varied with the state variable. In this case, the cumulative error becomes larger and larger and cannot be reduced. The simulation results indicate that a given turning motion task of the TWIP is well achieved by using the proposed control method, and the vibration amplitudes of the state variables would be magnified obviously if the small input delay is ignored in designing controllers.

## 6 Conclusions

A special feature of this paper is the application of the theory of planar curve in designing the controller. Two major points can be deduced from the proposed control design. One is that in order to keep the TWIP walking along the target trajectory curve accurately, it is important to have the curvature of the target trajectory curve well tracked. Thus, the product of the curvature of the target curve and the forward speed of the TWIP is chosen as a dynamic yaw rotational target. When the dynamical yaw rotational target is designed in such a way, the tracking error of the position can be greatly reduced compared with the use of nondynamical tracking target. The other is that there are almost no limits to the forward speed target if one does not mind the amount of the motion speed in the whole motion process. The use of the forward speed as a target enables that the accumulative error caused by the initial speed error can be reduced dramatically, and the LQR-based optimal trajectory controller is easily determined simply by solving Riccati algebraic equations. Numerical simulations show that with the designed controller, not only the given trajectory curve is well tracked, but also the inverted pendulum is well stabilized.

## Notes

### Acknowledgements

The authors thank the financial support of NSF of China under Grants 11802065, 11372354, the Science and Technology Program of Guizhou Province ([2018]1047), and thank the anonymous reviewers for their valuable comments that help much in improving the presentation of the manuscript.

## References

- 1.Chan, R.P.M., Stol, K.A., Halkyard, C.R.: Review of modelling and control of two-wheeled robots. Annu. Rev. Control.
**37**(1), 89–103 (2013)CrossRefGoogle Scholar - 2.Chung, W.: Nonholonomic Manipulators. Springer, Berlin (2004)zbMATHGoogle Scholar
- 3.Murray, R.M., Li, Z.X., Sastry, S.S.: A Mathematical Introduction to Robotic Manipulation. CRC Press, Boca Raton (1994)zbMATHGoogle Scholar
- 4.Huang, J., Chen, J., Fang, H., Dou, L.H.: An overview of recent progress in high-order nonholonomic chained system control and distributed coordination. J. Control Decis.
**2**(1), 64–85 (2015)MathSciNetCrossRefGoogle Scholar - 5.Li, H., Yan, W., Shi, Y.: A receding horizon stabilization approach to constrained nonholonomic systems in power form. Syst. Control Lett.
**99**, 47–56 (2017)MathSciNetCrossRefzbMATHGoogle Scholar - 6.Tilbury, R., Murray, R.M., Sastry, S.S.: Trajectory generation for the n-trailer problem using goursat normat form. IEEE Trans. Autom. Control
**40**(5), 802–819 (1995)CrossRefzbMATHGoogle Scholar - 7.Reshmin, S.A.: The decomposition method for a control problem for an underactuated Lagrangian system. J. Appl. Math. Mech.
**74**(1), 108–121 (2010)MathSciNetCrossRefzbMATHGoogle Scholar - 8.Ananevskii, I.M., Reshmin, S.A.: Decomposition-based continuous control of mechanical systems. J. Comput. Syst. Sci. Int.
**53**(4), 473–486 (2014)MathSciNetCrossRefzbMATHGoogle Scholar - 9.Reshmin, S.A., Chernousko, F.L.: Properties of the time-optimal feedback control for a pendulum-like system. J. Optim. Theory Appl.
**163**(1), 230–252 (2014)MathSciNetCrossRefzbMATHGoogle Scholar - 10.Da Silva Jr, A.R., Sup IV, F.C.: A robotic walker based on a two-wheeled inverted pendulum. J. Intell. Robot. Syst.
**86**(1), 17–34 (2017)CrossRefGoogle Scholar - 11.Halperin, I., Agranovich, G., Ribakov, Y.: Optimal control of a constrained bilinear dynamic system. J. Optim. Theory Appl.
**174**(3), 803–817 (2017)MathSciNetCrossRefzbMATHGoogle Scholar - 12.Huang, J., Ri, S., et al.: Nonlinear disturbance observer-based dynamic surface control of mobile wheeled inverted pendulum. J. Intell. Robot. Syst.
**23**(6), 2400–2407 (2015)Google Scholar - 13.Guo, Z.Q., Xu, J.X., Lee, T.H.: Design and implementation of a new sliding mode controller on an underactuated wheeled inverted pendulum. J. Frankl. Inst.
**351**(4), 2261–2282 (2014)MathSciNetCrossRefzbMATHGoogle Scholar - 14.Liu, R.J., Li, S.H.: Suboptimal integral sliding mode controller design for a class of affine systems. J. Optim. Theory Appl.
**161**(3), 877–904 (2014)MathSciNetCrossRefzbMATHGoogle Scholar - 15.Cui, R.X., Guo, J., Mao, Z.Y.: Adaptive backstepping control of wheeled inverted pendulums models. Nonlinear Dyn.
**79**(1), 501–511 (2015)MathSciNetCrossRefzbMATHGoogle Scholar - 16.Yang, C.G., Li, Z.J., et al.: Neural network-based motion control of underactuated wheeled inverted pendulum models. IEEE Trans. Neural Netw. Learn.
**25**(11), 2004–2016 (2014)CrossRefGoogle Scholar - 17.Huang, J.G., Ri, M.H., Ri, S.: Interval type-2 fuzzy logic modeling and control of a mobile two-wheeled inverted pendulum. IEEE Trans. Fuzzy Syst.
**PP**(99), 1–1 (2017)Google Scholar - 18.Shojaei, K., Shahri, A.M., Tarakameh, A.: Adaptive feedback linearizing control of nonholonomic wheeled mobile robots in presence of parametric and nonparametric uncertainties. Robot. Comput. Integr. Manuf.
**27**(1), 194–204 (2011)CrossRefGoogle Scholar - 19.Al-Araji, A.S., Abbod, M.F., Al-Raweshidy, H.S.: Applying posture identifier in designing an adaptive nonlinear predictive controller for nonholonomic mobile robot. Neurocomputing
**99**, 543–554 (2013)CrossRefGoogle Scholar - 20.Chen, N.J., Song, F.Z., Li, G.P., Sun, X., Ai, C.S.: An adaptive sliding mode backstepping control for the mobile manipulator with nonholonomic constraints. Commun. Nonlinear Sci. Numer. Simul.
**18**(10), 2885–2899 (2013)MathSciNetCrossRefzbMATHGoogle Scholar - 21.Li, Z.J., Zhang, Y.N.: Robust adaptive motion/force control for wheeled inverted pendulum. Automatica
**46**(8), 1346–1353 (2010)MathSciNetCrossRefzbMATHGoogle Scholar - 22.Che, J.X., Santone, M., Cao, C.Y.: Adaptive control for systems with output constraints using an online optimization method. J. Optim. Theory Appl.
**165**(2), 480–506 (2015)MathSciNetCrossRefzbMATHGoogle Scholar - 23.Yue, M., An, C., Da, Y., Sun, J.Z.: Indirect adaptive fuzzy control for a nonholonomic/underactuated wheeled inverted pendulum vehicle based on a data-driven trajectory planner. Fuzzy Sets Syst.
**290**, 158–177 (2016)MathSciNetCrossRefzbMATHGoogle Scholar - 24.Yue, M., Wang, S., Sun, J.Z.: Simultaneous balancing and trajectory tracking control for two-wheeled inverted pendulum vehicles: a composite control approach. Neurocomputing
**191**, 44–54 (2016)CrossRefGoogle Scholar - 25.Huang, J., Wen, C.Y., Wang, W., Jiang, Z.P.: Adaptive output feedback tracking control of a nonholonomic mobile robot. Automatica
**50**(3), 821–831 (2014)MathSciNetCrossRefzbMATHGoogle Scholar - 26.Diagne, M., Bekiaris-Liberis, N., Krstic, M.: Compensation of input delay that depends on delayed input. Automatica
**85**, 362–373 (2017)MathSciNetCrossRefzbMATHGoogle Scholar - 27.Zhou, Y.S., Wang, Z.H.: Robust motion control of a two-wheeled inverted pendulum with an input delay based on optimal integral sliding mode manifold. Nonlinear Dyn.
**85**(3), 2065–2074 (2016)MathSciNetCrossRefGoogle Scholar - 28.Zhou, Y.S., Wang, Z.H.: Motion controller design of wheeled inverted pendulum with an input delay via optimal control theory. J. Optim. Theory Appl.
**168**(2), 625–645 (2016)MathSciNetCrossRefzbMATHGoogle Scholar - 29.Do Carmo, M.P.: Differential Geometry of Curves and Surfaces. Birkhauser, Boston (2006)zbMATHGoogle Scholar

## Copyright information

**OpenAccess**This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.