You are on page 1of 8

2018 International Conference on Computer, Communication and Network Technology (CCNT 2018)

ISBN: 978-1-60595-561-2

Fuzzy PID Control for a Cubic Robot Balancing on Its Corner

Xiao-gang RUAN1,2,*, Yuan LI1,2 and Zhi-gang CHEN1,2


1
Faculty of Information Technology, Beijing University of Technology, Beijing, China
2
Beijing Key Laboratory of Computational Intelligence and Intelligent System, Beijing, China
*Corresponding author

Keywords: Cubic robot, Lagrangian method, Simulink, Fuzzy PID control.

Abstract. In this paper, a cubic self-balancing robot is designed. Taking a prototype of a cubic robot
that has been designed as a specific research object. For the attitude control of this institution. Using
Lagrangian Method to establish a mathematical model of cubic robot. For its attitude control method.
Fuzzy PID control method was proposed. Establishing simulation models in Matlab/Simulink
environment. The simulation experiments using conventional PID control and fuzzy PID control were
performed for comparison. The results show that the adoption of fuzzy PID control has faster
response speed and smaller overshoot than traditional PID control and has better control effect.

Introduction
The cubic self-balancing robot is shown in Figure 1. Its mechanical structure is: The shape is a cube
shape, and three reaction wheels are mounted on three surfaces that are orthogonal to each other. Each
reaction wheel is controlled by a brushless DC motor to control the rotation speed. The attitude angle
of the cube is sent to the STM32 master chip through the sensor. The STM32 controls the rotation
speed of the motor according to the attitude angle of the cube and acts on the rotation of the reaction
wheels. The forward or reverse driving torque of the entire mechanism, thus realizing the balance of
the mechanism with the edge as the fulcrum or the angle as the fulcrum[6,7], is a typical non-linear,
unstable multi-freedom spatial inverted pendulum system.
The fuzzy PID control method occupies a very important position in the modern control theory .Its
biggest advantage is that it does not need to know the exact mathematical model of the controlled
object, but also can adopt fuzzy control technology, and can make the control system have very good
robustness. Therefore, based on the different characteristics of PID control and fuzzy control, the
design of fuzzy PID controller will help to further improve the performance of the synchronous
control system[2].
Aiming at the self-balanced control problem of cubic robot with its corner point as the fulcrum, this
paper takes the designed cubic robot prototype as the specific research object. Firstly, the dynamic
model of the cubic robot is established by the Lagrangian method and gives a specific kinetic
equation. The inertial wheel reaction torque characteristics based on cubic robot. The fuzzy PID
controller and the conventional PID controller were designed based on the inertia torque wheel's
reaction torque characteristics of the cubic robot. The simulation experiment was performed and the
relevant conclusions of the research were given.

Structural Design and Dynamics Modeling

Mechanical Design

The cubic robot designed in this paper is shown in Figure 1. Specifically, it consists of a cuboidal box
and reaction wheels arranged on three sides of the box orthogonally[1]. The reaction wheel rotates to
produce positive or negative action on the box. The drive torque to control the attitude of the cubic
robot. So that the cubic robot balances at the corners.

180
Figure 1. Cubic robot prototype. Figure 2. Coordinates system definition of cubic robot.

Dynamics Modeling
The cubic robot consists of four rigid bodies. The cube and reaction wheel are mounted on three sides
of the cube that are orthogonal to each other. The definition of the coordinate system of a
three-dimensional robot is shown in Figure 2.
Where o-xyz denotes the inertial reference frame fixed in space, o-x b yb zb the body frame whose
origin is located at corner of the cube, c-x f y f z f the reaction wheels coordinate frame that attaches at
the center of the cube, and whose axes coincide with the rotation axis of reaction wheels[1].
Defining by α , β and γ the deflection angle from body coordinate frame to space coordinate frame
in axes respectively; by θA , θB and θC the angle velocities of reaction wheels respectively[3]. The
main model parameters of the cubic robot prototype are listed in table 1.
Table 1. Main model parameters of the cubic robot.

Symbol Value Symbol Value

m 1.4[kg] Iw 0.00155 [kg·m2]


l 0.135[m] Kt 0.0251 [N·m/A]
2
Ix 0.0347 [kg·m ] Rm 0.464[Ω]

Iy 0.0347 [kg·m2 ] g 9.81 [m/s2]

Iz 0.0116 [kg·m2 ] - -

