# Fuzzy Logic Control of a Ball on Sphere System

Authors: Seyed Alireza Moezi; Ehsan Zakeri; Yousef Bazargan-Lari; Mahmood Khalghollah
Journal: Advances in Fuzzy Systems
 (2014)

---

## Abstract

The scope of this paper is to present a fuzzy logic control of a class of multi-input multioutput (MIMO) nonlinear systems called “system of ball on a sphere,” such an inherently nonlinear, unstable, and underactuated system, considered truly to be two independent ball and wheel systems around its equilibrium point. In this work, Sugeno method is investigated as a fuzzy controller method, so it works in a good state with optimization and adaptive techniques, which makes it very attractive in control problems, particularly for such nonlinear dynamic systems. The system’s dynamic is described and the equations are illustrated. The outputs are shown in different figures so as to be compared. Finally, these simulation results show the exactness of the controller’s performance.


---

## Body

## 1. Introduction

Recently, several attempts have been made to analyze the dynamic and control of a system containing a ball on a body and its stability which is used in education and research in control field including ball and beam [1], ball on wheel [2, 3], and ball on sphere [4, 5]. This paper investigates particularly a nonlinear system of ball on a sphere [2] whose dynamical equations are extremely nonlinear and their parameters are interdependent in various directions; they have been considered to be two independent ball and wheel systems around the equilibrium point [3]. This system of ball on a sphere is visualized in Figure 1. In the current work, based on the results, a considerably simpler fuzzy control technique for a larger class of these nonlinear systems is proposed [6], such as unmanned vehicles [7, 8] and robot manipulators. It has now been realized that fuzzy control systems theory and methods offer a simple, realistic, and successful alternative for the control of complex, imperfectly modeled, and largely uncertain engineering systems. For this purpose, a combination of fuzzy control technology and advanced computer facility available in the industry provides a promising approach that can mimic human thinking and linguistic control ability, so as to equip the control systems with certain degree of artificial intelligence.Figure 1
A ball on a sphere system.This paper contains the following subjects. First, dynamic and modeling section which presents the dynamic of the modeling and its parameters has been presented. Next, the control law has been investigated and, by means of input-to-state stability theory, a new fuzzy control scheme is designed involving the equations parameters. Following that, the simulation results have been discussed by the graphs and tables, and finally the conclusion is presented in the last part.


## 2. Dynamic and Modeling

