Abstract

Control of mechanical systems by electronic systems controlled by computer programs is one of the most active research areas in mechatronic systems engineering. These programs carry out control laws, which are algorithms. This study focuses on Segway control (a two-wheeled inverted pendulum which is a highly nonlinear and unstable open-loop system). Our research entails creating a control law to stabilize this system. We proposed using a state feedback controller, which provided us with a stable system and a lower error margin; however, to correct this error, we used a combination of the state feedback controller and the fuzzy-PID controller. The effectiveness of the proposed method is demonstrated using simulation results.

1. Introduction

The control of the wheel inverted pendulum (WIP) robot has gained popularity in both industry and research communities. WIP-based products, such as the Segway human transporter, have recently become available in the market. However, due to the inherent instability and significant nonlinearity of the inverted pendulum system, precise control is crucial for its successful operation. In this study, we aim to contribute to the existing body of research by proposing a novel control approach to stabilize the WIP system.

We begin by demonstrating computationally that the open-loop control is unstable. The system’s controllability and observability will also be investigated. To overcome the challenges of controlling a highly nonlinear system, we propose the use of state feedback control, which can provide high accuracy and flexible dynamic response. Furthermore, we will augment the state feedback control with a fuzzy-PID integrator to enhance stabilization.

1.1. State of the Art

The study of inverted pendulum systems is an area of automation research that has experienced significant growth in recent years. This is owing to their optimum instability, which makes them difficult to regulate, as well as their diverse forms and dimensions. The simple pendulum, the double pendulum, and the Furuta pendulum can be mentioned. Diverse control strategies have been proposed to stabilize these systems, with a focus on linear systems such as proportional-integral-derivative (PID) controllers [1, 2] and linear-quadratic-regulators (LQR) [3], which are simple to design and evaluate in terms of stability but require a linearized model of the system to function effectively. To overcome these difficulties, other techniques, such as sliding mode control [4, 5] and adaptive control [6] based on the backstepping approach [79], have been developed to overcome the limitations of these linear systems. PDC control [10] and dynamic surface control [11], which employ neural networks [1214] and fuzzy logic [1518], have also been suggested to enhance the performance of nonlinear systems.

In a recent study, the authors in [19] presented a state feedback control law for an inverted pendulum system, which demonstrated good stabilization performance in simulation. The authors in [20] proposed a fuzzy-PID controller for a wheeled inverted pendulum, which achieved improved control accuracy and robustness compared to traditional PID controllers. Furthermore, the authors in [21] utilized a hybrid control scheme combining sliding mode control and LQR to stabilize an underactuated pendulum system.

Despite the progress made in the field of inverted pendulum control, there is still a need for novel control techniques that can provide improved stability and robustness for more complex and underactuated systems.

1.2. Problem

In this study, we propose a novel control approach to stabilize a nonlinear and underactuated inverted pendulum system. The system is highly sensitive to delays, friction, and external disturbances and has unstable open-loop dynamics. To address these challenges, we combine a state feedback control law with a fuzzy-PID integrator. Our contribution is to demonstrate the effectiveness of this technique in achieving stable control of the system. Compared to traditional control strategies, our approach offers high accuracy and a fast and flexible dynamic response.

2. Description and Modelling of the Inverted Pendulum

The inverted pendulum is a test platform that poses an instability problem at the angle θ = 0; therefore, a modelling phase is necessary to allow the study in simulation. For this purpose, different methods can be found in the literature, such as the one based on Newtonian physics or the one based on the Lagrange–Euler formalism. In this work, we have chosen the Lagrange–Euler method which constitutes a systematic approach whose implementation is simple.

2.1. Modelling of a Segway

A Segway can be modelled by a wheeled inverted pendulum. This underactuated mechanical system has been particularly studied because, despite its simplicity, it indicates a practical interest for locomotion, as proved by the commercialization of the Segway, a compact personal vehicle based on the model of the wheeled inverted pendulum. The wheeled inverted pendulum is schematically shown in Figure 1 [22].

The parameters of our system are presented in Table 1.

2.1.1. The Dynamic Model

The dynamic model gives the nonlinear equations of the system’s motion. To solve these equations, we linearize them around the equilibrium position. In this position, the system is in its quasiequilibrium state. So, we could develop the linearized model under the assumption that the variation of the inclination angle is small enough to be neglected. We then have three linearized equations of motion at the state of equilibrium as follows:

Once the system is linearized, we have reorganized it into the following state space:where the vectors x and u are given by the following equation:

The matrices A and B can be identified as follows:

The matrix C is defined as an identity matrix (6, 6) and the matrix D as a null matrix, which then gives Y = X.

After validating the developed model, we will present open-loop simulations.

2.2. Response of the Inverted Wheel Pendulum

To study the system’s stability, we will determine the impulse response of the system in the open-loop using MATLAB. This is the reference tool for numerical simulation. It offers advanced possibilities for identification or control. More generally, it can be used to solve a wide variety of simulation problems.

Simulations are carried out in an environment MATLAB/Simulink. The differential equations governing the dynamics of the system are integrated using the method Runge–Kutta (function ode45 of MATLAB).

Figure 2 shows the Simulink diagram.

Applied to the input an amplitude, we will obtain the following results.

Figures (Figures 35) show that the system’s kinematic parameters (x and , θ and , and φ and ) grow with time, indicating its instability. In this case, a control law is required to make the system stable.

2.3. Instability of the System

According to the study, the open-loop system is unstable because one of its poles is located in the right half plane of the complex plane.

To stabilize the system, state feedback control will be used using the control gain matrix K. Before that, we need to show that the system is controllable and observable.

3. The Notions of Controllability and Observability

Observability and controllability are among the fundamental and essential notions in control theory. They have been introduced by Kalman during the 1960s in the context of finite system dimensions.

The concepts of controllability and observability play an essential part in the study of control and filtering problems. The concept of controllability studies the possibility of adjusting the behavior of the system under consideration in order to force the state to take the desired values during a finite time. On the other hand, the observability of a system can be defined as the possibility of predicting the state of the system at any time within the operating time interval.

3.1. The Controllability

The system is controllable if any two distinct points in the state space can be joined; in other words, let there be two points x0, x1 ∈ X; there exists two instants t0 and t1 with t0 < t1 and a control u, defined on the interval [t0, t1], such that x (ti) = x, i = 0,1. We study the controllability of the linear system with dimension n defined in the state space by the system of equations of the following form:where x ∈ Rn×1 the state vector, A ∈ Rn×n the state matrix, B ∈ Rn×m the control matrix, u ∈ Rm×1 control vector, y ∈ Rp×1 the output vector, and C ∈ Rp×n the output matrix, p represents the number of outputs, and D ∈ Rp×n is the direct transmission matrix. The matrices A and B are time-independent matrices. In such a case, the dynamics of the system is said to be time-invariant (or stationary).

It can be shown that a system is controllable only if its controllability matrix C has full rank (i.e., rank (C) = n, where n is the number of variable states).

Since 6 = 6 in our system, then the system is said to be controllable.

3.2. The Observability

In a nutshell, observability is a property from which the state of the system under consideration can be determined exactly or approximately. By duality with the concept of controllability, the linear invariant system is observable only if the following condition is met:

The rank  = n, is the observability matrix, obtained by putting n matrices 1, , …, n C CA CA (n − 1) below each other.

For LTI (linear time-invariant) systems, the system is observable if and only if the observability matrix Γobs, has full rank (i.e., rang (Γobs) = n, where n is the number of variable states).

As far as our system is concerned, we can conclude that it is observable.

Using the MATLAB software, we will make a dynamic analysis of the discretized linear model. Then, we will study the features of this model as a function of the chosen discretization step k, and thus, of the dimension 2 (N + 1) of the system. This study focuses on the application of state feedback control theoretically through simulation using Simulink modelling software; the results will then be presented and their interpretation.

4. Feedback Control and Choice of K-Matrix

Feedback control modifies the self-dynamics (poles) of the closed-loop system to increase stability, accuracy, and speed, while maintaining a small or zero steady-state error. The method consists of generating a control signal u from the states x1, x2…xn.

Figure 6 provides a visual representation of the relationship between the system’s states and the feedback control mechanism.

The idea is always to drive the system with a setpoint signal and to automatically generate the control signal by comparing the setpoint value and the actual behavior of the system in performance.

The control law that meets the above objective is called pole placement control.

