Abstract

A two-wheeled self-balancing robot with a fuzzy PD control method is described and analyzed as an example of a high-order, multiple-variable, nonlinear, strong-coupling, and unstable system. Based on a system structure model, a kinetic equation is constructed using Newtonian dynamics and mechanics. After a number of simulation experiments, we get the best , , and state-feedback matrices. Then a fuzzy PD controller is designed for which the position and speed of the robot are inputs and for which the angle and angle rate of the robot are controlled by a PD controller. Finally, this paper describes a real-time control platform for the two-wheeled self-balancing robot that controls the robot effectively, after some parameter debugging. The result indicates that the fuzzy PD control algorithm can successfully achieve self-balanced control of the two-wheeled robot and prevent the robot from falling.

1. Introduction

Existing research on fuzzy reasoning can be roughly divided into three overlapping categories [1]: fuzzy reasoning methods and their analysis, logical foundations of fuzzy reasoning, and applications of fuzzy reasoning. Various fuzzy methods have been proposed based mainly on three different ideas. The first idea, composition, leads to the Zadeh compositional rule of inference (CRI) method [2, 3] and its variants [46]. The second idea is that of analogy and similarity. The third idea, interpolation analysis of fuzzy reasoning methods, is concerned with various properties of interest, such as interpretability of fuzzy rules, consistency of new fuzzy consequences with existing fuzzy premises, and continuity of fuzzy consequences with respect to fuzzy premises and fuzzy relations [7]. Numerous different implication operators and connectives can be adopted in fuzzy reasoning methods, including an important class of methods concerned with the suitability of particular fuzzy reasoning methods for domain-specific applications [8]. The logical foundation of fuzzy reasoning is concerned with formal systems in which various fuzzy reasoning methods can be interpreted. Several formal systems of this kind have been proposed, including basic logic, monoidal t-norm-based logic, the quasiformal deductive system of Wang [9], and possibilistic logic [10]. These formal systems are mainly generalizations of classical propositional logic and multivalued logic. On the other hand, applications of fuzzy reasoning methods are extensive and can be found in disparate areas such as complex systems modeling and control [11], pattern recognition, decision-making [12], and safety monitoring.

In recent decades, motion control of robot manipulators has received a lot of attention [13]. Motion control is needed to make each joint track a desired trajectory as closely as possible. Many control algorithms, such as the computer torque method [14], optimal control [15], adaptive control [16], variable structure control (VSC) [17], neural networks (NNs), and fuzzy systems [18], have been proposed to deal with this robotic control problem. In [19, 20], a computer torque control is developed on the basis of feedback linearization. However, these designs are possible only when the robotic dynamics are well known.

A fuzzy logic controller (FLC) makes control decisions using well-known fuzzy IF-THEN rules. FLCs can be classified into two major categories: the Mamdani-type FLC, which uses fuzzy numbers to make decisions [21], and the Takagi-Sugeno (TS)-type FLC, which generates control actions using linear functions of the input variables. In the early years, most FLCs were designed by trial and error. Since the complexity of an FLC will increase exponentially when it is used to control complex systems, it is tedious to design and tune FLCs manually for most industrial problems such as robotic systems. This is why conventional nonlinear design methods [22] such as fuzzy sliding control, fuzzy gain scheduling [8], and adaptive fuzzy control [17] were adopted in the fuzzy control field to alleviate difficulties in constructing the fuzzy rule base.

Analytical calculations show that a two-input FLC employing a proportional error signal and a velocity error signal is a nonlinear proportional-integral (PI) or proportional-derivative (PD) controller. Due to the popularity of PID controllers in industrial applications, most of the development of fuzzy controllers in the past decade has revolved around fuzzy PID controllers [13]. PI- and PD-type fuzzy controllers have gained prominence for almost two decades now because of their simple structure, ease of implementation, and inherent robustness [22]. Another possible implementation of a PID-type FC requires the development of a popular PD-type fuzzy controller in parallel with a conventional integral (I) controller. Presently, research interest in this field is focused on the development of adaptation policies that can adapt these component fuzzy controllers in a suitable and simple fashion and can further achieve a reasonably accurate and satisfactory performance. An excellent example of applying self-organized fuzzy systems to autotune the gains of a classic PID controller online and its successful application in controlling a MIMO robot arm can be found in [23].

