Next Article in Journal
Computational Modeling of Sodium-Ion-Channel-Based Glucose Sensing Biophysics to Study Cardiac Pacemaker Action Potential
Previous Article in Journal
Significance of Mathematical Modeling and Control in Real-World Problems: New Developments and Applications
Previous Article in Special Issue
Human Activity Recognition from Accelerometry, Based on a Radius of Curvature Feature
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Design and Implementation of a Discrete-PDC Controller for Stabilization of an Inverted Pendulum on a Self-Balancing Car Using a Convex Approach

by
Yasmani González-Cárdenas
1,
Francisco-Ronay López-Estrada
1,*,
Víctor Estrada-Manzo
2,
Joaquin Dominguez-Zenteno
1,* and
Manuel López-Pérez
1
1
TURIX-Dynamics Diagnosis and Control Group, Tecnológico Nacional de México, Tuxtla Gutierrez 29580, Mexico
2
Department of Mechatronics, Universidad Politécnica de Pachuca, Zempoala 43830, Mexico
*
Authors to whom correspondence should be addressed.
Math. Comput. Appl. 2024, 29(5), 83; https://doi.org/10.3390/mca29050083
Submission received: 22 July 2024 / Revised: 10 September 2024 / Accepted: 13 September 2024 / Published: 18 September 2024
(This article belongs to the Special Issue Numerical and Evolutionary Optimization 2024)

Abstract

:
This paper presents a trajectory-tracking controller of an inverted pendulum system on a self-balancing differential drive platform. First, the system modeling is described by considering approximations of the swing angles. Subsequently, a discrete convex representation of the system via the nonlinear sector technique is obtained, which considers the nonlinearities associated with the nonholonomic constraint. The design of a discrete parallel distributed compensation controller is achieved through an alternative method due to the presence of uncontrollable points that avoid finding a solution for the entire polytope. Finally, simulations and experimental results using a prototype illustrate the effectiveness of the proposal.

1. Introduction

The control of critical systems is an important area of study in robotics, as these systems operate around unstable equilibrium points; once they reach a critical zone, it is impossible to re-stabilize them due to physical limitations in their actuators; a classic example is the inverted pendulum on a self-balancing platform. The main challenge lies in maintaining two coupled joints within the allowable limits of the equilibrium point despite the inevitable presence of measurement noise, disturbances, and model inaccuracies [1,2]. One way to prevent the system from going beyond its bounds is using constrained predictive control strategies [3,4]. However, these strategies come with high computational costs, making them prohibitive for most of the low-cost embedded hardware.
As the balancing platform is essentially a mobile robot with differential traction, movement restrictions arise due to its nonholonomic nature, adding complexity and turning it into a multi-objective problem. Balance must be maintained while following a specific trajectory on the plane, which poses significant challenges in planning and control execution [5]. The literature covers various subjects: hardware, sensing configurations, and control methods for two-wheeled and self-balancing robots [6,7,8]. For instance, the authors in [1] introduced a low-cost prototype with nested control to regulate the longitudinal displacement and speed via the pitch angle. In [9,10], advanced control algorithms are proposed using adaptive sliding mode and direct fuzzy control for improved velocity tracking and stability. The works [11,12] presented a nonlinear control approach, avoiding linearization around the equilibrium points; a machine-learning-based adaptive fuzzy logic-proportional integral controller for variable payloads in a two-wheeled underactuated-mobile inverted pendulum was developed by [13]. Recently, refs. [14,15] proposed a self-balancing robot with PID control using sensors and complementary filters for practical angular velocity estimation and motor stability; the controller was implemented with Arduino. However, to the best of the authors’ knowledge, few works have been dedicated to the study of two-wheeled and self-balancing platforms with a coupled inverted pendulum.
This paper presents the model and control of the inverted pendulum coupled with a two-wheeled and self-balancing differential robot. The model is developed under specific considerations, thus, allowing for simplifications without losing accuracy within the operating region. A discrete parallel distributed compensation (PDC) controller is designed for control and trajectory tracking based on an exact convex model [16]. Experimental results are presented to illustrate the performance of the proposed method.
The rest of the paper is organized as follows: Section 2 outlines the fundamental concepts and the problem to be solved. Section 3 presents the main results related to obtaining the mathematical model and controller design. Section 4 illustrates the performance of the proposed control scheme by means of simulations, while Section 5 validates the control strategy by means of an experimental test. Finally, Section 6 closes the paper with some final remarks and conclusions.
Preliminaries: Throughout the paper, the following notation will be employed: In the case of a matrix A R n × n , A T and A 1 stand for the transpose and the inverse, respectively. Given the complex variable z C , z ¯ represents its complex conjugate. Additionally, the symbol * indicates the transpose of the element in the symmetric position of the matrix.

2. Problem Statement