m: Total mass of the cubic robot. l: The distance from the centroid point c of the cubic robot to the
corner point o. Ix, Iy, Iz: The total moment of inertia of the system near the corner point in the body's
fixed coordinate system. Iw: Inertia moment of the reaction wheel around the rotation axis in reaction
wheels coordinate frame. Kt: Moment constant of motor. Kb: Back electromotive force constant of
motor. Rm: Armature resistance of motor. g: Gravitational acceleration
Deducing the dynamic model of a cubic robot using the Lagrangian modeling method requires that
the kinetic energy and potential energy of the rigid body be expressed as a function of the generalized
coordinates[3]. The Lagrangian is defined by

L = T −V (1)

181
where T, V denote the kinetic and potential energies. The kinetic energy of the system is composed
of translational kinetic energy of the cube and rotational kinetic energy of wheels. The kinetic energy
can be written as

I yα 2 + I x β 2 + I zγ 2 +I w (θA 2 + θB 2 + θC 2 )


T=
2 . (2)
When the cubic robot standing up on its corner, the vertical motion depends on both the angle α
and β . Thus, the potential energy of the system is

V = mgl cos α cos β . (3)


The strategy of the cubic robot for rest position to corner balance position is that, the cubic robot
turn 45 degree around the edge from the rest position, then turn about 35.3 degree around the body
coordinate frame[4]. Consequently, the rotation matrix Tbf from body coordinate frame o-x b ybzb to
reaction wheels coordinate frame c-x f y f z f is denoted as

Tbf = Ry (−35.3°) ⋅ Rx (45°)


(4)
Thus, the reaction torques on the cube along the axes of body coordinate frame are denoted by τ α ,
τ β and τ γ [6], that is

τ α  θA 
   
τ β  = − I w ⋅ Tbf ⋅ θB 
τ γ  θC 
, (5)
The rotation torques impacted on the reaction wheels are denoted by τθ , τ θ and τθ , that is
A B C

τ θ  τ A  α 
   
A

T   
τ θ B
 = τ B  − I w ⋅ Tbf ⋅  β 
τ  τ   γ 
θ C  C
, (6)
Due to control of reaction wheel motors by voltage control method base on pulse-width
modulation[4], the differential equation of the armature electric circuit is

di
v j = Rm i + Lm + K bθ j
, dt (7)
As the armature inductance is neglected ( Lm ≈ 0 ), the input torques are derived as

Kt Kt2 
τj = vj − θj
Rm Rm
. (8)
Denote six generalized coordinates of the system as

q1 =α q2 =β q3 =γ q4 =θ A q5 =θ B q6 =θC
, , , , , , (9)
The above Lagrangian becomes a function of the generalized coordinates. The Lagrangian equation
of motion is given by

d ∂L ∂L
( )− = τi , (i = 1 ~ 6)

dt ∂qi ∂qi , (10)

182
Now, the dynamic model of system can be derived by substituting formula (1)-(9) into (10) and
solving qi 13. That is

 mgl sin α cos β K t [vb + vc − 2v a + K t (2θA − θB − θC )]


α = Iw − Iy
+
 6( I w − I y ) Rm
 − mgl cos α sin β 2 K t [(vb − vc ) − K t (θB − θC )]
 β = +
 ( Iw − Ix ) 2( I w − I x ) Rm
   
γ = K t [(v a + vb + vc ) − K t (θ A + θ B + θ C )]
 3( I w − I z ) Rm

θA = 6 mgl sin α cos β / [3( I w − I y )( I w − I z )]
 K t {3I y I z v a − I w [ I y (2v a − vb − vc ) + I z (v a + vb + vc )]}
 +
 3 I w ( I w − I y )( I w − I z ) Rm

 K t [( I w (2 I y + I z ) − 3I y I z )θA − I w ( I y − I z )(θB + θC )]
2

 +
3 I w ( I w − I y )( I w − I z ) Rm

θ = K [ K + K (v − K θ ) + K (v − K θ )]
 B 1 2 4 b t B 5 c t C