A two-wheeled self-balancing robot [24] system is characterized as being multiple-variable, high-order, nonlinear, strong-coupling, and unstable, so it is considered a standard research target by many modern control theory researchers [25], and many abstract control concepts such as system stability, robustness, controllability, and system anti-interference properties can be displayed via two-wheeled self-balancing robot system experiments. Recently, a two-wheeled self-balancing robot, namely, Segway [26], has been widely recognized as a powerful personal transportation vehicle. It is constructed from very sophisticated and high-quality dedicated components, such as a brushless servomotor with neodymium magnets, a precision gearbox, nickel metal hydride batteries, silica-based wheels, a digital signal processor as the main controller, motor drivers, six gyroscopes, and several safety accessories. In contrast to this kind of high-cost human transporter, many researchers have presented low-tech self-balancing transporters and claimed that such a vehicle can be built using off-the-shelf inexpensive components. Because of its simple structure, stable operation, high energy efficiency, and environmental adaptability, it has very broad application prospects in both military and civilian areas.

In this paper, the utility and effectiveness of soft computing approaches for a two-wheeled self-balancing robot with structured and unstructured uncertainties is presented. In this approach, precompensation of a hybrid fuzzy PD controller is proposed. The control scheme consists of a fuzzy logic-based precompensator followed by fuzzy PD control. Moreover, a fuzzy supervisory controller is used to supervise conventional proportional and derivative actions such that the conventional gains are adapted online through fuzzy reasoning.

We study the GBOT1001 two-wheeled self-balancing robot produced by Googol Technology (Shenzhen) Limited, and we establish the mathematical model of this system, use fuzzy PD control theory to control the robot, and, at the same time, achieve effective control.

2. System Description

2.1. Structural Analysis of the Robot System

We can develop a linear model with the following assumptions [27].(1)The robot is a rigid body and does not distort during moving.(2)The left- and right-hand wheels are completely analogous.(3)Cornering forces are considered negligible.(4)Friction is neglected during the analysis.(5)Since the time constant of electric motors is small compared to the system’s time constants, the motor dynamics have been neglected in the model.

The design of the two-wheeled self-balancing robot is based on a mobile single inverted pendulum. The robot is composed of a chassis carrying a DC motor coupled to a planetary gearbox for each wheel, the DSP board used to implement the controller, the power amplifiers for the motors, the necessary sensors to measure the robot’s states, and the receiver for the radiocontrol unit, as well as a vertical bar. The wheels of the vehicle are directly coupled to the output shaft of the gearboxes. A GE laser (scanner) motion controller is the core of the embedded DSP board. This is composed of a floating-point DSP from Analog Devices, an FPGA, three 10-bit D/A converters, and four 12-bit A/D converters.

2.2. Dynamics Model of the System

Figure 1 [27] shows the chassis diagram of the robot. The linear movement of the chassis is characterized by the position and the speed ; it is also able to rotate around the axis (pitch), a movement described by the angle , and the corresponding angular velocity . In addition, the vehicle can rotate around its vertical axis (yaw) with the associated angle and angular velocity . is the mass of rotating masses connected to the left and right wheels, is the mass of the chassis, is the radius of the wheel, is the distance between the-axis and the center of gravity of the chassis, is the lateral distance between the contact patches of the wheels, is the shift position of the wheel with respect to the -axis, and is the shift position of the chassis with respect to the -axis.

For the left-hand wheel,

For the right-hand wheel,

For the chassis,

For a premise, where represent reaction forces between the different free bodies [27]. Modifying the above equations and then linearizing the result around the operating point (, so ), the system’s state-space equations can be written in matrix form as:

In order to derive a simpler mathematical model, we need a decoupling unit (2.7) that transforms and into the wheel torques and as follows:

Some parameters of the GBOT1001 robot are as follows:

Then the state-space equations for the vehicle can be written as two different systems [28]: one system is the model (2.9) of an inverted pendulum, which describes the rotation about the -axis, and the other is the model (2.10) of rotation, which describes the rotation about the -axis. Thus, we obtain

3. Controller Design

3.1. Parameters of the Fuzzy PD Controller

