Observer-Based Controllers for Two-Wheeled Inverted Robots with Unknown Input Disturbance and Model Uncertainty

In this paper, two controllers with a compound disturbance observer are proposed for a two-wheeled inverted robot (TWIR) with model uncertainty and unknown input disturbance. First, an equivalent linear model of the TWIR with uncertainty and input disturbance is proposed using the Taylor series expansion for the nonlinear model of the TWIR at an equilibrium point, in which the nonlinear part of the Taylor series and the model uncertainty are combined with unknown input disturbance as compound input disturbance. /en, the compound input disturbance is estimated by using the Newton method and reference model. As the estimated compound disturbance is used to compensate for the compound disturbance, the equivalent linear system becomes closely definite without compound input disturbance. Finally, two controllers are proposed using the equivalent linear system. Stability analysis of the proposed control methods is also given. To illustrate the proposed methods, some simulations for the TWIR are performed and compared with the existing methods. /e main contribution of this work includes the following: (i) simple controllers based on compound input disturbance observer for trajectory tracking and balancing of TWIRs with unknown input disturbance and model uncertainty are proposed; (ii) the stability of proposed closed-loop control systems is proved; (iii) our proposed methods are simulated and compared with the existing methods.

In [3], an adaptive backstepping controller combined with two PD controllers was proposed for an electric scooter with model uncertainty, but the input disturbance was not considered. In [4], both model uncertainty and exogenous disturbance were addressed, but the proposed controller was complicated. In [5], sliding mode controllers were applied to dealt with model uncertainty, and experimental data based friction compensation models were built for a TWIR, so this is an disadvantage in design. In [6], adaptive sliding mode control in combination with direct fuzzy control was applied for balancing and trajectory tracking of the TWIR; however, no disturbance was considered. In [8], a nonlinear state transformation-based controller was proposed without considerations of model uncertainty and disturbance. A statedependent nonlinear model-based LQR controller was designed in [9], which was robust to external disturbances but not dealing with model uncertainty. In [10], a passivity-based controller using the two-rule Takagi-Sugeno fuzzy model was proposed for the TWIR. In [11], a controller using the statedependent Riccati equation was designed. A combination of two PD controllers and a time-delayed controller for fast movement of TWMR was proposed in [12], where the first PD controller was designed for the pitch angle, the other PD controller was applied for the orientation, and the time-delayed controller was synthesised for the position. In [13], a proposed control scheme consists of local controller and a global planner for the TWIR-based personal transportation vehicle, in which the local controller contains three PID controllers for the pitch angle, the yaw angle, and the position. In [16], an indirect adaptive fuzzy controller based on the trajectory planner was proposed for the TWIR with model uncertainty. Four interval type 2 fuzzy logic inference system-based controllers [17] were designed using the Takagi-Sugeno model for the TWIR with uncertainty and disturbance, but the controller is dependent on solving linear matrix inequalities. In [20], an optimal H-infinity controller was proposed by using Taylor series approximation at operating point, so it requires a lot of computations. Trajectory tracking control and control for obstacle avoidance of the TWIR with certain model and no disturbance were proposed in [18] and [21]. In [19], a nonlinear disturbance observer based dynamic surface controller was proposed, in which the observer is a complex differential equation to solve and the designed controller was also complicated when using a global change of coordinates and dynamic surface control technique and filters. is controller can only stabilize the pitch and yaw angles of the TWIR. Recently, an adaptive observer-based high gain controller was proposed in [22]. It requires a lot of integral calculations to estimate state variables and TWIR's parameters. In [23], a hierarchical sliding mode control was proposed for controlling longitudinal and balancing motions of TWIR only. A control moment gyro [24] was used for keeping a small TWIR-balanced independence of moving control; this allows to perform the trajectory tracking problem separately from the balancing problem. Some new application directions of TWIRs were recently developed in [25][26][27].
Most of the mentioned above methods have not dealt with model uncertainty and unknown input disturbances; only few methods had done that, but they were very complicated for design and implementation. is motivates us to propose a simpler controller based on an input disturbance observer to concurrently overcome both model uncertainty and unknown input disturbance. In this work, our main contributions are to (a) convert the nonlinear model of TWIRs into an equivalent linear model, in which the uncertainty of nonlinear model and the unknown input disturbance are lumped as compound input disturbance, (b) prove the stability of the proposed TWIR control system, and (c) compare the proposed method with other existing methods through numerical simulations. e remaining part of the work is organized as follows. e next section revisits a mathematical model of the TWIR and builds an exact linear model of TWIR with model uncertainty and unknown input disturbance by introducing the compound input disturbance. Two controllers with the disturbance observer are proposed for the TWIR and stability analysis is also provided in Section 3. In Section 4, some numerical simulations are carried out to illustrate the proposed method and compare it with the existing methods. e final section provides conclusions and future works.

