You are on page 1of 6

Hi ngh ton quc v iu khin v T ng ho - VCCA-2011

VCCA-2011
A Study on PID and Fuzzy Based Controllers Design for Controlling
Motion and Direction of a 5-Link Carangiform Fish Robot
Mt nghin cu xy dng b iu khin PID v m cho di chuyn v hng
ca robot c carangiform
Pham Van Anh
Mater student of Department of Mechatronics, Faculty of Mechanical Engineering
Ho Chi Minh City University of Technology Hochiminh City
e-Mail: phamvananhhl@gmail.com
Tuong Quan Vo
Department of Mechatronics, Faculty of Mechanical Engineering
Ho Chi Minh City University of Technology Hochiminh City
e-Mail: vtquan@hcmut.edu.vn

Abstract
Biomimetic fish robot is growing concern in recent
years. Flexible and using less energy are superior
advantages than traditional underwater
transportation. This research was performed on the
Carangiform five links robot model. The components
include thrust, lateral and drag force are
considered. Base on Lagrange method, the robot
dynamics equations are established. From which, the
law of control as PID, Fuzzy and Fuzzy-PID are
applied to turn motion or stabilize the robot moving
direction. Genetic algorithms also is applied to
optimize the parameters of controller, this is basis to
compare the quality of the difference
controllers. Finally, the simulation is performed to
demonstrate the effectiveness of the controllers.

Tm tt
Robot c phng sinh c quan tm ngy cng nhiu
trong nhng nm gn y. Vi u im vt tri so
vi phng tin di chuyn di nc truyn thng:
linh hot v tiu tn t nng lng. Nghin cu ny
c thc hin trn m hnh robot c dng
Carangiform 5 khu. Cc thnh phn lc y, lc ri,
lc cn ca nc tc ng ln robot c xem xt.
Trn c s phng php Lagrang, phng trnh ng
lc hc cho robot c thit lp. Sau , cc lut iu
khin PID, Fuzzy, Fuzzy-PID c p dng c th
thay i hay n nh hng cho robot khi di chuyn.
Gii thut di truyn cng c p dng tm cc
thng s cho b iu khin, lm c s so snh cht
lng ca cc b iu khin khc nhau. Cui cng,
vic m phng c thc hin chng minh tnh
hiu qu ca cc b iu khin thit k.

Symbol
Symbol Unit Meaning
l
0
, l
1
, l
2
, l
3
,
l
4

m
length of links
a
0
, a
1
, a
2
,
a
3
, a
4

m
center of gravity
J
0
, J
1
, J
2
,
J
3
, J
4

kgm
2
moment of inertia of links

m
0 ,
m
1
, m
3

m
3
, m
4

kg mass of links

k
1
, k
2
, k
3
,
k
4

N/m equivalent spring at the
joints
b
1
, b
2
, b
3
,
b
4

Nms/rad equivalent damper at the
joints
U
m
m/s fluid velocity
C
d
density of water
S m
2
body projected area
L m fin span
T
1
, T
2
, T
3
Nm torque

1. Introduction
In previous researches, the modeling fish robot and its
propulsion mechanism in the underwater environment
meet many difficulties, these researches focus on the
kinematic model based on the theory of Sir James
Lighthill [1, 2]. From which the control algorithm is
applied. In [3] the fuzzy algorithm is used to control
motion direction of fish robot in the plane. This
modeling of paper is based on kinematic model,
however the thrust and drag force attacked on the
surface of robot are considered. In [4], a tracking
controller is designed for the robot, a camera is used
to feedback the real direction of robot, the fuzzy
algorithm help robot avoid obstacles, but this research
also based on kinematic model. Several other
researches were made to control the motion direction
of robot. Junzhi Yu extended a research on multi-joint
fish robot model which is based on dynamic equation
of Schiehien [5], this controller help robot move in
straight lines and turn direction in a circle.
In a recent research, a robot dynamic modeling is
based on methods Lagrange by Motomu
295
Hi ngh ton quc v iu khin v T ng ho - VCCA-2011
VCCA-2011
Nakashima[6]. In particular, the propulsion
components and the resistance of water are built
explicitly. The dynamic equations describing double
jointed fish robot established. Based on this modeling
method, many other research have been extended. Vo
Tuong Quan and colleagues developed the
Carangiform 3-joint robot. Sliding mode and Fuzzy
Sliding controller are applied to track and turn the
direction of moving robot [7].
In this research, we developed a Carangiform 4-
joint (5-link) fish robot dynamic model. Then,
the PID, Fuzzy and Fuzzy-PID controllers are built to
track the desired direction. The performance of
controllers is compared to clarify the quality of
different controllers. Finally, the simulation and
primitive experiment results are presented to verify
the effectiveness of these controllers.