4.1. Pole Placement

Pole placement consists of determining the value of a controller’s gain according to the desired position in the complex plane of certain BF poles chosen by the designer. Let be a state feedback controller; we definite the following system of equations:where K is a matrix called the state feedback gain and is a new input to the closed-loop system.

The closed-loop system is therefore written as follows:

The calculation of the K-matrix was carried out through a random pole change at the beginning; each time the values are changed and the curve plotted until a control point is reached:

We then modified lines 3 and 4 of our MATLAB calculation and obtained the results shown in Figure 7.

Applied to the input an amplitude, we will obtain the following results.

As shown in Figure 8, the application of the state feedback control to the system shows that the pendulum returns to the vertical position ˙φ (zero deflection) about 1.3 seconds. It can be seen that the response is smooth and no longer aggressive.

5. Various Commands Available for Stabilisation

The control of the two-wheel inverted pendulum has been realized based on different laws such as the following points:(1)The extended PDC (parallel distributed compensation) control gives simulation results illustrated in Figure 9 [10](2)Control through adaptive backstepping [8]

6. Discussion of the Results Obtained and Application of the PID-Fuzzy Combination

6.1. Discussion of the Results Obtained

The application of the extended PDC (parallel distributed compensation) control to the system, as shown in Figure 9, demonstrates that the Segway returns to its equilibrium position after a certain response time (about 7.3 seconds) and with some overshoot.

Figure 10 depicts the adaptive backstepping control for the system, which shows that the Segway returns to its equilibrium position after a certain response time (about 6.2 sec) and with some overshoot.

The comparison of the applied commands (Figure 11) shows that the state feedback command performs better than the extended PDC (parallel distributed compensation) command and the adaptive backstepping command.

Our method has a significant advantage over existing ones in the literature (extended PDC control, adaptive backstepping, and so on) in that it has a much lower error margin, a faster response time (about 1.3 seconds), is generally smooth, and has a slight overshoot.

To improve the performance and stability of a Segway, we will present another proposed control based on a fuzzy-PID control loop in conjunction with a pole placement controller in the following step.

6.2. A Fuzzy-PID Controller Modifies Feedback Control

The state feedback control modifies the closed-loop system’s poles. However, the latter does not guarantee a zero position error. A fuzzy-PID integrator is one option. The PID uses feedback (from sensors that measure the orientation and movement of the Segway) to continuously adjust the output of a system (motor). While the fuzzy logic controller will be used to process the input variables (the orientation and motion of the Segway) and apply fuzzy rules to calculate the output variables, which will then be used to adjust the motors to achieve the desired Segway behavior. The control law is written as follows:where K’ ∈Rn and Ki a scalar. The deviation ε defined by ε = y′ − y, u is the control signal.

The vectors K’ and Ki can be chosen by a pole placement method. We specified one more pole (n + 1) to take into account the presence of the integrator. We consider that y′ is a step, then y′ = 0 for about each instant of time and that the step perturbation implies:  = 0.

Hence, the position error is zero.

After applying the Laplace transformer, the PI controller is given by the following transfer function C(s) = K’ +  + .

In order to implement a fuzzy logic controller, we define a set of fuzzy rules that describe how the system should respond to various inputs.

For example, if the Segway leans left and moves forward, a fuzzy rule might specify that the left motor should be set to increase speed and the right motor should be set to decrease speed to correct the lean an maintain balance.

The optimal gains Kp, Ki, and Kd for a PID controller were determined by several simulation tests are mentioned in Table 2.

6.2.1. Fuzzy Ensemble

Fuzzy ensemble in fuzzy logic, a subset A of B is defined by a membership function u A (x) which can take different values between 0 and 1 depending on the degree of membership of the element x to the subset A

6.2.2. Variables and Linguistic Values

A linguistic variable represents a regulated state in the system or a setting variable in a fuzzy controller. In Figure 12, each value represents a fuzzy set of the universe of discourse:(i)Discourse universe: temperature from −10 to 14°C.(ii)Linguistic variables: temperature.(iii)Linguistic values: “cold” “hot.”(iv)Membership function: We already know that fuzzy logic is not a logic that is fuzzy but a logic that is used to describe fuzziness. This fuzziness is best characterized by its membership function.