Mathematical Model of TWIR
In this work, a mathematical model of TWIR in [28] is used for the controller design and simulation. e schematic diagram of a TWIR is shown in Figure 1. e notations and parameters of the TWIR are shown in Table 1, where J � mr 2 /2, K � mr 2 /4, I 1 � I 3 � Md 2 /2, and I 2 � Ml 2 /2. e motion equations of the TWIR [28] are represented as in equations (1), (2), and (3): Let us define state variables and inputs as follows: respectively. en, where , , System (5) is used to build a linear model with compound disturbance in Section 3.

Proposed Controllers with Compound
Disturbance Observer

Exact Linear Model with Compound Disturbance.
Let x e be an equilibrium point of system (5), then x e is the solution to the equation f(x, 0 ) � 0 . us, x e � * 0 * 0 0 0 T , where " * " are any values of x 1 and x 3 , which are the desired position and heading angle of the TWIR. Without loss of generality, it is assumed that " * " is zero; this means x e � 0 .
Since 6 are linear functions, the first derivatives of first three variables can be expressed as follows: where Because the matrices A 1 and B 1 are constant, system (7) is certain and x 4 , x 5 , and x 6 are virtual inputs. In addition, since the matrix B 1 � 0 3×2 , system (7) is not directly affected by both the input and unknown input disturbances.
Since rank(B 2 ) � 2, the inverse of the matrix B T 2 B 2 exists. So, Δ(x, u) can be rewritten as follows: As parameters of the TWIR are uncertain, system (8) can be represented as is is equivalent to where From equations (7), (11), and (12), we obtain us, the uncertainty of system (13), also combined uncertainty of system (7) and system (11), is It implies that the uncertainty of system (5) can be described as uncertain input disturbance d u .
As unknown input disturbance d i is applied to the TWIR, system (13) becomes where d c � d u + d i . us, the compound disturbance d c represents both the unknown input disturbance and the model uncertainty. System (14) is a linear model exactly representing the nonlinear system (5). In Section 3.2, the compound disturbance will be estimated.

Compound Disturbance Observer.
In this section, an input disturbance observer (a proposal in [29]) is presented and applied for system (14). By using the Euler method, we have an approximate discrete-time model of system (14) as follows: where A d � I + T s A, B d � T s B, and T s is the sampling time.
A reference model will be used to estimate the disturbance d c k as follows: where d c k− 1 is the estimated disturbance at time instance k − 1. en, system (15) with disturbance compensation d c k− 1 is presented as and system (14) with approximated disturbance compensation becomes Subtracting equation (16) from equation (17), we get So, there exists a difference δ k in equation (19), which is also the approximation error of equation (15) due to discretization process as follows: Define a cost function Theorem 1 (see [29]). If system (18) has rank(B) � 2, the measured state x k � x(t k ) from system (18) is exactly represented by the following discrete-time model: with T s being suitably selected, the estimated disturbance (21) will satisfy that d Proof. e proof was given in [29]. So, it is skipped here. For the reference model (16), it is possible to choose z k− 1 � x k− 1 for ∀k. So, equation (21) becomes e correct value of the compound disturbance is However, δ k is proportional to T 2 s because of the local truncation error [30]. us, the estimation error can be made as small as possible by decreasing the sampling time T s . e estimated compound disturbance is used to complement system (14) as in equation (18), where ∀t, kT s ≤ t < (k + 1)T s , and ∀k � 0, 1, . . . ,. Keep in mind that the estimated compound disturbance d c (t) looks like a series of step functions.
In summary, the compound disturbance observer is implemented as follows: (1) Initialization: choose T s > 0 is sufficiently small. System (18) is applied to design state feedback and trajectory tracking controllers using the disturbance observer (24) in Section 3.3. □ 3.3. Stability Analysis. In this section, the stability of system (18) with a state feedback controller is analyzed. Some assumptions are given as follows: ere exists a state feedback controller u � − K x satisfying that the matrix A − BK is Hurwitz (all real part of eigenvalues is negative).