Consider the inverted pendulum system coupled to a two-wheeled and self-balancing mobile platform with differential traction, as displayed in Figure 1. This system can be modeled as a double inverted pendulum, which includes rotational motion and longitudinal movement. The differential traction mechanism allows the platform to follow a specific path. The control objective for the mobile platform is to track a desired reference signal while the pendulum is stabilized at the vertical position.
A free-body diagram of the system can be seen in Figure 2, where J 1 and J 2 represent the joints. In this case, joint J 2 couples the inverted pendulum with the cart and its pivotal, allowing the pendulum to swing while mounted on the mobile platform. The parameters and variables of this system are shown in Table 1.
Considering the Euler–Lagrange energy approach to model the longitudinal motion, where both wheels rotate together to stabilize the oscillating body. The energy equations for each wheel are defined by the following:
E k L ( t ) = 1 2 m w ( r θ ˙ L ( t ) ) 2 + 1 2 I w θ ˙ L 2 ( t ) , E k R ( t ) = 1 2 m w ( r θ ( t ) ˙ R ) 2 + 1 2 I w θ ˙ R 2 ( t ) .
The potential energy for both is zero ( E p L ( t ) = E p R ( t ) = 0 ) as they remain on the horizontal plane. For the position of the cart ( θ 3 ( t ) = 0 , y ( t ) = 0 ), the localization of the center of mass in the plane ( x , z ) of the joint J 1 (self-balancing) is represented by the following:
x 1 ( t ) = r 2 ( θ L ( t ) + θ R ( t ) ) + l 1 sin ( θ 1 ( t ) ) , z 1 ( t ) = l 1 cos ( θ 1 ( t ) ) ,
and the velocity of the center of mass v 1 ( t ) = [ x ˙ 1 ( t ) z ˙ 1 ( t ) ] T :
x ˙ 1 ( t ) = r 2 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) + θ ˙ 1 ( t ) l 1 cos ( θ 1 ( t ) ) , z ˙ 1 ( t ) = θ ˙ 1 ( t ) l 1 sin ( θ 1 ( t ) ) .
As for the kinetic and potential energies at the joint J 1 , we have
E k 1 ( t ) = 1 2 m 1 ( v 1 ( t ) v 1 T ( t ) ) + 1 2 I 1 θ ˙ 1 2 ( t ) , E p 1 ( t ) = m 1 g z 1 ( t ) ;
which are equivalent to:
E k 1 ( t ) = r 2 8 m 1 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) 2 + 1 2 ( m 1 l 1 2 + I 1 ) θ ˙ 1 2 ( t ) + r 2 m 1 l 1 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) θ ˙ 1 ( t ) cos ( θ 1 ( t ) ) , E p 1 ( t ) = m 1 g l 1 cos ( θ 1 ( t ) ) .
Similarly, for the joint J 2 (pendulum), its position and velocity in the plane ( x , z ); v 2 ( t ) = [ x ˙ 2 ( t ) z ˙ 2 ( t ) ] T are described by the following expressions:
x 2 ( t ) = r 2 ( θ L ( t ) + θ R ( t ) ) + L 1 sin ( θ 1 ( t ) ) + l 2 sin ( θ 2 ( t ) ) , z 2 ( t ) = L 1 cos ( θ 1 ( t ) ) + l 2 cos ( θ 2 ( t ) ) , x ˙ 2 ( t ) = r 2 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) + θ ˙ 1 ( t ) L 1 cos ( θ 1 ( t ) ) + θ ˙ 2 ( t ) l 2 cos ( θ 2 ( t ) ) , z ˙ 2 ( t ) = θ ˙ 1 ( t ) L 1 sin ( θ 1 ( t ) ) θ ˙ 2 ( t ) l 2 sin ( θ 2 ( t ) ) .
Their kinetic and potential energies are obtained as follows:
E k 2 ( t ) = 1 2 m 2 ( v 2 ( t ) v 2 ( t ) T ) + 1 2 I 2 θ ˙ 2 2 ( t ) , E p 2 ( t ) = m 2 g z 2 ( t ) .
by replacing v 2 ( t ) and z 2 ( t ) , we have:
E k 2 ( t ) = r 2 8 m 2 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) 2 + 1 2 m 2 L 1 2 θ ˙ 1 2 ( t ) + 1 2 ( m 2 l 2 2 + I 2 ) θ ˙ 2 2 ( t ) + r 2 m 2 L 1 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) θ ˙ 1 ( t ) cos ( θ 1 ( t ) ) + r 2 m 2 l 2 ( θ ˙ L ( t ) + θ ˙ R ( t ) ) θ ˙ 2 ( t ) cos ( θ 2 ( t ) ) + m 2 L 1 l 2 θ ˙ 1 ( t ) θ ˙ 2 ( t ) cos ( θ 1 ( t ) θ 2 ( t ) ) , E p 2 ( t ) = m 2 g L 1 cos ( θ 1 ( t ) ) + m 2 g l 2 cos ( θ 2 ( t ) ) .

Nonholonomic Model