In the present work, a ball on a sphere system with arbitrary desires is controlled by the fuzzy logic controller. For this purpose, a model for the ball on a sphere system has been opted and, then, its dynamical equations have been derived [3, 9]. Although these dynamical equations are extremely nonlinear and their parameters are interdependent in various directions, they have been considered to be two independent ball and wheel systems (Figure 2) around the equilibrium point, since, in that point, the parameters are assumed independent in all directions. In present work, the system of ball on sphere is considered to be two-dimensional in all directions, like a ball and wheel system. One of our assumptions to consider the ball rolls on the sphere without slipping and without axial spin is that the coefficient of friction is large enough [10]. The system parameters are θ
x, β
x which, respectively, denote the ball and the spheres angles with respect to the x direction, θ
y, β
y which denote the ball and the spheres angles with respect to the y direction, I
R and I
r which are moments of inertia of the sphere and ball, respectively, and m as the balls mass. There are also R and r which already denote the sphere and balls’ radiuses, respectively.Figure 2
Schema of the ball and wheel system.Then, by using the Euler-Lagrangian method, the systems equation will be derived [11]:
(1)
L
=
K
-
U
,
∂
∂
t
∂
L
∂
q
˙
-
∂
L
∂
q
=
Q
i
,
i
=
1,2
,
3,4
,
Q
1
=
0
,
Q
2
=
T
x
,
Q
3
=
0
,
Q
4
=
T
y
,
where L
=
T
-
V (Lagrangian function), T: kinetic energy, V: potential energy, Q: generalized forces, and q: generalized coordinates. Consider
(2)
R
+
r
m
+
I
r
R
+
r
r
2
θ
¨
x
+
-
I
r
b
R
r
2
β
¨
x
-
m
g
sin
θ
x
=
0
,
-
I
r
R
R
+
r
r
2
θ
¨
x
+
I
R
+
I
r
R
2
r
2
β
¨
x
=
T
x
,
R
+
r
m
+
I
r
R
+
r
r
2
θ
¨
y
+
-
I
r
R
r
2
β
¨
y
-
m
g
sin
θ
y
=
0
,
-
I
r
R
R
+
r
r
2
θ
¨
y
+
I
R
+
I
r
R
2
r
2
β
¨
y
=
T
y
,
q
=
θ
x
β
x
θ
y
β
y
,
M
q
q
¨
+
G
q
=
T
,
M
=
M
11
M
12
M
13
M
14
M
21
M
22
M
23
M
24
M
31
M
32
M
33
M
34
M
41
M
42
M
43
M
44
,
where M
11
=
R
+
r
m
+
I
r
(
(
R
+
r
)
/
r
2
), M
12
=
-
I
r
(
R
/
r
2
), M
13
=
0, M
14
=
0, M
21
=
-
I
r
(
R
R
+
r
/
r
2
), M
22
=
I
R
+
I
r
(
R
2
/
r
2
), M
23
=
0, M
24
=
0, M
31
=
0, M
32
=
0, M
33
=
R
+
r
m
+
I
r
(
(
R
+
r
)
/
r
2
), M
34
=
-
I
r
(
R
/
r
2
), M
41
=
0, M
42
=
0, M
43
=
-
I
r
(
R
R
+
r
/
r
2
), and M
44
=
I
R
+
I
r
(
R
2
/
r
2
). Consider
(3)
G
=
-
m
g
sin
q
1
0
-
m
g
sin
q
3
0
,
T
=
0
T
x
0
T
y
.
So
(4)
q
¨
=
M
-
1
T
-
G
.
For state space we have
(5)
x
˙
1
=
x
2
,
x
˙
2
=
q
¨
1
,
x
˙
3
=
x
4
,
x
˙
4
=
q
¨
2
,
x
˙
5
=
x
6
,
x
˙
6
=
q
¨
3
,
x
˙
7
=
x
8
,
x
˙
8
=
q
¨
4
.


## 3. Fuzzy Control

Fuzzy logic controller can be implemented by some information about general behavior, regardless of system dynamic model. So, the performance of the controller and stabilization of the system are independent of the system uncertainties.In order to present a fuzzy control method [7, 12, 13] for a (robotic) system, one may begin with a fuzzy logic control model. Fuzzy controllers are commonly divided into “Sugeno” and “Mamdani” categories. Mamdani method is considerably capable of extracting expert information. The other one, Sugeno method, is computationally efficient so it works in a good state with optimization and adaptive techniques, which makes it very attractive in control problems, particularly for dynamic nonlinear systems. These adaptive techniques can be used to customize the membership functions so that fuzzy system best models the data [14]. In this paper, the Sugeno method has been investigated and this controller is independent of dynamics and modeling. Parameters and their bound limited are defined by try and error.In this decoupled system two states,x direction and y direction, are controlled separately, so the controller parameters are defined as following.(i)
Two inputs (angular position error and angular velocity error).
(a)
Angular position error inputs are divided into seven subparts:
(1)
large positive,
(2)
medium positive,
(3)
small positive,
(4)
zero,
(5)
small negative,
(6)
medium negative,
(7)
large negative.
(b)
Angular velocity error inputs are divided into seven subparts:
(1)
large positive,
(2)
medium positive,
(3)
small positive,
(4)
zero,
(5)
small negative,
(6)
medium negative,
(7)
large negative.
(ii)
Naturally one output is existing (torque), which divided into seven fuzzes:
(1)
large positive,
(2)
medium positive,
(3)
small positive,
(4)
zero,
(5)
small negative,
(6)
medium negative,
(7)
large negative.Input and output parameters of controller are limited as following.The first input (angular position error) is bounded between[
-
0.5
,
0.5
] (rad), the second input’s bound (angular velocity error) is defined in the range of [
-
5
,
5
] (rad/sec), and, finally, the output value is bounded between [
-
2000
,
2000
] (N·m).Seven phases are defined in Table1.Table 1
Fuzzy membership and output parameters.
Fuzz
First fuzzes’ coordinates
Second fuzzes’ coordinates
Output fuzzes’ coordinates
NB: negative big
[
-
0.6665
-
0.5
-
0.3332
]
[
-
6.662
-
5
-
3.333
]
−2000
NM: negative medium
[
-
0.5
-
0.3332
-
0.0001
]
[
-
5
-
3.333
-
0.5
]
−1500
NS: negative small
[
-
0.3332
-
0.1666
0
]
[
-
3.333
-
1.668
0
]
−150
ZR: cero
[
-
0.0001
0
0.0001
]
[
-
0.5
0
0.5
]
0
PS: positive small
[
0
0.1666
0.3333
]
[
0
1.667
3.332
]
150
PM: positive medium
[
0.0001
0.3333
0.5
]
[
0.5
3.332
5
]
1500
PB: positive big
[
0.3333
0.5
0.667
]
[
3.332
5
6.668
]
2000Rules. Each two input fuzzes contain seven membership functions, so 49 rules are obtained, resulting in seven output fuzzes as shown in Table 2.Table 2
Fuzzy rules relation.
Angular velocity error
Angular position error
NB
NM
NS
ZR
PS
PM
PB
PB
ZR
ZR
PS
PS
PM
PB
PB
PM
NS
ZR
ZR
PS
PM
PM
PB
PS
NS
NS
ZR
ZR
PS
PM
PB
ZR
NB
NM
NS
ZR
PS
PM
PB
NS
NB
NM
NS
ZR
ZR
PS
PM
NM
NB
NM
NM
NS
ZR
ZR
PS
NB
NB
NB
NM
NS
NS
ZR
ZRThe plate established by rules is sketched in Figure3.Figure 3
The surface established versus rules.Angular position error membership functions are illustrated in Figure4.Figure 4
Angular position error membership functions.Angular velocity error membership functions are illustrated in Figure5.Figure 5
Angular velocity error membership functions.The control law schema is shown graphically in Figure6 and finally fuzzy controller law is shown in Figure 7.Figure 6
The control law schema.Figure 7
Fuzzy controller law.