Lemma 1. With assumption 1, system (18) with a state feedback controller K satisfying the assumption 2 is input to state stable (ISS).
Proof. Let c k (t) � d c (t) − d c k− 1 for ∀t, kT s ≤ t < (k + 1)T s and c k (t) � 0 for t ∉ [kT s , (k + 1)T s ). From equations (25) and (26) s due to the local truncation error [30], it is bounded. In addition, the compound disturbance and its first derivative are also bounded by assumption 1, and then, c k (t) is bounded. Let en, c(t) is also bounded.
Substituting c(t) and the controller u � − K x into equation (18), we obtain Denote A � A − BK. Since A is Hurwitz by assumption 2, for ∀Q > 0 and Q T � Q, the Lyapunov equation always has a unique solution P, which is symmetric positive definite. By using a Lyapunov function as follows, where | * | denotes L ∞ norm and λ min is the smallest eigenvalue of the matrix Q.
As long as x lies outside the domain V < 0, thus x ⟶ Γ containing the origin. Hence, system (27) is input to state stable [31]. is means that system (18) is ISS.
In conclusion, the state feedback controller with disturbance observer is where the gain matrix K can be designed using existing methods in the literature such as LQR control, pole placement method, or even H ∞ . e proposed controller is simple not only in design but also implementation. In addition, it can cope with model uncertainty and input disturbance of TWIRs. In Section 3.4, we propose a trajectory tracking controller for TWIRs with model uncertainty and input disturbance.  (18), we obtain where c is previously defined in the proof of Lemma 1.

Theorem 2.
e tracking error holds that lim t⟶∞ e(t) � 0 under the following control law: where K satisfies the condition that A − BK is Hurwitz.
In addittion, the matrices A and B have special forms as in equation (13), so is unique due to rank(B) � 2. So, system (32) can be represented as follows: is system is similar to system (27), but the variable e is in place of x. Define a Lyapunov function as where P > 0. en, where Q � − (A T P + PA), A � A − BK, and λ min is the minimum eigenvalue of the matrix Q. is means that _ V < 0 whenever e ∉ Γ � ∀ e | | e | ≤ (2|PB|| c |/λ min ) . Hence, e is bounded.
Take the second derivative of V to get where Q e � A T Q + QA. Since e is bounded, c and _ c are also bounded according to Lemma 1, € V is bounded. Using Barbalat's Lemma, one gets lim t⟶∞ e(t) � 0 .
In summary, the tracking controller is For disturbance estimation, equations (16) and (24) is a constant matrix, which is previously computed one time.
is is also true for computing the matrix [(B T B) − 1 B T ] 2×6 . us, the calculation of control signal involves only matrix/ vector multiplication and addition, so it is simple to implement. is is an advantage of the proposed method in comparison with other methods in the literature such as works in [6,20]. In [6], several integral computations involving adaptive laws have to be calculated to obtain control signals, and no input disturbance is mentioned in design process and simulation. In [20], the model linearization and Riccati equation solving are performed to obtain the control gain matrix at every sampling instance, so the computational load is very huge for implementation.