The above equations do not consider the kinematic part of the nonholonomic inherent in the differential traction vehicle setup. Following [5], the model of the differential robot considering the displaced point is as follows:
x ˙ ( t ) = r 2 cos ( θ 3 ( t ) ) r w P sin ( θ 3 ( t ) ) ω R ( t ) + r 2 cos ( θ 3 ( t ) ) + r w P sin ( θ 3 ( t ) ) ω L ( t ) , y ˙ ( t ) = r 2 sin ( θ 3 ( t ) ) + r w P cos ( θ 3 ( t ) ) ω R ( t ) + r 2 sin ( θ 3 ( t ) ) r w P cos ( θ 3 ( t ) ) ω L ( t ) , θ ˙ 3 ( t ) = r w ( ω R ( t ) ω L ( t ) ) ,
where ω R ( t ) and ω L ( t ) are the wheel velocities. By considering these velocities, the angle θ 3 can be computed in real-time using the following odometry equation:
θ 3 ( t ) = r w ( θ R ( t ) θ L ( t ) ) .
Note that it is not possible to simultaneously control x, y, and θ 3 due to the nonholonomic constraints; therefore, θ 3 is treated as an exogenous parameter and the dynamic equation associated with θ 3 is removed from (4). Now, let us consider the accelerations at each wheel ω ˙ R ( t ) and ω ˙ L ( t ) , an augmented system can be formulated with θ ¨ L = ω ˙ L ( t ) = α L ( t ) and θ ¨ R = ω ˙ R ( t ) = α R ( t ) ; it yields the following augmented nonlinear system:
x ˙ ( t ) = r 2 cos ( θ 3 ( t ) ) r w P sin ( θ 3 ( t ) ) ω R ( t ) + r 2 cos ( θ 3 ( t ) ) + r w P sin ( θ 3 ( t ) ) ω L ( t ) , y ˙ ( t ) = r 2 sin ( θ 3 ( t ) ) + r w P cos ( θ 3 ( t ) ) ω R ( t ) + r 2 sin ( θ 3 ( t ) ) r w P cos ( θ 3 ( t ) ) ω L ( t ) , ω ˙ R = α R ( t ) , ω ˙ L = α L ( t ) .
Equations (1)–(3) describe the kinetic and potential energy of the tires and the joint together with the kinematic model (5); all of them will be used to solve the Euler–Lagrange equations describing the robot behavior. Here, the challenge is to design a tracking controller that maintains the vertical position of the joint while the differential cart follows a trajectory. The next section proposes a method for the design of a discrete-time PDC controller for trajectory tracking while guaranteeing stability.

3. Main Results

The proposed methodology assumes that the only energy contributing to the joint motion comes from the translation of the cart, with zero rotational energy at θ 3 ; rotation about θ 3 will only be considered in the kinematic part of the cart. Following the Euler–Lagrange modeling procedure, the kinetic energy can be expressed as T ( t ) = E k L ( t ) + E k R ( t ) + E k 1 ( t ) + E k 2 ( t ) and the potential energy as U ( t ) = E p L ( t ) + E p R ( t ) + E p 1 ( t ) + E p 2 ( t ) (from Equations (1), (2), and (3), respectively). The Lagrangian is then denoted as L ( q ( t ) ) = T ( t ) U ( t ) , where q ( t ) is the generalized coordinate.
Traditionally, the functional derivative is applied using a vector q together with the non-conservative forces acting on each joint; in this case, the torques applied to each wheel are considered [17]. However, a model with torques as the inputs could be more practical. This work assumes that each motor has an internal velocity controller, which is very common, as discussed in [18].
The vector of generalized coordinates is defined by q ( t ) = [ θ 1 ( t ) , θ 2 ( t ) ] T and solving the Euler–Lagrange equation:
d d t L ( q ( t ) ) q ˙ ( t ) L ( q ( t ) ) q ( t ) = 0 ,
the solution for the generalized coordinates is obtained as follows:
q 1 ( t ) : = r 2 ( m 1 l 1 + m 2 L 1 ) cos ( θ 1 ( t ) ) ( θ ¨ L ( t ) + θ ¨ R ( t ) ) + ( m 1 l 1 2 + m 2 L 1 2 + I 1 ) θ ¨ 1 ( t ) + m 2 L 1 l 2 cos ( θ 1 ( t ) θ 2 ( t ) ) θ ¨ 2 ( t ) + m 2 L 1 l 2 sin ( θ 1 ( t ) θ 2 ( t ) ) θ ˙ 2 2 ( t ) = ( m 1 l 1 + m 2 L 1 ) g sin ( θ 1 ( t ) ) ,
q 2 ( t ) : = r 2 m 2 l 2 cos ( θ 2 ( t ) ) ( θ ¨ L ( t ) + θ ¨ R ( t ) ) + ( m 2 l 2 2 + I 2 ) θ ¨ 2 ( t ) + m 2 L 1 l 2 cos ( θ 1 ( t ) θ 2 ( t ) ) θ 1 ¨ m 2 L 1 l 2 sin ( θ 1 ( t ) θ 2 ( t ) ) θ ˙ 1 2 ( t ) = m 2 g l 2 sin ( θ 2 ( t ) ) .
Considering that angles θ 1 and θ 2 variate within a small range ( 10 θ 1 , 2 10 ) , the following approximations can be used:
cos ( θ 1 , 2 ) 1 , sin ( θ 1 , 2 ) θ 1 , 2 , θ ˙ 1 , 2 2 0 ;
hence, (6) and (7) yield:
r 2 ( m 1 l 1 + m 2 L 1 ) θ ¨ L ( t ) + r 2 ( m 1 l 1 + m 2 L 1 ) θ ¨ R ( t ) + ( m 1 l 1 2 + m 2 L 1 2 + I 1 ) θ ¨ 1 ( t ) + m 2 L 1 l 2 θ ¨ 2 ( t ) ( m 1 l 1 + m 2 L 1 ) g θ 1 ( t ) = 0 ,
r 2 m 2 l 2 θ ¨ L ( t ) + r 2 m 2 l 2 θ ¨ R ( t ) + m 2 L 1 l 2 θ ¨ 1 ( t ) + ( m 2 l 2 2 + I 2 ) θ ¨ 2 ( t ) m 2 g l 2 θ 2 ( t ) = 0 ,
where θ ˙ R ( t ) and θ ˙ L ( t ) represent the accelerations of each wheel that are considered as the control inputs. From (9) and (10), a system of first-order ordinary differential equations is obtained:
θ ˙ 1 ( t ) = ω 1 ( t ) , θ ˙ 2 ( t ) = ω 2 ( t ) , ω ˙ 1 ( t ) = σ 1 θ 1 ( t ) + σ 2 θ 2 ( t ) + σ 3 α R ( t ) + σ 3 α L ( t ) , ω ˙ 2 ( t ) = σ 4 θ 1 ( t ) + σ 5 θ 2 ( t ) + σ 6 α R ( t ) + σ 6 α L ( t ) ,
with:
σ 1 = L 1 g l 2 2 m 2 2 + g l 1 m 1 l 2 2 m 2 + I 2 L 1 g m 2 + I 2 g l 1 m 1 I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 , σ 2 = L 1 g l 2 2 m 2 2 I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 , σ 3 = l 1 m 1 m 2 r l 2 2 + I 2 L 1 m 2 r + I 2 l 1 m 1 r 2 I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 , σ 4 = l 2 m 2 g m 2 L 1 2 + g l 1 m 1 L 1 I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 , σ 5 = l 2 m 2 g m 2 L 1 2 + g m 1 l 1 2 + I 1 g I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 , σ 6 = l 2 m 2 m 1 r l 1 2 L 1 m 1 r l 1 + I 1 r 2 I 2 m 2 L 1 2 + m 1 m 2 l 1 2 l 2 2 + I 2 m 1 l 1 2 + I 1 m 2 l 2 2 + I 1 I 2 .
Finally, by combining (5) and (11), a nonlinear model of the inverted pendulum on a self-balancing robot yields:
x ˙ ( t ) y ˙ ( t ) θ ˙ 1 ( t ) θ ˙ 2 ( t ) ω ˙ R ( t ) ω ˙ L ( t ) ω ˙ 1 ( t ) ω ˙ 2 ( t ) = 0 0 0 0 σ 10 σ 7 2 w σ 10 + σ 7 2 w 0 0 0 0 0 0 σ 9 + σ 8 2 w σ 9 σ 8 2 w 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 σ 1 σ 2 0 0 0 0 0 0 σ 4 σ 5 0 0 0 0 x ( t ) y ( t ) θ 1 ( t ) θ 2 ( t ) ω R ( t ) ω L ( t ) ω 1 ( t ) ω 2 ( t ) + 0 0 0 0 0 0 0 0 1 0 0 1 σ 3 σ 3 σ 6 σ 6 α R ( t ) α L ( t )
with:
σ 7 = 2 P r sin ( θ 3 ( t ) ) , σ 8 = 2 P r cos ( θ 3 ( t ) ) , σ 9 = r w sin ( θ 3 ( t ) ) , and σ 10 = r w cos ( θ 3 ( t ) ) .
Model (12) contains information about the kinematic aspect associated with the nonholonomic constraints and the dynamic longitudinal model related to self-balancing coupled with the inverted pendulum. Despite the small angle approximations, the model contains some nonlinearities related to the angle θ 3 ( t ) that will be handled in the next section by considering exact convex modeling.