2. Dynamic modelling
Our research is performed on Carangiform fish robot
that the propulsion force is generated by caudal fin. A
fish-like mechanism modeled as five link system as
shown in Fig.1. The head part of robot (0
th
link) is
rigid and undulate during travelling, other links can be
returned around through joints. Based on the Motomu
Nakashimas research [4], we assume that the inertial
fluid force F
V
, lift force F
J
only act on the caudal fin
(4
th
link), the drag F
D
component is considered to
establish equation of system motion. The forces
distribution model is shown on Fig 2. The thrust force
component F
F
and the lateral force component F
C
are
inferred from F
V
and F
J
.
0
th
link 1
st
link 3
rd
link 4
th
link 2
nd
link
m0
m1
m2
m3
m4

Fig.1. Links mechanism model
FD
FC
FF
FV
FJ
Moment direction

Fig.2. Forces distribution on fish robot
The analytical model of fish robot is presented on the
Fig.3. There are three motor that generate torques for
1
st
, 2
nd
, 3
rd
link. At the joint, k
i
and b
i
are equivalent
spring and damper of motors.
k1
b1
k2
b2
k3
b3
k4
b4
T1
T2
T3
m0
m1
m2
m3
m4
q4
q3
q2
q1
FF
Y
X
q0
FC
Fi
Fig.3. Analytical model of fish robot
The dynamic equation of the propulsion obtained
by Lagrange method is written as:
( ) ( ) ( ) ( )
1 5 1 5
2
5 5 5 5 5 5 x x x x x
T q G q q C q q B q q H = + + +
(1)
Where:
T
T T T T ] 0 0 [
3 2 1
=


To solve Eq.(1), we convert Eq.(1) to Eq. (2) by
putting:
1 5 4 4 3 3 2 2 1 1
; ; ; ; q x q x q x q x q x = = = = =

0 10 0 9 4 8 3 7 2 6
; ; ; ; q x q x q x q x q x = = = = =

F X M =

(2)
Where:
(
(
(
(
(
(
(
(
(
(
(
(
(
(

=
1010 108 107 106 105
810 88 87 86 85
710 78 77 76 75
610 68 67 66 65
510 58 57 56 55
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
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 1
m m m m m
m m m m m
m m m m m
m m m m m
m m m m m
M

T
x x x x x x x x x x X ] [
10 9 8 7 6 5 4 3 2 1
=
T
f f f f f f f f f f F ] [
10 9 8 7 6 5 4 3 2 1
=
The SVD (singular value decomposition) method is
used to find inverse matrix of M.
F M X
1
=

(3)
Solving Eq.(3) by Runge-Kutta method, the heading
angle of robot (q0), other displacement and the angle
velocity of the links can be also achieved (q1, q2, q3).
Because links are constrained by limits of the working
angle, so torques also have to generate angles in
certain limitation.

3. Control design
Following [8], there are three modes to turn motion
direction of robot. Applying the first mode, we use
torque T1 that is generated by the first motor to
control robot turning motion direction. Fig.4 shows
the examples of direction changes of the fish robot for
the clockwise (CW) or counter clockwise (CCW)
direction.
q1
Y
X
Y
X
T1
T2
T3
T1
T2
T3
O O (CCW) (CW)
q1

Fig.4. Turning motion of fish robot in CW and CCW

3.1 PID Controller
The simple PID controller is presented as Fig.5. There
are many methods to choose parameters for
296
Hi ngh ton quc v iu khin v T ng ho - VCCA-2011
VCCA-2011
controllers. GA is an interlligent algorithm, so we
use it to choose the parameters for differrece
controllers. With PID controller, the parameters
include: Kp, Ki, Kd.
Fitness function of genetic algorithm is chosen to
optimize the error between the reference angle and the
desired angle of robot is present as Eq.(4).
Minimum: ~
}
=
=
n
i
P
t
P Fitness
dt e dt e F
1 0
(4)
The optimization parameters are chosen as:
populationsize: 50, crossoverfraction: 0.8;
migrationfraction: 0.5; generations: 100.
This algorithm is also applied to design the other
controller based on comparing the quality of
controllers.

3.2 Fuzzy Controller
FUZZY
CONTROLLER
PLANT
COMPASS
SENSOR
oSetpoint=oRef oReal
e=oReal-oRef
d/dt
k1
k2
k3
T1
Fig.6. Principle of the Fuzzy
Two inputs and one output fuzzy controller are
proposed as Fig. 6. In this illustration, a digital
compass is also used to feedback real angle of
heading robot.
The number linguistic terms for each linguistic
variable are 5 for two inputs and one output.
Linguistic variables of e and de are (eNB), (eNS),
(eZE), (ePS), (ePB) and (deNB), (deNS), (deZE),
(dePS), (dePB). Five variables of output T1 are (NB),
(NS), (ZE), (PS), (PB). There are 25 rules applied to
controller as shown in table 1. The method of
defuzzification is chosen as the center of gravity
method.
Table 1. Rules of Fuzzy controller
T1
de
deNB deNS deZE dePS dePB
e
eNB PB PB PB PS ZE
eNS PB PB PS ZE NS
eZE PB PS ZE NS NB
ePS PS ZE NS NB NB
ePB ZE NS NB NB NB
The parameters k1, k2 and k3 are chosen by GA.
3.3 Fuzzy PID Controller
To combine advantage of the PID controller and
Fuzzy controller, we recommend the Fuzzy-PID
controller as self-turning controller. The principle of
the Fuzzy controller is briefly introduced in Fig. 7.
Based on the error and the velocity of the error, the
fuzzy block will calculate the suitable value of the
coefficients: K
p
, K
i
, K
d
. The number linguistic terms
for each linguistic variable are five for both two
inputs and three outputs.
PLANT
COMPASS
SENSOR
oSetpoint=oRef oReal
e=oReal-oRef
T1
PID
FUZZY
d/dt
h1
h2
h6 h4 h5
Ki Kp Kd

Fig.7. Principle of the Fuzzy-PID controller
Five linguistic variable of error and the error velocity
are (eNB), (eNS), (eZE), (ePS), (ePB) and (deNB),
(deNS), (deZE), (dePS), (dePB). Five linguistic
variables of outputs are (NB), (NS), (ZE), (PS), (PB).
There are twenty five rules applied to Fuzzy-PID
controller. These rules are illustrated on table.2.
Similar to Fuzzy controller, the defuzzification
method that is used is the center of gravity method.
Table 2. Rules of Fuzzy controller
Kp, Ki,
Kd
de
deNB deNS deZE dePS dePB
e
eNB PB PS ZE PS PB
eNS ZE ZE PS ZE ZE
eZE NB NS PB NS NB
ePS ZE ZE PS ZE ZE
ePB PB PS ZE PS PB

The parameters of Fuzzy-PID controller are also
chosen by GA.
4. Simulation results
For simulation, we consider a fish robot with
parameter presented on table 3
Table 3: Parameters of fish robot
Symbol Value
0
th
link
J
0
1.14x10
-3

m
0
0.534
l
0
0.16
a
0
0.08
1
st
link
J
1
4.9x10
-5

m
1
0.164
l
1
0.06
a
1
0.03
k
1
4.0
b
1
1.2
2
nd
link
J
2
5.2x10
-5

m
2
0.174
l
2
0.06
a
2
0.03
k
2
1.0
b
2
0.08


297
Hi ngh ton quc v iu khin v T ng ho - VCCA-2011
VCCA-2011
Symbol Value
3
rd
link
J
3
1.6x10
-5

m
3
0.054
l
3
0.06
a
3
0.03
k
3
0.5
b
3
0.05
Caudal
fin
J
4
4.7x10
-6

m
4
0.034
l
4
0.08
a
4
0.04
k
4
0.025
b
4
1.5x10
-3

Fluid
force
U
m
0.05
990
C
d
0.5
S 4.8x10
-3

L 0.075
2C 0.08

For simulation, we consider a fish robot with the total
of length 400 mm, 0.95 kg weigh, including 4 links
and the tail fin . There are three motor at the joint 1,
joint2 and joint3. The joint 4 is a passive joint. We
assume that the stiffness values are 4Nms/rad,
1Nms/rad, 0.5Nms/rad and 0.025Nms/rad
respectively.

4.1 Tracking control along a straight path
The tracking control along a straight path is carried
out by two different heading angles are 30 degrees
and 45 degrees.

4.1.1 PID controller

0
Reference=45
0


b.
0
Reference: since wave
Fig.8. Motion control by PID controller (KP=19.9572,
KI=1.0051, KD=1.3112)
The tracking performances of fish robot using PID
controller are presented on the fig.8. On the fig.8, the
coefficients are chosen by the genetic algorithm.
The choice of parameters is important for controller.
The performance of system is faster and the error of
setting is smaller when the parameters are chosen by
second method.

4.1.2 Fuzzy controller

a.
0
Reference=45
0


b.
0
Reference: since wave
Fig.9. Motion control by Fuzzy controller (k1=1.2359,
k2=1.8484, k3=9.0169)
Fig.9 presents the tracking performance of the fish
robot. In which the heading angle error is smaller than
that of PID controller, but the transient time is bigger.
Parameters of Fuzzy controller found by genetic
algorithm

4.1.3 Fuzzy-PID controller

a.
0
Reference=45
0


b.
0
Reference: since wave
Fig.10. Motion control by Fuzzy-PID controller
(h1=2.8928, h2=1.2424, h3=7.4708, h4=0.1698,
h5=3.3766)
The heading angle performance of robot with Fuzzy-
PID is shown in Fig.10. The Fuzzy-PID controller is
298
Hi ngh ton quc v iu khin v T ng ho - VCCA-2011
VCCA-2011
higher quality than the other ones proven through
short transient time and the steady state error.
Parameters of Fuzzy-PID controller found by genetic
algorithm

4.2 Respondent comparison among the PID, Fuzzy,
Fuzzy-PID controllers
4.2.1 The comparison in turning motion

Fig.10. Comparison of turning time between PID, Fuzzy
and Fuzzy-PID with desired turning angle 45
0

We investigated the response of the different
controllers on the transient time shown in Fig.10. The
turning motion of Fuzzy controller is the longest that
is about 0.25 second. This is about 0.17 second on the
PID controller. The transient time of Fuzzy-PID
controller is the shortest that is about 0.14 second.

4.2.2 The comparison in following a straight path
The summary of the sum square error and Steady state
error between PID, Fuzzy and Fuzzy-PID controller
are briefly introduced in Table 4.
Table 4: (Heading reference angle 45
0
)
Controller Sum square error Steady state error
(
0
)
PID 3.9043 2.3
Fuzzy 4.7107 2.1
FuzzyPID 3.6372 2.0
In order to evaluate the performance of those
controllers, we compare the steady state error after the
fish robot reaches the desired turning angle. With
Fuzzy-PID controller, the steady state error is the
smallest, about 2.0 degree. This of PID controller is
the largest, about 2.3 degree. The steady state error of
Fuzzy controller is smaller than one of PID controller
but the sum square error of it is bigger.

4.3 Response to disturbance
We investigated the response of heading angle to a
disturbance in order to examine the robustness of the
controllers. We assume that the disturbance impacting
the heading angle of robot include two parts. The first
part is random part distributed in [-1 1] degree, called
d1. The second part caused by the waves in a
direction perpendicular to the motion direction of
robot, called d
2
. With d
2
, we assume that the
propagation velocity of water wave is v
2
=1m/s,
wavelength
2
=2m, the amplitude is 10 degree. The
summary of the disturbances is shown on the Fig.11.
The equation describing the disturbance is presented
in (5) and (6)
| | ( ) 2 ; 2
1
= rand d (5)
( )
2
1 5 . 1 sin 10
2
10

=
t
e d (6)

Fig.11. The disturbance impacting to heading angle
CONTROLLER PLANT
COMPASS
SENSOR
oSetpoint=oRef oReal
e=oReal-oRef T1
Disturbance
D
Filter

Fig.12. Principle of the controller with the filter

1 s T
1
F
F
Filter
+
=
(7)
The disturbance impacting the heading angle of robot
dont only change the quality of the controller but also
affect the other devices, especially the sensor. We
proposed a filter to reduce the chattering phenomena
on the response of system, Fig. 12. Function of filter
chosen simply shown on the Eq (7).
In order to examine the robustness of the controllers,
we consider the performance of system with and
without the disturbance shown Fig.13, 14, 15.

(a). Without filter


(b). With filter
Fig.13. Turning motion control by PID (450)


(a). Without no filter
299
Hi ngh ton quc v iu khin v T ng ho - VCCA-2011
VCCA-2011


(b). With filter
Fig.14. Turning motion control by Fuzzy controller (450)


(a). Without no filter


(b). With filter
Fig.15. Turning motion control by Fuzzy-PID (450)
The performance of heading angle of fish robot is
affected seriously when the system is impacted by the
disturbance. The PID controller is sensitive to the
disturbance. The Fuzzy controller is affected less than
the PID controller. The Fuzzy PID controller is
affected at least. The quality of the controllers are
improved significantly when the filters is added.
Table 5. Comparing quality among controllers
Test condition
(time=10s)
Sum square error (
0
)
PID Fuzzy Fuzzy-PID
Without filter 6.3599 6.7963 4.8099
With filter 10.2653
10.2653
9.1151 8.1285
Table 5 presents the sum square error of the
difference controller. This of Fuzzy controller is
higher than one of PID controller because the Fuzzy
controller has the bigger transient time. The Fuzzy-
PID still has the best performance.

5. Conclusion
In this paper, we build a mathematical model of
Carangiform fish robot 4-joints. The
mathematical equations are established on the basis
of the dynamic analysis by method of
Lagrange. Three motion direction controllers are
designed then which included: PID, Fuzzy and Fuzzy-
PID. In order to evaluate
the quality of the controllers, we use genetic
algorithms to find the parameters for each
controller. Beside, the influences of underwater
environment disturbance are also considered to verify
the high performance of the controller. The simulation
results proved the effectiveness of controllers.

REFERENCES
[1] Junzhi Yu, Shuo Wang and Min Tan, A
simplified propulsive model of bio-mimetic
robot fish and its realization, Robotica, 2005
[2] K. A. Morgansen, B. I. Triplett, D. J. Klein,
Geometric methods for modeling and control of
free-swimming fin-actuated underwater
vehicles, IEEE Trans. on Robot, 2007
[3] Gwenael Allard, Control of a Free-swimming
Fish Using Fuzzy Logic, The Int. J. Virtual
Reality, 2007
[4] Pei-Jun Lee, Chi-Hen Yen, Chen-Lun Chan,
Meng-Shiue Lee, and Ruei-Chan Wang,
Implementation of a Fuzzy Control Based
Intelligent Robot Fish, Int. J. Fuzzy Systems.
11(4), 2009
[5] Junzhi yu, Lizhong Liu, Long Wang, Dynamic
Modeling of Robotic Fish Using Schiehien's
Method, IEEE. Int. Conf. on Robotics and
Biomimetics, 2006
[6] Motomu Nakashima, Norifumi Ohgishi and
Kyosuke Ono, A Study on the Propulsive
Mechanism of a Double Jointed Fish Robot
Utilizing Self-Excitation Control, JSME. Int.
Journal. Advances in Motion and Vibration
Control Technology. 46(3), 2003
[7] Tuong Quan Vo, Tan Tien Nguyen, Thien Phuc
Tran and Byung Ryong Lee, Turning motion
control of a 3-Joint Carangiform Fish Robot
Using Sliding Mode and Fuzzy Sliding
Controller, 2010
[8] Koichi HIRATA, Tadanori TAKIMOTO, and
Kenkichi TAMURA, Study on Turning
Performance of a Fish Robot,

300