θ C = K1[ K 3 + K 5 (vb − K t θ B ) + K 4 (vc − K t θC )]


 
, (11)
with
K1 = 1 / (6 I w ( I w − I x )( I w − I y )( I w − I z ) Rm ) ,
K 2 = 2 K t I w ( I w − I x )( I y − I z )(v a − K t θA ) + 6mglI w Rm [ 3( I w − I y ) cos α sin β − ( I w − I x ) sin α cos β ]
K 3 = 2 K t I w ( I w − I x )( I y − I z )(v a − K t θA ) − 6mglI w Rm [ 3( I w − I y ) cos α sin β + ( I w − I x ) sin α cos β ] ,
K 4 = −6 I x I y I z − I w 2 (3I x + I y + 2 I z ) + I w (4 I x I y + 5 I x I z + 3I y I z ) ,
K 5 = K t I w [3 I w I x − I w I y − 2 I x I y − (2 I w + I x − 3 I y ) I z ] .

Fuzzy PID Controller Design


Fuzzy PID controller principle shown in Figure 3, the principle of fuzzy PID control for the input PID
regulator deviation e and deviation rate of change ec simultaneously input to the fuzzy controller.
After fuzzy e and ec are inferred and defuzzified by the fuzzy control rule, ∆kp, ∆ki and ∆kd are
obtained. Then the modified ∆kp, ∆ki and ∆kd are input to the PID controller. Then the three
coefficients are corrected online according to the principle of fuzzy control[2]. Therefore, the PID
parameters are changed in real time in the control process.

Figure 3. The block diagram of fuzzy PID control system.

Fuzzy Membership Function Established


This article builds three fuzzy controllers and three sets of PID parameters are output. Take the
deviation e and deviation rate ec of α, β, γ as input. The subsets of e and ec are defined as {NB, NM,

183
NS, Z, PS, PM, PB} and they are mapped to the domain [-6, 6]. The membership functions of e and ec
are shown in Figure 4. The output of the fuzzy controller ∆kp, ∆ki, ∆kd are the input values of the
correction values of the proportional, integral, and derivative parameters of the conventional PID
controller, respectively, and the fuzzy subsets are defined as {NB, NM, NS, Z, PS, PM, PB}. The
domain of their mapping is [-3, 3], [-0.08, 0.08] and [-1, 1]. In the fuzzy PID controller, the specific
setting of the proportional ∆kp controller is shown in Figure 5. The specific settings of the integral ∆ki
controller and differential ∆kd controller are similar to the proportional ∆kp controller.

Figure 4. Membership function of input variables e and ec.

Figure 5. Membership function of input variables kp.

Fuzzy Control Rules


The fuzzy control rule is a set of fuzzy conditional statements that are summarized by the expert's
experience and the operator's skill. To determine the fuzzy control rules, it must be ensured that the
output of the controller can optimize the dynamic and static characteristics of the system. According
to fuzzy PID parameter setting principles, as shown in Table 2-4, the fuzzy rules for establishing ∆kp,
∆ki, ∆kd are:
Table 2. Fuzzy control rules of ∆kp.
EC
∆Kp
NB NM NS Z PS PM PB
NB PB PB PM PM PS Z Z
NM PB PB PM PS PS Z NS
NS PM PM PM PS Z NS NS
E Z PM PM PS Z NS NM NM
PS PS PS Z NS NS NM NM
PM PS Z NS NM NM NM NB
PB ZZ Z NM NM NM NB NB

184
Table 3. Fuzzy control rules of ∆ki.
EC
∆Ki
NB NM NS Z PS PM PB
NB NB NB NM NM NS Z Z
NM NB NB NM NS NS Z Z
NS NB NM NS NS Z PS PS
E Z NM NM NS Z PS PM PM
PS NM NS Z PS PS PM PB
PM Z Z PS PS PM PB PB
PB Z Z PS PM PM PB PB
Table 4. Fuzzy control rules of ∆kd.
EC
∆Kd
NB NM NS Z PS PM PB
NB PS NS NB NB NB NM PS
NM PS NS NB NM NM NS Z
NS Z NS NM NM NS NS Z
E Z Z NS NS NS NS NS Z
PS Z Z Z Z Z Z Z
PM PB NS PS PS PS PS PB
PB PB PM PM PM PS PS PB

Defuzzification
Through fuzzy inference, a fuzzy set can be output. In actual control use, a certain value must be used
to control the actuator. This requires de-fuzzification. This article uses the "center of gravity method"
and the mathematical expression is[3]:
7

∑µ
1
i ⋅µ( µi )
µ = 7

∑ µ( µ ) i
1 (12)

Simulation and Analysis

The Experiments Comparison of Simulation