Convex Controller Design

The nonlinear model (12) can be represented as a discrete convex Takagi–Sugeno (TS) model to simplify the controller design. This transformation is achieved using the nonlinear sector technique, as detailed in [16]. A convex representation is obtained by expressing the nonlinearities of the system as bounded functions. This rewriting of the nonlinear model allows us to design the controller by obtaining a numerical solution using Linear Matrix Inequalities (LMIs).
The resulting discrete convex model is given by the following:
x ( k + 1 ) = i = 1 r h i ( ρ ( k ) ) G i x ( k ) + H u ( k ) , y ( k ) = C x ( k ) ,
where x R 8 , u R 2 , and y R 8 are the state, input, and output vectors, respectively. The exogenous premise vector is ρ ( k ) = [ cos ( θ 3 ( k ) ) , sin ( θ 3 ( k ) ) ] T , it is assumed to be bounded in a compact set C R 2 , and the number of vertices is r = 2 2 = 4 . Matrices G i R 8 × 8 , H R 8 × 2 , and C R 4 × 8 are the discrete equivalent matrix vertices computed utilizing the sector nonlinearity approach [16]. The membership functions h i ( ρ ( k ) ) , i { 1 , 2 , 3 , 4 } hold the convex sum property in C : i = 1 r h i ( ρ ( k ) ) = 1 . Hence, as the entries of the premise vector ρ ( k ) have natural limits, we have 1 ρ 1 , 2 1 ; then, the membership functions
h 1 ( k ) = w 1 0 ( k ) w 2 0 ( k ) , h 2 ( k ) = w 1 0 ( k ) w 2 1 ( k ) , h 3 ( k ) = w 1 1 ( k ) w 2 0 ( k ) , h 4 ( k ) = w 1 1 ( k ) w 2 1 ( k ) ,
are obtained with w 1 0 ( k ) = 1 cos ( θ 3 ( k ) ) 2 , w 1 1 ( k ) = 1 w 1 0 ( k ) , w 2 0 ( k ) = 1 sin ( θ 3 ( k ) ) 2 and w 2 1 ( k ) = 1 w 2 0 ( k ) .
For the control and stabilization of the system (13), the following PDC-type control law is employed
u ( k ) = i = 1 r h i ( ρ ( k ) ) K i x ( k ) ,
where K i , i { 1 , 2 , 3 , 4 } is the feedback gain to be designed.
As is customary in the convex community, the design of the feedback gains K i is carried out by quadratic Lyapunov functions ending in LMI conditions. However, the polytopic representation assumes independence among all terms of the vector ρ . Because of coupling among these terms, regions within the compact set C do not accurately belong to the model, leading to conservatism in the polytopic representation, as discussed in [19]. Specifically, the point ρ = [ 0 , 0 ] T within C results in two critically uncontrollable poles, limiting an asymptotically stable solution for the entire C .
Therefore, the values of K i for each vertex are computed by considering a Linear Quadratic Regulator (LQR). This approach allows for a straightforward adjustment of the cost matrices to attain the desired solution. The discrete-time LQR gains are calculated using the matrices Q and R to solve the optimization problem [20]:
J ( k ) = k = 1 x T ( k ) Q x ( k ) + u T ( k ) R u ( k ) .
As a stability test, an LMI region with a radius infinitesimally greater than unity to encompass the uncontrollable poles is considered through the following [21]:
S ( 1 + Δ r ) ( * ) S G i ^ S ( 1 + Δ r ) < 0 , S = S T > 0 ,
where G i ^ = G i + H K i , i { 1 , 2 , 3 , 4 } , S R 8 × 8 . These LMIs verify that all closed-loop system poles are within the circular region of radius 1 + Δ r . A non-negative slack variable Δ r 0 is introduced to handle numerical issues arising from critically stable uncontrollable poles.
Remark 1.
Due to the presence of uncontrollable points within the polytope defined by the nonlinear terms sin θ 3 and cos θ 3 , it is not possible to find a direct solution for LMIs (14). This is a computational problem that arises from the specific structure of the model and avoids those standard LMI solvers finding a feasible solution. However, the system is controllable, and a solution must exist, even if the solver can not solve the LMI directly. The proposed approach computes the controller gains at the vertex of the polytope by considering an LQR. Then, with the computed gains, the LMI (14) is solved to prove the asymptotic stability. We acknowledge that obtaining a direct LMI solution would be ideal. Nonetheless, the proposed method provides an effective alternative for stabilizing the inverted pendulum system from a practical point of view.