First, we examine the controllability of the open-loop system. After some calculations, we know that the system is controllable and the state feedback matrices can be obtained using the LQR method. After a number of simulation experiments, we choose the matrices

Then, we use the MATLAB function to solve the optimality problem. Running in MATLAB, we can get the state feedback matrix:

Thus, the proportion parameter is 26.5230, and the differential parameter is 4.1971.

3.2. Fuzzy PD Control Method
3.2.1. Fuzzy PD Controller Design

A fuzzy logic controller is a controller that utilizes fuzzy logic to determine a course of action. The computation of the control action is composed of four steps [28]: input scaling and shifting, fuzzification, fuzzy inference, and defuzzification. In the input scaling and shifting step, crisp inputs can be processed and scaled appropriately. In the fuzzification step, the crisp inputs are then converted into fuzzy values. After fuzzy inference, a proper control action is determined by searching through a previously established rule table. Finally, the deterministic output is defined in the defuzzification step.

In this section, a fuzzy PD controller is applied to the dynamic model of the two-wheeled self-balancing robot. Two inputs, position error and change of error , are fed to the fuzzy controller, while integral error is used as a conventional integral action [29]. The inputs of the fuzzy controller are the position and speed of the robot, while the angle and angle rate of the robot are controlled by the PD controller. Figure 2 shows the structure of the fuzzy PD controller.

The input and output membership functions are denoted as NB, NM, NS, ZE, PS, PM, and PB. The fuzzy membership functions for inputs and output are shown in Figures 3 and 4. The control surface of the output is shown in Figure 5. Table 1 lists the fuzzy control rules.

3.2.2. Simulation Result

The control system includes a Simulink model of the feedback system [29]. The block diagram, as shown in Figure 6, consists of the subsystem 1 block with system matrices as defined in the script file. The position state is compared to a reference signal and then multiplied by its feedback gain, while the other states are simply multiplied by their respective gains, and all of these are fed back into the subsystem 1 block, which is the Simulink model of the robot, as shown in Figure 7.

When a disturbance is input to the system, the response curves become as shown in Figures 8 and 9.

As shown in Figure 8, when the disturbance of the angle is given asrad, the system is successfully stabilized as required, with good dynamic performance. The robot’s position, speed, angle, and angle rate return to the origin point after no more than 5 s. The system is stable throughout with good dynamic performance and robustness, showing that the fuzzy PD control method is effective. Figure 9 is the graph of the output motor torque; we can see that at time 0 the motor torque is very high, almost N·m. 5 s later, it reduces to N·m.

4. Real-Time Control System

We use the fuzzy PD controller to replace the real-time control platform designed by Googol Technology Limited, so we can get the self-balancing robot’s real-time control system platform, as shown in Figure 10. Compared with the simulation model, the real-time control system has a corner controller that is used to control the robot to turn around. After some parameter debugging, the robot is controlled effectively. Figure 11 is the robot’s real-time curve; Figure 12 is its stable control photo.

From Figure 11, we can see that the robot’s angle is very large at the beginning, about rad, so the motor output torque is very high, that is, about N·m with 1.7 m/s initial angle rate. 0.5 s later, the robot basically comes to a dynamic balance, which is 4 s faster than in the simulation. Since the ground is not flat, and there are various outside interferences, the robot does not move smoothly, and so there will be a little convulsion. After 5 s, an interference is given to the robot; from the figure we can see that the motor output torque and the angle rate increase rapidly. 0.7 s later, they all enter a stable state.

5. Conclusion

In this paper, based on the structure model of a two-wheeled self-balancing robot, a systematic mathematical model is devised according to dynamic mechanics theory. After a number of simulation experiments, we get the best , and state-feedback matrices. Based on traditional PD control theory and fuzzy logic control theory, a fuzzy PD controller is designed, which coordinates effectively the robust stability and speediness of the system.

Finally, a real-time control platform for the two-wheeled self-balancing robot is designed; after some parameter debugging, the robot is controlled effectively. The result indicates that the fuzzy PD control algorithm can achieve self-balanced control of the two-wheeled robot successfully and prevent the robot from falling in order to satisfy the robot’s anticipated control goals and obtain a good dynamic performance.