The Simulink simulation was performed using fuzzy PID and conventional PID control methods
respectively. The three initial attitude angles of the cubic robot were {5°, -5°, 10°}. Balancing the
corner point as a control point. That is, the attitude angle is {0°, 0°, 0°}. The simulation results are
shown in Figure 12 and Figure 13.

) α
(/
°

β
, γ
α β γ

,
θ θ θ (r/min)

θA
θB
C
θC
,B
,A

Time(s)

Figure 6. Fuzzy PID balance control.

185
) α
(

°
/ β
, γ

α β γ
,

θ θ θ (r/min)
θA
θB
C
θC
,B
,A

Time(s)

Figure 7.Conventional PID balance control.


From Figure 12 and Figure 13, it can be seen that in the case of fuzzy PID balance control, the
attitude angle of the cubic robot quickly and smoothly reaches the equilibrium angle from the initial
position. There is no oscillation in the process. The cubic robot achieve balance in 0.2s. The speed of
reaction wheel decelerates to zero speed within 0.2s. The adjustment time is short, the overshoot is
small, and the system has strong stability. Under the conventional PID balance control, the system has
a slight overshoot and, relative to the fuzzy PID control, the adjustment speed is slower, and the
overshoot is greater and the stability is worse.
In summary, we can see that the fuzzy PID control has a faster response speed, there is basically no
overshoot, and there is basically no steady-state error, so the fuzzy PID control method has a better
control effect on the attitude control of the cubic robot.
The Tracking Experimentation of Attitude Angle
A comparison expermentation that the attitude angle α of cubic robot tracking a sine signal in range of
±20 ° and a square signal with the gain of 20° with the fuzzy pid controler and pid control
respectively. The simulation results is shown in Figure 14 as follow.
α /(°)
α /(°)

Time(s)

Figure 8. Control result of tracking sine signal and square signal.

α
As shown in Figure 14. The attitude angle has faster response speed and smaller overshoot under
fuzzy controller control. And the results show that the cubic robot have better performance under the
control of fuzzy PID with higher presision.

186
Conclusion
The cubic robot is a multivariable, strongly coupled, nonlinear, and time-varying complex system. Its
characteristics and calculations are much more complicated than that of a DC motor. The fuzzy PID
controller proposed in this paper combines fuzzy control and PID control. It not only has the
advantages of flexible control and strong adaptability, but also has the characteristics of high
precision of PID control. The fuzzy PID controller can effectively deal with the nonlinearity and
uncertainty of the system through on-line self-tuning control parameters, which not only improves the
control performance of the system, but also makes it have good anti-interference ability and
robustness. At the same time, the model is easy to adjust, improve, greatly shorten the development
cycle, making it can be used to achieve online control of different industrial processes, has a good
promotion and application value.

Acknowledgement
We acknowledge support from National Natural Science Foundation of China (No. 61773027); Key
Project (No. KZ201610005010) of S&T Plan of Beijing Municipal Commission of Education

References
[1] Muehlebach M, Gajamohan M, D’Andrea R. Nonlinear analysis and control of a reaction
wheel-based 3d inverted pendulum. In: Proceedings of the conference on decision and control[J];
2013
[2] Weilong Hou. Research on Fuzzy PID Speed Control System of Walker Aid Robot[J]. Computer
Measurement & Control. 2017, 54-57.
[3] Xinying zhang, Fajun Yu, Cong Liu.Design of Four-Rotor UAV Based on Fuzzy PID
Control[J].Research and exploration in laboratory. 2017, (36), 56-59.
[4] Zhigang Chen, Xiaogang Ruan, Yuan Li. Balancing Control of a Cubical Robot Balancing on Its
Corner [C], The 15th International Workshop on Advanced Motion Control (AMC2018).
[5] Zhengli Zhao, Huijun Yu, Faming Zhang. DC Motor Speed Control System Based on Fuzzy PID
Control[J]. Journal of Hunan University of Technology.2015, (25), 38-42.
[6] Zhigang Chen, Xiaogang Ruan, Yuan Li. Dynamic Modeling of a Cubical Robot Balancing on Its

Corner [C], 2017 3rd International Conference on Mechanical Electronic and Information
Technology Engineering
[7] M. Gajamohan, M. Merz, I. Thommen, and R. D’Andrea. The cubli: A cube that can jump up and
balance[J]. In IEEE/RSJ Int. Conf. on Intelligent Robots & Systems, pages 3722–3727. IEEE, 2012.

187

You might also like