4. Simulation Results

For the simulations and experimental tests, the parameters in Table 2 have been used; most of these parameters have been provided by the manufacturer, while others have been computed and estimated in the laboratory. Due to the characteristics of the prototype, a sampling time of T s = 10 ms is considered.
To compute the LQR at each vertex, the following cost matrices have been used:
Q = diag ( [ 50 , 50 , 70 , 150 , 40 , 40 , 150 , 150 ] ) , R = diag ( [ 0.005 , 0.005 ] ) .
The weight matrices were adjusted empirically to balance the system performance and actuator power consumption. It should be noted that the proposed method primarily validates the stability of the convex gain configurations without ensuring optimal performance due to the presence of non-controllable points within the convex polytope. Some aspects, such as robustness, noise handling, and optimization of the weight matrices, are beyond the scope of this study. However, the stability of the system is verified by testing the LMI (14) with the computed gains, which guarantees asymptotic convergence of the desired tracking controller. The computed gains are:
K 1 = 5 60 7902 17945 55 3 201 3760 60 5 7902 17945 3 55 201 3760 , K 2 = 60 5 7902 17945 55 3 201 3760 5 60 7902 17945 3 55 201 3760 , K 3 = 60 5 7902 17945 55 3 201 3760 5 60 7902 17945 3 55 201 3760 , K 4 = 5 60 7902 17945 55 3 201 3760 60 5 7902 17945 3 55 201 3760 .
For the stability proof, using LMIs (14) with G ^ i = G i + H K i , i { 1 , 2 , , 4 } , and Δ r = 0.0005 , the following matrix S have been obtained:
S = 0.0099 ( * ) ( * ) ( * ) ( * ) ( * ) ( * ) ( * ) 0.0000 0.0099 ( * ) ( * ) ( * ) ( * ) ( * ) ( * ) 0.0000 0.0000 0.6949 ( * ) ( * ) ( * ) ( * ) ( * ) 0.0000 0.0000 1.6826 6.7423 ( * ) ( * ) ( * ) ( * ) 0.0000 0.0000 0.0031 0.0188 0.0002 ( * ) ( * ) ( * ) 0.0000 0.0000 0.0031 0.0188 0.0001 0.0002 ( * ) ( * ) 0.0000 0.0000 0.0029 0.0828 0.0009 0.0009 0.0067 ( * ) 0.0000 0.0000 0.3458 1.3896 0.0077 0.0077 0.0392 0.5091 .
Simulation results illustrate the stabilization of the pendulum from an unstable initial position, and its return to the origin are presented in Figure 3. These simulations operate within the ± 10 -degree range, consistent with the small-angle approximation. A Gaussian noise signal was also introduced into the control inputs to simulate possible disturbances. As can be seen in the figure, the controllers perform well, keeping the vertical position of the pendulum while maintaining the system at the origin.

5. Experimental Results

