1 Introduction

The rotary inverted pendulum (Fig. 1) was first introduced by Furuta et al. [13]. Since it contains the well-known underactuated dynamics, many reports can be found in the literature for its stabilization [1, 3, 5, 25]. Most of the controls for the rotary inverted pendulum fall into one of several categories [6]. For example, some considered the problem of stabilizing the pendulum around the unstable vertical position [1, 6, 25, 26, 32]. Some swung the pendulum from its hanging position to its upright vertical position [3, 9, 14, 15, 31]. Some others tried to create oscillations around its unstable vertical position [2, 12, 30]. In this paper, we would like to consider the control problem of stabilizing the pendulum around the unstable vertical position when subjected to time-varying uncertainties.

Fig. 1
figure 1

The Furuta pendulum system

Several robust controllers were proposed for dealing with uncertainties and disturbances in the Furuta system. Yu et al. [34] proposed a robust controller to stabilize the Furuta pendulum under bounded perturbation. Khanesar et al. [22] used a fuzzy sliding controller to drive a rotary inverted pendulum to the vertical position subject to bounded uncertainties and disturbances. Park et al. [29] presented a swing-up and stabilization control with coupled sliding mode control. Some other robust designs can be found in the recent papers by Iraj et al. [21], Muske et al. [24], Ashrafiuon and Whitman [4], and Uchiyama et al. [33]. A common assumption to these robust designs is that the variation bounds of the uncertainties and disturbances have to be available; otherwise, the design is not feasible.

The other approach to deal with system uncertainties is the adaptive control. However, few reports can be found. Matsuda et al. [23] proposed a variable structure system type adaptive controller to stabilize the pendulum at the upright position. Hirata et al. [16] presented a robust adaptive control for the stabilization problem of the Furuta pendulum. Similar to the traditional adaptive design, the uncertainties in these approaches are assumed to be linearly parameterized as a multiplication of a known regressor matrix and an unknown constant vector. If this regressor form cannot be achieved, the adaptive design fails. In this paper, we consider the case when the system dynamics contains time-varying uncertainties that cannot be represented in the regressor form. Therefore, we may not apply the traditional adaptive design. In addition, let us assume that the variation bounds of these time-varying uncertainties are not available; the conventional robust designs are not feasible either. Here, we would like to design a function approximation technique (FAT) based adaptive controller to cover the time-varying uncertainties [7, 8, 1720].

The rotary inverted pendulum is well-known to be an underactuated system [7, 11] where fewer actuators are used to drive the system than its degree of freedom. To decouple the underactuated dynamics, Olfati’s transformation [27, 28] is used to transform the system into a special cascade form [7]. Together with the FAT-based adaptive controller, the closed loop stability can be justified with the Lyapunov-like method. Simulation cases are designed to justify the effectiveness of the proposed method.

This paper is organized as follows. Section 2 derives the system dynamics and introduces Olfati’s transformation. The FAT-based adaptive controller is proposed in Sect. 3. Section 4 presents the simulation results. The last section concludes the paper.

2 System dynamics and Olfati’s transformation

Consider the rotary inverted pendulum shown in Fig. 1 where I 1 is the moment of inertia of the arm, L 1 is the arm length, m 3 is the mass of the pendulum, 3 is the distance to the center of gravity of the pendulum, J 3 is the inertia of the pendulum around its center of gravity, θ 1 is the angular displacement of the arm, θ 3 is the angular displacement of the pendulum, F d is the external force disturbance, and τ is the torque applied to the arm. The system dynamics can be represented by the set of differential equations

$$ \begin{aligned} & \dot{\theta}_{1} = \theta_{2}, \\ & \dot{\theta}_{2} = f_{1}(\boldsymbol{\theta} ) + b_{1}\tau, \\ & \dot{\theta}_{3} = \theta_{4}, \\ & \dot{\theta}_{4} = f_{2}(\boldsymbol{\theta} ) + b_{2}\tau + F_{d}, \end{aligned} $$
(1)

where \(\boldsymbol{\theta} = [\begin{array}{cccc} \theta_{1} & \theta_{2} & \theta_{3} & \theta_{4} \end{array}]^{T}\) is a vector of states, and functions f 1, f 2, b 1, and b 2 are defined as