Numerical Simulation
To illustrate the proposed method, a state feedback controller is designed using LQR method. However, there have been several other methods in the literature for designing the state feedback controller, thus the proposed method is very flexible in design. e linear model (18) is applied to design a LQR controller [32] such that the following cost function is minimum: where Q c is a symmetric positive definite matrix and R c is a symmetric nonnegative definite matrix. e controller, which satisfies the cost function (40), is u � − K x, where and P c is the solution to the Riccati equation: In this paper, the values of the TWIR's parameters are given as follows: M � 0.765 kg, m � 0.03 kg, l � 0.1 m, d � 0.195 m, r � 0.033 m, g � 9.81 m/s 2 , and C � 0.005 and the sampling time is T s � 0.001. us, following matrices are obtained: Remark 1. Since the input to the LQR controller consists of state variable pairs (x; _ x), (θ; _ θ), and (ψ; _ ψ), the LQR output is similar to the sum of the three PD controllers' output as in works [3,12,13], in which each state variable pair is the input to one PD controller.
For performance comparison, four cases are considered as follows: (i) Case 1: the model is certain, and there is no input disturbance (ii) Case 2: the model is certain, and there is unknown input disturbance, where For the first three cases, setpoints for position, tilt angle, and heading angle are 1.5 m, 0 rad, and 0.4 rad, respectively. e initial values for position, tilt angle, and heading angle are 0 m, 0.3 rad, and 0 rad, respectively. e nonlinear model (5) is used to simulate the TWIR and the LQR controller with disturbance observer (31) being applied for these three cases. e disturbances and their estimated disturbances are shown in Figures 2(a), 2(b), 3(a) and 3(b).
It can be seen that for the case 1 the estimated disturbances are nonzero for a short time interval. is is caused by the Taylor approximation error Δ(x, u) in  Journal of Control Science and Engineering equation (8). For the case 2, it takes a little bit longer time for the estimated disturbances converging to the disturbances in comparison with the case 1. But for the case 3, it takes about 2 seconds for convergence with a small error. e position, tilt angle, and heading angle of robot are shown in Figures 4(a)-4(c). When there is unknown input disturbance, the proposed controller still guarantees the same performance as that in the case 1. is performance is little bit different as both unknown input disturbance and model uncertainty are applied. us, the proposed controller maintained well the control performance even though there were model uncertainty and unknown input disturbance. As the LQR controller is used without the compound disturbance observer, the control performance becomes worse than the proposed method, because there are oscillations of position and tilt angle and the divergence of the heading angle from the setpoint (see Case 3 without observer in Figure 4). So, the   (5) is also used to simulate the TWIR, and the tracking controller (39) and the state feedback controller (31) are compared to those in the work in [20]. Simulation results are displayed in Figures 5 and 6. It shows that all the tracking errors by the two proposed methods for position, tilt angle, heading angle, and their derivatives converge to zero quickly, the TWIR follows the desired trajectory closely, and control signals (provided by the tracking controller) are smooth. e tracking controller (39) provides better performance than that of the state feedback controller (30).
In comparison with [20] under the same desired trajectory type (circle, test 3 [20]), the proposed tracking controller (39) is better than the controller in the work [20] in terms of steady-static error and smoothness of control signals, since there was impulse type of control signal and there exists steady-static error of the tilt angle in [20].

Conclusions and Future Works
In this work, the state feedback controller with compound disturbance observer (31) and the trajectory tracking controller with compound disturbance observer (39) were proposed for TWIRs with model uncertainty and unknown input disturbance, and the stability of the closed-loop control system with the proposed controller was also proved. e proposed controllers have advantages of simplicity in implementation and flexibility in design for the feedback gain matrix.
Numerical simulations were taken to illustrate the proposed methods and compare with the existing method in [20] and the classical LQR controller. e results show that the control performance was well maintained under model uncertainty and unknown input disturbance by using the proposed control methods, whereas the control performance becomes worse as the classical LQR controller was applied. e proposed tracking controller (39) provided better performance than the controller in [20] for the circular trajectory type, the state feedback controller (31), and also the LQR controller.
Future works focus on controller design methods for the exact linear model of TWIR (14) using different techniques and other existing observers and the further extension to other systems in the Lagrangian form.

Data Availability
No data were used to support this study.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.