For practical implementation, the speed in each actuator is assumed to be controlled; in our case, the manufacturer provides a tuned PI controller to control the speed in each motor. Figure 4 shows a closed-loop system diagram of the proposal. As the output of the PDC controller is in terms of acceleration (rad/s2) at sampling instant ( k ) , it is necessary to obtain the reference of velocity for the PI controller. To this end, a dynamic integrator is added. First, the PDC acceleration command is multiplied by the sampling time T s to obtain the required velocity increment at time k + 1 in rad/s. This increment is added to the current velocity to obtain the reference velocity at k + 1 . The PI controller is correctly tuned and uses a considerably smaller sampling period, inserting virtually negligible dynamics into the overall system.
The algorithm has been programmed in the embedded system provided by the manufacturer, which consists of an STM32F103—Arm Cortex-M3 microcontroller. The data have been acquired through Bluetooth serial communication, with a sampling period of 500 ms. A lemniscate trajectory was considered as a reference. Details of how to implement this reference are given in Appendix A.
Figure 5 displays the trajectory tracking response, where a slight deviation can be seen in the curves due to the variations in the linear and angular velocities of the path. These deviations show the sensitivity of the system to path accelerations. Figure 6 illustrates the behavior of angles θ 1 and θ 2 during the 60 s of testing. In this case, noise is particularly noticeable at θ 1 , mainly due to the IMU’s low quality and the potentiometer used to measure θ 2 . However, despite the noise, the maximum deflection peaks remain within the designed values for the small angle approximations.
Figure 7 shows the errors concerning x and y obtained in the tracking test. Instantaneous deviations are observed due to the continuous effort to stabilize the cart, the pendulum, and the sensor noise. The different plots illustrate that the control system design implies a compromise between tracking error reduction and system stability. A video of the experimental test can be consulted at the link: https://bit.ly/gturixpendubot (accessed on 16 September 2024).

6. Conclusions

A convex approach has been considered for modeling and controlling an inverted pendulum coupled with a self-balancing differential drive cart. The adopted control approach is practical for satisfactorily managing the nonholonomic constraints in the differential drive kinematic model of the cart, as stability and trajectory tracking have been achieved. Regardless of the noise and disturbances, the system presents an adequate response, which is demonstrated to be robust and practical. The main drawback encountered was the impossibility of finding a feasible solution for the LMIs due to uncontrollable points that appear due to the nonholonomic system. This led to exploring an alternative solution using LQR, followed by stability verification. Future work will focus on improving the controller’s robustness and performance, optimizing its ability to handle system disturbances and uncertainties, and considering more advanced LMI techniques.

Author Contributions

Conceptualization, Y.G.-C. and F.-R.L.-E.; methodology, Y.G.-C., F.-R.L.-E. and V.E.-M.; software, F.-R.L.-E.; validation, Y.G.-C. and F.-R.L.-E.; formal analysis, F.-R.L.-E., Y.G.-C. and V.E.-M.; investigation, Y.G.-C.; resources, J.D.-Z.; data curation, Y.G.-C. and M.L.-P.; writing—original draft preparation, Y.G.-C.; writing—review and editing, Y.G.-C., F.-R.L.-E. and V.E.-M.; supervision, project administration and funding acquisition, J.D.-Z. and F.-R.L.-E. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Tecnológico Nacional de México (TecNM) and Consejo Nacional de Humanidades, Ciencias y Tecnologías (CONAHCYT) in Mexico.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the the authors upon request.

Acknowledgments

This research was supported by Tecnológico Nacional de México through the Proyectos de Investigación Científica call and by the National Council of Humanities, Science, and Technologies (CONAHCYT) under the national scholarship program. The authors are grateful for the scientific support provided by the RICCA network (Red Internacional de Control y Cómputo Aplicados). We also extend our appreciation to the anonymous reviewers for their valuable feedback, which has significantly contributed to improving the quality of this paper.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

The experiment utilized a lemniscate trajectory, mathematically described by the following equations:
x r ( t ) = Θ x sin ( Ω t ) , y r ( t ) = Θ y sin ( 2 Ω t ) .
where Θ x and Θ y represent the maximum amplitude on the respective axis, Ω = 2 π T r is the angular frequency, and T r is the period to traverse one complete cycle of the trajectory.
The linear velocity at each instant of the path, v path ( t ) , is given by:
v path ( t ) = v x ( t ) 2 + v y ( t ) 2 ,
where the velocity components v x ( t ) and v y ( t ) are:
v x ( t ) = Θ x Ω cos ( Ω t ) , v y ( t ) = 2 Θ y Ω cos ( 2 Ω t ) .
The angle of the velocity vector v path ( t ) = [ v x ( t ) , v y ( t ) ] is calculated as:
θ path ( t ) = tan 1 v y ( t ) v x ( t ) ,
and the angular velocity ω path ( t ) = d θ path ( t ) d t is derived as:
ω path ( t ) = 4 Θ x Θ y Ω 3 sin ( Ω t ) 2 sin 3 ( Ω t ) Θ x 2 cos ( 2 Ω t ) + Θ x 2 + 8 Θ y 2 cos 2 ( 2 Ω t ) .
The inverse kinematics for determining the reference velocity at each wheel are expressed as:
ω r L ( t ) = 2 v path ( t ) + w ω path ( t ) 2 r , ω r R ( t ) = 2 v path ( t ) w ω path ( t ) 2 r ,
where w is the distance between the wheels and r is the radius.
The reference coordinates and velocities in their discretized Equations (A1) and (A2) form are given by:
x r ( k ) = Θ x sin ( Ω T s k ) , y r ( k ) = Θ y sin ( 2 Ω T s k ) ,
ω r L ( k ) = 2 v path ( k ) + w ω path ( k ) 2 r , ω r R ( k ) = 2 v path ( k ) w ω path ( k ) 2 r ,
where Ω is the angular frequency, and T s is the sampling period.
The parameters used to generate the trajectory are shown in Table A1:
Table A1. Parameters used for the experimental path.
Table A1. Parameters used for the experimental path.
ParameterValue
Θ x 1000 [mm]
Θ y 500 [mm]
Ω 2 π / 60
Figure A1 illustrates the behavior of the instantaneous linear and angular velocities along the generated trajectory. In this scenario, the system encounters a trajectory with variable angular and linear velocities.
Figure A1. Instantaneous linear and angular velocity of the generated trajectory.
Figure A1. Instantaneous linear and angular velocity of the generated trajectory.
Mca 29 00083 g0a1