$$\begin{aligned} & f_{1}(\boldsymbol{\theta} ) = \frac{(J_{3} + m_{3}\ell_{3}^{2})m_{3}\ell_{3}\dot{\theta}_{3}(L_{1}\dot{\theta}_{3}\sin \theta_{3} - \ell_{3}\dot{\theta}_{1}\sin (2\theta_{3})}{\det (D(q))} - \frac{m_{3}^{2}\ell_{3}^{2}L_{1}\cos \theta_{3}(g\sin \theta_{3} + 0.5l_{3}\dot{\theta}_{1}^{2}\sin (2\theta_{3}))}{\det (D(q))}, \\ & f_{2}(\boldsymbol{\theta} ) = \frac{m_{3}\ell_{3}\sin \theta_{3}((I_{1} + m_{3}L_{1}^{2} + \ell_{3}^{2}\sin^{2}\theta_{3})g - m_{3}\ell_{3}L_{1}^{2}\dot{\theta}_{3}^{2}\cos \theta_{3})}{\det (D(q))} \\ & \hphantom{f_{2}(\boldsymbol{\theta} ) =} {}+ \frac{m_{3}\ell_{3}^{2}\dot{\theta}_{1}\sin (2\theta_{3})[m_{3}\ell_{3}L_{1}\dot{\theta}_{3}\cos \theta_{3} + 0.5\dot{\theta}_{1}(I_{1} + m_{3}L_{1}^{2} + m_{3}\ell_{3}^{2}\sin^{2}\theta_{3})]}{\det (D(q))}, \\ & b_{1}(\theta_{3}) = \frac{(J_{3} + m_{3}\ell_{3}^{2})}{\det (D(q))},\quad b_{2}(\theta_{3}) = \frac{ - m_{3}\ell_{3}L_{1}\cos \theta_{3}}{\det (D(q))}, \\ & \det \bigl(D(q) \bigr) = \bigl(J_{3} + m_{3} \ell_{3}^{2} \bigr) \bigl(I_{1} + m_{3} \ell_{3}^{2}\sin^{2}\theta_{3} \bigr) + J_{3}m_{3}L_{1}^{2} + m_{3}^{2}\ell_{3}^{2}L_{1}^{2} \sin^{2}\theta_{3}. \end{aligned}$$

Suppose f 1 and f 2 are unknown functions without knowing their variation bounds, while b 1 is known. The uncertain function b 2 is assumed to be bounded as b minb 2b max with known bounds. The nominal value of b 2 is defined as \(b_{m} = \sqrt{b_{\min} b_{\max}}\) so that we may represent b 2 as b 2=b m Δb where Δb is the uncertainty satisfying \(0 < \delta_{\min} \equiv \frac{b_{\min}}{b_{m}} \le \Delta b \le \frac{b_{\max}}{b_{m}} \equiv \delta_{\max}\).

Since the system is well-known to be underactuated, we would like to apply Olfati’s transformation [27, 28] to represent the system in a special cascade form so that the underactuated dynamics can be eliminated. By using the coordinate transformation

$$ \begin{aligned} & z_{1} = \theta_{1} + \frac{J_{3} + m_{3}\ell_{3}^{2}}{m_{3}\ell_{3}L_{1}}\ln \vert \sec \theta_{3} + \tan \theta_{3} \vert , \\ & z_{2} = \theta_{2} + \frac{J_{3} + m_{3}\ell_{3}^{2}}{m_{3}\ell_{3}L_{1}\cos \theta_{3}} \theta_{4}, \\ & z_{3} = \theta_{3}, \\ & z_{4} = \theta_{4},\end{aligned} $$
(2)

we have the system dynamics in the new space given by

$$ \begin{aligned} & \dot{z}_{1} = z_{2}, \\ & \dot{z}_{2} = z_{3} + d(\mathbf{z}), \\ & \dot{z}_{3} = z_{4}, \\ & \dot{z}_{4} = f_{2}(\mathbf{z}) + b_{2}u + F_{d}, \end{aligned} $$
(3)

where \(\mathbf{z} = [\begin{array}{cccc} z_{1} & z_{2} & z_{3} & z_{4} \end{array}]^{T}\) is the new state vector and

$$d(\mathbf{z}) = - z_{3} + f_{1}(\mathbf{z}) + \frac{J_{3} + m_{3}\ell_{3}^{2}}{m_{3}\ell_{3}L_{1}\cos \theta_{3}}f_{2}(\mathbf{z}). $$

It is seen that system (3) is in a special cascade form and d is a mismatched time-varying uncertainty without knowing its variation bound. To deal with the mismatched uncertainty, a backstepping-like design called multiple-surface sliding control is employed with the function approximation technique to give appropriate compensation. To unify the derivation, we would like to represent (3) as

$$ \begin{aligned} & \dot{z}_{1} = z_{2} + d_{1}, \\ & \dot{z}_{2} = z_{3} + d_{2}, \\ & \dot{z}_{3} = z_{4}, \\ & \dot{z}_{4} = f_{2}(\mathbf{z}) + b_{2}u + F_{d}, \end{aligned} $$
(4)

where d 1=0 and d 2=d(z).

3 Controller design

Define y=z 1 as the output signal of system (4) and y d (t) is its desired trajectory. Let us consider the error signals

$$ s_{i} = z_{i} - z_{id},\quad i = 1,\ldots,4, $$
(5)

where z id is the desired value forz i . These error signals can be regarded as a set of surfaces in some error space. Let z 1d =y d (t). Then the time derivative of s 1 can be found as

$$ \dot{s}_{1} = s_{2} + z_{2d} + d_{1} - \dot{y}_{d}. $$
(6)

To stabilize (6), we may regard z 2d as a virtual control, and it is selected to be \(z_{2d} = \dot{y}_{d} - c_{1}\frac{s_{1}}{\phi_{1}}\) where c 1 is a positive constant and ϕ 1>0 is the thickness of the boundary layer for the surface s 1=0. With this selection of z 2d , (6) becomes

$$ \dot{s}_{1} = s_{2} - c_{1}\frac{s_{1}}{\phi_{1}}. $$
(7)

It can be seen that if s 2 is small, then s 1 will also be small. Taking the time derivative of s 2, we have

$$ \dot{s}_{2} = s_{3} + z_{3d} + d_{2} - \dot{z}_{2d}, $$
(8)

where \(\dot{z}_{2d} = \ddot{y}_{d} - \frac{c_{1}}{\phi_{1}}(z_{2} - \dot{y}_{d})\). To stabilize (8), we may regard z 3d as a virtual control which can be designed as

$$ z_{3d} = \dot{z}_{2d} - \hat{d}_{2} - c_{2}\frac{s_{2}}{\phi_{2}}, $$
(9)

where c 2 and ϕ 2 are positive constants, and \(\hat{d}_{2}\) is an estimate of the mismatched uncertainty d. Hence, (8) can be derived as

$$ \dot{s}_{2} = s_{3} + (d_{2} - \hat{d}_{2}) - c_{2}\frac{s_{2}}{\phi_{2}}. $$
(10)

If s 3 is small and some update law can be designed so that \(d_{2} - \hat{d}_{2}\) is small, then (10) implies that the magnitude of s 2 is small. To evaluate the dynamics of s 3, let us take its time derivate as

$$ \dot{s}_{3} = s_{4} + z_{4d} - \dot{z}_{3d}, $$
(11)

where \(\dot{z}_{3d}\) is a function of the uncertainty d 2, so it is also unknown. To simplify the derivation, let us define \(d_{3} = - \dot{z}_{3d}\) and we may select \(z_{4d} = - \hat{d}_{3} - c_{3}\frac{s_{3}}{\phi_{3}}\) to have

$$ \dot{s}_{3} = s_{4} + (d_{3} - \hat{d}_{3}) - c_{3}\frac{s_{3}}{\phi_{3}}. $$
(12)

Finally, the dynamics of s 4 is found as

$$\dot{s}_{4} = f_{2} + b_{2}u - \dot{z}_{4d}. $$

Define \(f = f_{2} - \dot{z}_{4d}\), and we have

$$ \dot{s}_{4} = f + b_{m}\Delta bu. $$
(13)

We may thus design the control law as

$$ u = \frac{1}{b_{m}} \biggl[ - \hat{f} - c_{4}\frac{s_{4}}{\phi_{4}} - u_{r} \biggr], $$
(14)

where \(\hat{f}\) is an estimate of f and c 4>0 and ϕ 4>0 are constants and u r is a robust term to be designed. Substituting the control law u into (13), we have

$$\begin{aligned} \dot{s}_{4} & = f - \Delta b\hat{f} - c_{4}\Delta b \frac{s_{4}}{\phi_{4}} - \Delta bu_{r} \pm \hat{f} \pm c_{4} \frac{s_{4}}{\phi_{4}} \\ & = (f - \hat{f}) - c_{4}\frac{s_{4}}{\phi_{4}} + (1 - \Delta b) \biggl( \hat{f} + c_{4}\frac{s_{4}}{\phi_{4}} \biggr) \\ &\quad {} - \Delta bu_{r}. \end{aligned}$$
(15)

At this stage, we have already obtained the dynamics of error surfaces in (7), (10), (12), and (15). Let us collect them to form the error dynamics for the whole system as

$$\begin{aligned} \dot{s}_{1} & = s_{2} - c_{1}\frac{s_{1}}{\phi_{1}}, \end{aligned}$$
(16a)
$$\begin{aligned} \dot{s}_{2} & = s_{3} - c_{2}\frac{s_{2}}{\phi_{2}} + (d_{2} - \hat{d}_{2}), \end{aligned}$$
(16b)
$$\begin{aligned} \dot{s}_{3} & = s_{4} - c_{3}\frac{s_{3}}{\phi_{3}} + (d_{3} - \hat{d}_{3}), \end{aligned}$$
(16c)
$$\begin{aligned} \dot{s}_{4} & = - c_{4}\frac{s_{4}}{\phi_{4}} + (f - \hat{f}) + (1 - \Delta b) \biggl(\hat{f} + c_{4}\frac{s_{4}}{\phi_{4}} \biggr) \\ &\quad {} - \Delta bu_{r}. \end{aligned}$$
(16d)

If a robust term u r can be designed so that the term \((1 - \Delta b)(\hat{f} + c_{4}\frac{s_{4}}{\phi_{4}})\) in (16d) can be properly covered, and an update law for \(\hat{f}\) can be found such that \(\hat{f} \to f\), then we may have the convergence of s 4. Likewise, if an update law for \(\hat{d}_{3}\) can be derived to satisfy \(\hat{d}_{3} \to d_{3}\), then (16c) implies the convergence of s 3. Again, if we may design an update law for \(\hat{d}_{2}\) such that \(\hat{d}_{2} \to d_{2}\), then (16b) gives s 2→0. Finally, with the convergence of s 2, we may conclude the convergence of s 1 from (16a). To design these update laws, we would like to apply the function approximation technique [8, 1720]. Define d 4=f and \(\hat{d}_{4} = \hat{f}\), then we have the representations

$$ \begin{array}{l} d_{i} = \mathbf{w}_{i}^{T}\mathbf{z}_{i} + \varepsilon_{i}, \\ \hat{d}_{i} = \hat{\mathbf{w}}_{i}^{T}\mathbf{z}_{i}, \end{array}\quad i = 1,\ldots,4 $$
(17)

where z i is a known vector of basis functions, w i and \(\hat{\mathbf{w}}_{i}\) are respectively the coefficient vector and its estimate, and ε i is the approximation error. Note that d 1=0, and the representation in (17) for d 1 and \(\hat{d}_{1}\) is only for convenience in the following derivation. Hence, we may rewrite (16a)–(16d) as

$$ \begin{aligned} \dot{s}_{1} & = - \eta_{1}s_{1} + s_{2}, \\ \dot{s}_{2} & = - \eta_{2}s_{2} + s_{3} + \tilde{\mathbf{w}}_{2}^{T}\mathbf{z}_{2} + \varepsilon_{2}, \\ \dot{s}_{3} & = - \eta_{3}s_{3} + s_{4} + \tilde{\mathbf{w}}_{3}^{T} \mathbf{z}_{3} + \varepsilon_{3}, \\ \dot{s}_{4} &= - \eta_{4}s_{4} + \tilde{ \mathbf{w}}_{4}^{T}\mathbf{z}_{4} + \varepsilon_{4} \\ &\quad {} + (1 - \Delta b) \biggl(\hat{f} + c_{4} \frac{s_{4}}{\phi_{4}} \biggr) - \Delta bu_{r}, \end{aligned} $$
(18)

where \(\tilde{\mathbf{w}}_{i} = \mathbf{w}_{i} - \hat{\mathbf{w}}_{i}\) are approximation errors for the coefficient vectors, and \(\eta_{i} = \frac{c_{i}}{\phi_{i}}\), i=1,…,4 are positive constants. Define a Lyapunov-like function

$$ V_{4} = \frac{1}{2}s_{4}^{2} + \frac{1}{2}\tilde{\mathbf{w}}_{4}^{T}\boldsymbol{ \varGamma}_{4}\tilde{\mathbf{w}}_{4}, $$
(19)

where Γ 4 is a positive definite matrix. Taking the time derivative of (19) along the trajectory of (18), we have

$$\begin{aligned} \dot{V}_{4} & \le - \eta_{4}s_{4}^{2} + s_{4}\varepsilon_{4} + (1 + \delta_{\max} ) \vert \hat{f} + \eta_{4}s_{4} \vert \vert s_{4} \vert \\ &\quad {} - \delta_{\min} s_{4}u_{r} + \tilde{ \mathbf{w}}_{4}^{T}(s_{4}\mathbf{z}_{4} - \boldsymbol{\varGamma}_{4}\dot{\hat{\mathbf{w}}}_{4}). \end{aligned}$$
(20)

Select the update law for \(\hat{\mathbf{w}}_{4}\) as

$$\begin{aligned} & \dot{\hat{\mathbf{w}}}_{4} = \boldsymbol{\varGamma}_{4}^{ - 1}(s_{4} \mathbf{z}_{f} - \sigma_{4}\hat{\mathbf{w}}_{4}), \end{aligned}$$
(21a)
$$\begin{aligned} & u_{r} = \frac{1 + \delta_{\max}}{\delta_{\min}} \vert \hat{f} + \eta_{4}s_{4} \vert {\mathop{\operatorname{sgn}}} (s_{4}), \end{aligned}$$
(21b)

where σ 4 is a positive number. Hence, (20) can be written as

$$ \dot{V}_{4} \le - \eta_{4}s_{4}^{2} + \vert s_{4} \vert \vert \varepsilon_{4} \vert + \sigma_{4} \bigl(\tilde{\mathbf{w}}_{4}^{T} \mathbf{w}_{4} - \Vert \tilde{\mathbf{w}}_{4} \Vert ^{2} \bigr). $$
(22)

By using the inequalities

$$\begin{aligned} & - \eta_{4}s_{4}^{2} + \vert s_{4} \vert \vert \varepsilon_{4} \vert \le - \frac{1}{2} \biggl( \eta_{4}s_{4}^{2} - \frac{\varepsilon_{4}^{2}}{\eta_{4}} \biggr), \\ & \tilde{\mathbf{w}}_{4}^{T}\mathbf{w}_{4} - \Vert \tilde{\mathbf{w}}_{4} \Vert ^{2} \le - \frac{1}{2} \bigl(\Vert \tilde{\mathbf{w}}_{4} \Vert ^{2} - \Vert \mathbf{w}_{4} \Vert ^{2} \bigr), \end{aligned}$$

Eq. (22) can be derived as

$$\begin{aligned} \dot{V}_{4} & \le - \frac{1}{2} \biggl( \eta_{4}s_{4}^{2} - \frac{\varepsilon_{4}^{2}}{\eta_{4}} \biggr) - \frac{1}{2}\sigma_{4} \bigl( \Vert \tilde{\mathbf{w}}_{4} \Vert ^{2} - \Vert \mathbf{w}_{4} \Vert ^{2} \bigr) \\ & \le - \alpha_{4}V_{4} + \biggl[ \frac{\alpha_{4}}{2} - \frac{\eta_{4}}{2} \biggr]s_{4}^{2} + \biggl[ \frac{\alpha_{4}}{2} \lambda_{\max} (\boldsymbol{\varGamma}_{4}) - \frac{\sigma_{4}}{2} \biggr] \\ &\quad {}\times \Vert \tilde{\mathbf{w}}_{4} \Vert ^{2} + \frac{\sigma_{4}}{2}\Vert \mathbf{w}_{4} \Vert ^{2} + \frac{1}{2\eta_{4}}\varepsilon_{4}^{2} , \end{aligned}$$

where α 4 is selected as \(\alpha_{4} \le \min \{ \eta_{4},\frac{\sigma_{4}}{\lambda_{\max} (\boldsymbol{\varGamma}_{4})} \}\) to give

$$ \dot{V}_{4} \le - \alpha_{4}V_{4} + \frac{\sigma_{4}}{2}\Vert \mathbf{w}_{4} \Vert ^{2} + \frac{1}{2\eta_{4}}\varepsilon_{4}^{2}. $$
(23)

Hence, \(\dot{V}_{4} < 0\) whenever

$$\begin{aligned} (s_{4},\tilde{\mathbf{w}}_{4}) \in E_{4} & \equiv \biggl\{ (s_{4},\tilde{\mathbf{w}}_{4}) \vert V_{4} > \varphi_{4} \equiv \frac{\sigma_{4}}{2\alpha_{4}}\Vert \mathbf{w}_{4} \Vert ^{2} \\ &\quad {} + \frac{1}{2\alpha_{4}\eta_{4}}\sup_{\tau \ge t_{0}}\varepsilon_{4}^{2}( \tau ) \biggr\} . \end{aligned}$$

Note that φ 4 is a positive constant, and hence we may conclude that (\(s_{4},\tilde{\mathbf{w}}_{4}\)) is uniformly ultimately bounded. In addition, given any μ 4>0, there exist T 4t 0≥0 such that

$$V_{4}(t) \le \varphi_{4} + \mu_{4}\quad \mbox{for }t \ge T_{4}. $$

Along the same line, we can choose the Lyapunov-like functions

$$ V_{i} = \frac{1}{2}s_{i}^{2} + \frac{1}{2}\tilde{\mathbf{w}}_{i}^{T}\boldsymbol{ \varGamma}_{i}\tilde{\mathbf{w}}_{i},\quad i = 1,2,3. $$
(24)

By taking the time derivatives of these functions along the trajectory of (18), we may have the update laws to be selected as

$$ \dot{\hat{\mathbf{w}}}_{i} = \boldsymbol{\varGamma}_{i}^{ - 1}(s_{i} \mathbf{z}_{i} - \sigma_{i}\hat{\mathbf{w}}_{i}), \quad \sigma_{i} > 0,\ i = 1,2,3. $$
(25)

After some rearrangements, the time derivative of V i becomes

$$ \dot{V}_{i} \le - \alpha_{i}V_{i} + \frac{\sigma_{i}}{2}\Vert \mathbf{w}_{i} \Vert ^{2} + \frac{1}{2\eta_{i}}(\varepsilon_{i} + s_{i + 1})^{2} $$
(26)

where \(\alpha_{i} \le \min \{ \eta_{i},\frac{\sigma_{i}}{\lambda_{\max} (\boldsymbol{\varGamma}_{i})} \},i = 1,2,3\). For t 0t<T i+1, we may have \(\dot{V}_{i} < 0\) whenever

$$ (s_{i},\tilde{\mathbf{w}}_{i}) \in E_{i} \equiv \bigl\{ (s_{i},\tilde{\mathbf{w}}_{i})\vert V_{i} > \varphi_{i} \bigr\} , $$
(27)

\(\varphi_{i} \equiv \frac{\sigma_{i}}{2\alpha_{i}}\Vert \mathbf{w}_{i} \Vert ^{2} + \frac{1}{2\alpha_{i}\eta_{i}}[ \sup_{\tau \ge t_{0}}\vert \varepsilon_{i}(\tau ) \vert + \sqrt{2\max \{ \begin{array}{cc} V_{i + 1}(t_{0}), & \phi_{i + 1} + \mu_{i + 1} \end{array}\}} ]^{2}\). This implies that V i is bounded for all t∈[t 0,T i+1], i.e., before convergence of V i+1, V i is bounded. Define \(\varphi '_{i} \equiv \frac{\sigma_{i}}{2\alpha_{i}}\Vert \mathbf{w}_{i} \Vert ^{2} + \frac{1}{2\alpha_{i}\eta_{i}} [ \sup_{\tau \ge t_{0}}\vert \varepsilon_{i}(\tau ) \vert + \sqrt{2(\phi_{i + 1} + \mu_{i + 1})} ]^{2}\), then after the convergence of V i+1 (i.e., when tT i+1) to \(\varphi '_{i + 1} + \mu_{i + 1}\), V i is bounded. We have thus proved that (\(s_{i},\tilde{\mathbf{w}}_{i}\)) is uniformly ultimately bounded. Therefore, we have established the order of convergence from s 4 to s 1. During the convergence of s i , the boundedness of s j , j=i−1,…,1 is ensured. Specifically, when tT 1, we have

$$ \bigl\vert s_{1}(t) \bigr\vert = \vert z_{1} - z_{1d} \vert = \sqrt{2V_{1}} \le \sqrt{2 \bigl( \phi '_{1} + \mu_{1} \bigr)}. $$
(28)

Hence the proposed controller ensures that the output error of the rotary inverse pendulum system will be bounded by some constants adjustable by controller parameters. In this work, the performance is achieved subject to mismatched time-varying uncertainties.

4 Computer simulations

To verify the effectiveness of the proposed design, let us consider the system in Fig. 1 again. The initial condition is assumed to be \(\boldsymbol{\theta} (0) = [\begin{array}{cccc} 1 & 0 & - 1 & 0 \end{array}]^{T}\), and we would like to bring the desired state to the origin. The actual values of system parameters [10] are m 3=5.38×10−2 kg, J 3=1.98×10−4 kg m2, 3=0.113 m, g=9.8 m/s2, L 1=0.215 m, I 1=1.75×10−2 kg m2. The parameters for modeling b 2 can be computed to be b min=−81.79, b max=−40.08, b m =57.26, δ max=−0.69997, δ min=−1.4284. The weighting matrices are chosen as Γ 2=32I, Γ 3=35I, Γ 4=40I, and the constant σ is set to zero. The external disturbance is applied to the system during 4 to 6 seconds with F d =20sin(20t) as shown in Fig. 2. The initial weighting matrices for the function approximation are set to \(\hat{w}_{i}(0) = [0\ 0 \cdots 0 ]^{T},i = 2,3,4\). The 21-term Fourier series is used as the basis in the function approximation. Two cases are considered in the simulation study.

Fig. 2
figure 2

External force

4.1 CASE 1. Constant parameters

In this case, system parameters m 3 and 3 are assumed to be unknown constants. The controller parameters are selected as c 1=50,c 2=20,c 3=0.06, c 4=1×10−9 and ϕ i =1,i=1,…,4. The simulation results are shows in Figs. 3 and 4. Figure 3 shows that both the arm and pendulum positions converge to their desired values in 3 seconds regardless of the system uncertainties. With the presence of the external disturbances during 4 to 6 seconds, the pendulum exhibits some deviations in the trajectories. However, the proposed controller is robust enough to keep the states in the neighborhoods of the equilibrium points and bring them back to the desired values right after the absence of the disturbance. Figure 4 shows that the control law is realizable.

Fig. 3
figure 3

System response (a) arm angle (b) pendulum angle

Fig. 4
figure 4

Control input

4.2 CASE 2. Time-varying parameters

In this case, we consider the case when both values of the pendulum mass and center of gravity are time-varying as

$$\begin{array}{l} m_{3} = 0.0538 + 0.04\cos 50t~\mathrm{kg}, \\ \ell_{3} = 0.113 + 0.1\sin 4t~\mathrm{m}. \end{array} $$

All other system parameters remain the same as those in the previous case. The controller parameters are selected as c 1=60, c 2=30, c 3=0.06, c 4=1×10−8 and ϕ i =1,i=1,…,4. The simulation results are presented in Figs. 5 and 6. Figure 5 shows that both the arm and pendulum converge to their desired values in 3 seconds even with the time-varying parameters. The robustness of the controller is still sufficient to regulate the system in a bounded region near the equilibrium point when the external force appears during 4 to 6 seconds. Figure 6 depicts the control effort.

Fig. 5
figure 5

System response (a) arm angle (b) pendulum angle

Fig. 6
figure 6

Control input

5 Conclusions

We have proposed an adaptive controller for a rotary inverted pendulum system subject to time-varying uncertainties and external disturbances. We first apply Olfati’s transformation to the system dynamics, and then the function approximation technique is utilized to estimate the uncertainties. Based on the Lyapunov-like stability theory, the closed-loop stability is proved to be ultimately uniformly bounded. Experimental results show that the proposed design is able to give proper performance regardless of various uncertainties and disturbances.