## 4. Simulation Results

In order to have a regulation control for this system of “ball on a sphere,” the key parameters are the ball and the sphere’s physical properties already described in the modeling section. The values of these parameters are listed in Table3.Table 3
BOS system parameters.
Parameters
Value
m
0.06 kg
r
0.0125 m
R
0.15 m
I
b
3.75
×
10
-
6 kg·m2
I
B
0.99 kg·m2
g
9.81 m/s2There are also desired values for the initial condition which are shown in Table4.Table 4
Initial conditions.
Initial parameters
Value
θ
x
0
0.07
θ
˙
x
0
0.02
β
x
0
0
β
˙
x
0
0
θ
y
0
0.07
θ
˙
y
0
0.05
β
y
0
0
β
y
0
0These simulation results are summarized in Figures8, 9, 10, 11, 12, 13, 14, and 15.Figure 8
Beta inx direction. Beta in x direction is plotted versus time in 30 seconds as shown in the figure.Figure 9
Beta iny direction. Beta in y direction is plotted versus time in 30 seconds as shown in the figure.Figure 10
Theta error inx direction. The error of angel theta in x direction reaches its desired value which can be observed in the figure. The error tends to zero after 0.6 seconds.Figure 11
Theta error iny direction. The error of angel theta in y direction reaches its desired value which can be observed in the figure. The error tends to zero after 0.6 seconds.Figure 12
Regulated theta inx direction in 30 seconds. Theta in x direction, the angle of ball from x direction, is stabled after about 0.6 sec.Figure 13
Regulated theta iny direction in 30 seconds. Theta in y direction, the angle of ball from y direction, is stabled after about 0.6 sec.Figure 14
Torque inx direction. This torque is applied to the sphere in the x direction to control the position of the ball by means of changing beta in x direction.Figure 15
Torque iny direction. This torque is applied to the sphere in the x direction to control the position of the ball by means of changing beta in y direction.


## 5. Conclusion

The purpose of this paper was to control a system of “ball on a sphere” by the fuzzy logic controller, which is perfectly able to control such a dynamically nonlinear system, which describes two independent ball and wheel systems, and was already set to lead the system to the desired position as was evidenced in the simulation results and figures. The Sugeno method was investigated in this paper; as mentioned before, this controller is not model based method. Parameters and their bound limited are defined by try and error. The great accuracy of the diagrams represents the used fuzzy logic controller which works perfectly in this situation.



---

*Source: 291430-2014-12-11.xml*