References

  1. Brentari, M.; Zambotti, A.; Zaccarian, L.; Bosetti, P.; Biral, F. Position and speed control of a low-cost two-wheeled, self-balancing inverted pendulum vehicle. In Proceedings of the 2015 IEEE International Conference on Mechatronics (ICM), Nagoya, Japan, 6–8 March 2015; pp. 347–352. [Google Scholar]
  2. Rahmani, R.; Mobayen, S.; Fekih, A.; Ro, J.S. Robust Passivity Cascade Technique-Based Control Using RBFN Approximators for the Stabilization of a Cart Inverted Pendulum. Mathematics 2021, 9, 1229. [Google Scholar] [CrossRef]
  3. Valencia-Palomo, G.; Hilton, K.R.; Rossiter, J.A. Predictive control implementation in a PLC using the IEC 1131.3 programming standard. In Proceedings of the 2009 European Control Conference (ECC), Budapest, Hungary, 23–26 August 2009; IEEE: Piscataway, NJ, USA, 2009; pp. 1317–1322. [Google Scholar]
  4. Valencia-Palomo, G.; Rossiter, J. Novel programmable logic controller implementation of a predictive controller based on Laguerre functions and multiparametric solutions. IET Control Theory Appl. 2012, 6, 1003–1014. [Google Scholar] [CrossRef]
  5. Diaz, D.; Kelly, R. On modeling and position tracking control of the generalized differential driven wheeled mobile robot. In Proceedings of the 2016 IEEE International Conference on Automatica, ICA-ACCA 2016, Curico, Chile, 19–21 October 2016. [Google Scholar]
  6. Chan, R.P.M.; Stol, K.A.; Halkyard, C.R. Review of modelling and control of two-wheeled robots. Annu. Rev. Control 2013, 37, 89–103. [Google Scholar] [CrossRef]
  7. Raudys, A.; Šubonienė, A. A Review of Self-balancing Robot Reinforcement Learning Algorithms. In Proceedings of theCommunications in Computer and Information Science, Curico, Chile, 19–21 October 2020; pp. 159–170. [Google Scholar]
  8. Kuntal, V.; Kumar, R.; Soni, H.; Sagarmani; Mishra, S.; Singh, S.K.; Choudhury, B. Advancements in Control Algorithms and Key Components for Self-Balancing Electric Unicycles: A Comprehensive Review. In Proceedings of the 2023 3rd International Conference on Innovative Mechanisms for Industry Applications (ICIMIA), Bengaluru, India, 21–23 December 2023; pp. 491–497. [Google Scholar]
  9. Yue, M.; Wang, S.; Sun, J.Z. Simultaneous balancing and trajectory tracking control for two-wheeled inverted pendulum vehicles: A composite control approach. Neurocomputing 2016, 191, 44–54. [Google Scholar] [CrossRef]
  10. Chiew, T.H.; Lee, Y.K.; Chang, K.M.; Ong, J.J.; Goh, Y.H. Design and Analysis of Super Twisting Sliding Mode-PID Controller for Two-wheeled Self-balancing Robot. AIP Conf. Proc. 2023, 2680, 020127. [Google Scholar]
  11. Díaz-Téllez, J.; Gutierrez-Vicente, V.; Estevez-Carreon, J.; Ramírez-Cárdenas, O.D.; García-Ramirez, R.S. Nonlinear Control of a Two-Wheeled Self-balancing Autonomous Mobile Robot. In Advances in Soft Computing, Proceedings of the 20th Mexican International Conference on Artificial Intelligence, MICAI 2021, Mexico City, Mexico, 25–30 October 2021; Springer International Publishing: Cham, Switzerland, 2021; pp. 348–359. [Google Scholar]
  12. Lower, M. Nonlinear Controller for an Inverted Pendulum Using the Trigonometric Function. Appl. Sci. 2023, 13, 12272. [Google Scholar] [CrossRef]
  13. Unluturk, A.; Aydogdu, O. Machine Learning Based Self-Balancing and Motion Control of the Underactuated Mobile Inverted Pendulum with Variable Load. IEEE Access 2022, 10, 104706–104718. [Google Scholar] [CrossRef]
  14. Nougues, S.; Guayacan, S.M.; Cuadros, D.G.; Leon-Rodriguez, H. Modelling and Design a Self-Balancing Dual-Wheeled Robot with PID Control. In Proceedings of the 2023 23rd International Conference on Control, Automation and Systems (ICCAS), Yeosu, Republic of Korea, 17–20 October 2023; pp. 489–497. [Google Scholar]
  15. Sani, M.A.A.; David, J.B.A.; Jaafar, N.H.; Yusof, M.I.; Sani, N.S.; Sadikan, S.F.N. The Development of a Self-Balancing Robot Based on Complementary Filter and Arduino. In Applied Problems Solved by Information Technology and Software; SpringerBriefs in Applied Sciences and Technology; Springer Nature: Cham, Switzerland, 2024; Part F2025; pp. 71–78. [Google Scholar]
  16. Bernal, M.; Sala, A.; Lendek, Z.; Guerra, T.M. Analysis and Synthesis of Nonlinear Control Systems; Studies in Systems, Decision and Control; Springer International Publishing: Cham, Switzerland, 2022; Volume 408. [Google Scholar]
  17. Zhong, W.; Röck, H. Energy and passivity based control of the double inverted pendulum on a cart. In Proceedings of the 2001 IEEE International Conference on Control Applications, Mexico City, Mexico, 7 September 2001; pp. 896–901. [Google Scholar]
  18. Gómez-Coronel, L.; Alvarado-Algarin, A.; Marquez-Zepeda, M.J.; Ancheyta-López, H.; López-Estrada, F.R.; Santos-Ruiz, I. Modeling and full-state feedback stabilization of a linear inverted pendulum. In Proceedings of the 24th Robotics Mexican Congress, COMRob 2022, Hidalgo, Mexico, 9–11 November 2022; pp. 42–47. [Google Scholar]
  19. Atoui, H.; Sename, O.; Milanes, V.; Martinez-Molina, J.J. Toward switching/interpolating LPV control: A review. Annu. Rev. Control 2022, 54, 49–67. [Google Scholar] [CrossRef]
  20. Das, S.; Pan, I.; Halder, K.; Das, S.; Gupta, A. LQR based improved discrete PID controller design via optimum selection of weighting matrices using fractional order integral performance index. Appl. Math. Model. 2013, 37, 4253–4268. [Google Scholar] [CrossRef]
  21. Duan, G.-R.; Yu, H.H. LMIs in Control Systems: Analysis, Design and Applications; CRC Press: Boca Raton, FL, USA, 2013; pp. 99–102. [Google Scholar]