In other words, we can say that the membership function represents the degree of truth in fuzzy logic. The membership functions are represented by graphical forms as follows in Figure 13.

6.2.3. A Fuzzy Controller’s Structure

The most common application of fuzzy logic is the fuzzy controller. The following diagram (Figure 14) depicts the general structure of a fuzzy controller.

The fuzzy controller is made up of four major components.

A fuzzy logic system includes a fuzzification block (used to convert nonfuzzy numerical variables from inputs into fuzzy linguistic variables), a rule base, an inference mechanism (used to simulate human decisions using fuzzy variables transformed by fuzzification and inference rules to create and determine fuzzy output variables), and a defuzzification block. Using the Sugeno–Takagi approach, we developed the fuzzy logic controller. Angle, angular velocity, location, and speed are the input values of the controller, which are linguistic variables. All linguistic variable values have been categorized as negative (N) or positive (P). Using the set point and the measured output, the PID controller was developed by computing the deviation between the set point and the feedback. The error is then utilized to compute the three components of the PID controller (proportional, integral, and derivative), which are then combined to provide the control output. A fuzzy inference system is utilized to create a fuzzy logic controller employing input variables and fuzzy rules to determine output variables. Using the outputs of the PID controller and the fuzzy controller, the motors are finally tweaked to obtain the required Segway behavior.

The fuzzy membership functions for the inputs and outputs are shown in Figure 15.

Figure 16 illustrates the control surface of the fuzzy control.

The Simulink state feedback control diagram as modified by the PID-fuzzy controller is shown in Figure 17.

Here, KpKiKd the controller gains used to calculate the output of the PID controller as a function of the error between the target value and the measured value. The integral of the error and the derivative of the error are also considered in the output calculation.

7. Results and Interpretation

The pole placement controller was used to calculate the optimal actions to take based on the current system state and desired poles, and then the fuzzy-PID algorithm was used to adjust these actions based on the current error and system response.

Figure 18 shows the fuzzy-PID-modified state feedback compared to the previous controllers.

This study has allowed through the simulation results found, to notice a great improvement of the rapidity with the intelligent control fuzzy-PID. Conversely, the system achieves the desired stability without overshooting. The BP neural network’s robust nonlinear mapping capabilities can enhance the controller’s flexibility. Table 3 shows the system’s transient response characteristics are as follows.

In order to evaluate the ability of the proposed controller to compensate for external disturbances and thus test its robustness, we perturbed the pendulum to observe the behavior of the controller under these conditions. A disturbance was applied to the system for four seconds, (from 18 to 22) seconds after the start of the simulation. The results of this evaluation are presented in Figure 19.

The figure shows the system response after the application of an external disturbance. It can be observed that the proposed method maintains a stable and precise response despite these disturbances, with a limited increase in oscillation amplitude. Unlike other controllers, the proposed method has a smoother profile, ascending and descending with a smaller amplitude, suggesting a faster and more precise response, as well as a better ability to adapt effectively to external disturbances.

These results confirm the significant improvement of the proposed method in terms of robustness, which is an essential feature for many control applications in perturbed environments. The ability of the proposed method to maintain a stable and precise response in the presence of external disturbances suggests that it could be successfully used in real-world applications. In conclusion, our proposed method has significant advantages over other tested controllers, and its robustness is an important advantage for many control applications.

8. Conclusion

This research has enabled us to admit that extended PDC (parallel distributed compensation) and adaptive backstepping control can produce some results, but they are still unsatisfactory in terms of stability and speed. Furthermore, the state feedback control is much better and results in a stable system with a reduced error margin and a slight overshoot; however, to improve the performance and robustness of this system, we implemented a fuzzy PID integrator, which corrected the error problem.

Finally, we can conclude that the intelligent controller implementation is more complex than the classical controller because of the right combination of controller “fuzzy PID,” the form and intervals of the membership functions, and the controller rules. Nonetheless, intelligent control produces significantly better results in terms of system stability, speed, and robustness in the face of external disruption.

It should be noted that the desired poles and the calibration of the fuzzy-PID controller parameters can have a significant impact on system performance and stability. These parameters may need to be updated in response to changing system conditions and requirements.

Other more complex mathematical models of the Segway can be tested in the future.

Data Availability

The datasets used to support the results of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.