Figure 1. Prototype of the inverted pendulum on a self-balancing differential robot.
Figure 1. Prototype of the inverted pendulum on a self-balancing differential robot.
Mca 29 00083 g001
Figure 2. Diagram of a self-balancing car with an inverted pendulum.
Figure 2. Diagram of a self-balancing car with an inverted pendulum.
Mca 29 00083 g002
Figure 3. Transient response for initial conditions at θ 1 = 0.15 rad , θ 2 = 0.15 rad , θ 3 = π 4 rad different from zero.
Figure 3. Transient response for initial conditions at θ 1 = 0.15 rad , θ 2 = 0.15 rad , θ 3 = π 4 rad different from zero.
Mca 29 00083 g003
Figure 4. Overall system diagram. Symbols τ and u represent the torque and voltage applied to each DC motor.
Figure 4. Overall system diagram. Symbols τ and u represent the torque and voltage applied to each DC motor.
Mca 29 00083 g004
Figure 5. Experimental trajectory tracking.
Figure 5. Experimental trajectory tracking.
Mca 29 00083 g005
Figure 6. Transient behavior of the angles θ 1 and θ 2 .
Figure 6. Transient behavior of the angles θ 1 and θ 2 .
Mca 29 00083 g006
Figure 7. Transient behavior of the trajectory tracking error in the x and y axes.
Figure 7. Transient behavior of the trajectory tracking error in the x and y axes.
Mca 29 00083 g007
Table 1. Relationship of parameters for the self-balancing cart model with an inverted pendulum.
Table 1. Relationship of parameters for the self-balancing cart model with an inverted pendulum.
ParameterUnitsDescription
m 1 [Kg]Mass of the cart
m 2 [Kg]Mass of the pendulum
m w [Kg]Mass of the wheels
θ L [rad]Angle of the left wheel
θ R [rad]Angle of the right wheel
θ 1 [rad]Angle of the cart
θ 2 [rad]Angle of the pendulum
θ 3 [rad]Angle of the cart position in space
l 1 [m]Distance to the center of mass in the cart
l 2 [m]Distance to the center of mass of the pendulum
L 1 [m]Distance between axle and pendulum
L 2 [m]Distance of the pendulum
w[m]Separation between wheels
r[m]Radius of the wheels
I w [kg·m2]Moment of inertia of the wheels
I 1 [kg·m2]Moment of inertia of the cart
I 2 [kg·m2]Moment of inertia of the pendulum
g[m/s2]Gravitational acceleration constant
P[m]Distance of the displaced point
Table 2. Parameters of the prototype.
Table 2. Parameters of the prototype.
ParameterValue
g9.8
m 1 0.9
m 2 0.1
r0.0335
L 1 0.126
L 2 0.390
l 1 L 1 / 2
l 2 L 2 / 2
I 1 1 12 m 1 L 1 2
I 2 1 12 m 2 L 2 2
w0.178
P0.001
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

González-Cárdenas, Y.; López-Estrada, F.-R.; Estrada-Manzo, V.; Dominguez-Zenteno, J.; López-Pérez, M. Design and Implementation of a Discrete-PDC Controller for Stabilization of an Inverted Pendulum on a Self-Balancing Car Using a Convex Approach. Math. Comput. Appl. 2024, 29, 83. https://doi.org/10.3390/mca29050083

AMA Style

González-Cárdenas Y, López-Estrada F-R, Estrada-Manzo V, Dominguez-Zenteno J, López-Pérez M. Design and Implementation of a Discrete-PDC Controller for Stabilization of an Inverted Pendulum on a Self-Balancing Car Using a Convex Approach. Mathematical and Computational Applications. 2024; 29(5):83. https://doi.org/10.3390/mca29050083

Chicago/Turabian Style

González-Cárdenas, Yasmani, Francisco-Ronay López-Estrada, Víctor Estrada-Manzo, Joaquin Dominguez-Zenteno, and Manuel López-Pérez. 2024. "Design and Implementation of a Discrete-PDC Controller for Stabilization of an Inverted Pendulum on a Self-Balancing Car Using a Convex Approach" Mathematical and Computational Applications 29, no. 5: 83. https://doi.org/10.3390/mca29050083

Article Metrics

Back to TopTop