[3]
[3]
*
Corresponding author: [email protected] Received: 02.10.2023, Accepted: 08.03.2024
192
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
three coefficients that make up the controller. contribute to existing studies with this study. It is seen
If these coefficients are chosen smaller or larger than as a great advantage that the CGO algorithm has
the required value, the targeted result cannot be certain parameters, such as other optimization
achieved, and the control performance can be algorithms based on swarm intelligence, and it does
increased if the correct parameter is selected. not contain any parameters other than these. The
Therefore, determining the coefficients of the PID parameters found were tested on the realized robot
controller is of great importance for the robot to arm, and the results were compared both as a
perform the desired task. simulation and on the real robot arm.
There are many methods used to determine
PID control parameters. In their most general form, 2. Material and Method
classical techniques can be classified as analytical,
parametric, frequency response, adaptive tuning, and The two-legged robot arm is the simplest robotic arm
metaheuristic algorithms such as the Ziegler-Nichols in robotic systems. Two separate drive elements are
and Cohen Coon methods. Metaheuristic required to perform. In this study, a 1524006SR DC
optimization algorithms can be divided into swarm motor from Faulhaber company, an L298 motor
intelligence, Evolutionary Immunity, neural, driver relay to drive motors, and an Arduino Mega as
probability, and physics-related algorithms [4]. In this a microcontroller were used. The parts of the designed
study, swarm intelligence algorithms are used to solve robot arm were obtained from the 3D printer. The
the problem of determining the parameters of the PID designed two-limbed robot arm can be seen in Figure
controller. 1 a-), and the produced two-limbed robot arm can be
In this study, a PID controller was designed seen in Figure 1 b-).
for the control of the two-limb robot arm, and it was The 1524006R model of Faulhaber has a DC
aimed at obtaining the most appropriate controller motor with a 76:1 rotation ratio and a 2-channel field
parameters with the PSO, ABC, and CGO algorithms, effect encoder. This brand has clearly presented all
which are metaheuristic optimization algorithms. the necessary parameters to its users to obtain the
PSO and ABC have been used in studies on existing transfer function of the DC motor required for control.
robotic system control, but it is thought that CGO will
Figure 1. Two-limbed robotic arm (a) Designed two-limbed robot arm (b) two-limbed robot arm produced.
The distance between the shaft of the motor of arm length can be drawn, while the gripper end of
fixed to the floor of the robot arm and the motor the robot arm can be guided in any way between the
connected to the gripper end is L1, 17.75 cm, and the two-limb system and an outer circle with a radius of
other has a length of 8.25 cm. With an arm connected L1+L2 and an inner circle with a radius of L1-L2. The
to the end of a single motor, only a circle with a radius working area of the robot arm is shown in Figure 2.
193
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
2.1. Controller Design of a Two-Limb Robot Arm the position and direction change with the values
given to the variables, while the inverse kinematics
In robotic systems, there are two mathematical approach allows the values of the variables to be
approaches to moving the end point of the robot arm obtained for the robot arm to reach a certain position.
from the starting point to a determined point. These Inverse kinematic analysis is of great importance for
are expressed as forward and reverse kinematics. The the control of the robot. The schematic representation
forward kinematics approach allows us to calculate of the robot arm realized in the study is given in
Figure 3.
194
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
performed in the robotic system. In equations (3) and We can consider the equivalent circuit of the
(4), the inverse kinematics expression of the variables DC motor as in equation 5 [6].
𝜃1 and 𝜃2 ., which are the variables of the two-limbed
robot, are stated, respectively [5].
𝜃(𝑠) 𝐾𝑡
= (𝑅 (5)
𝑦 𝑙2 𝑠𝑖𝑛𝜃2 𝑉(𝑠) 𝑎 +𝑠+𝐿𝑎) (𝐽∗𝑆∗𝐵)𝑠+𝐾𝑡 ∗𝐾𝑏 ∗𝑠
𝜃1 = 𝑎𝑡𝑎𝑛 (𝑥 ) + 𝑡𝑎𝑛−1 (𝑙 +𝑙 ) (3)
1 2 𝑐𝑜𝑠𝜃2
𝑥 2 +𝑦 2 −𝑙1 2 −𝑙2 2
𝜃2 = + cos−1 ( 2𝑙1 𝑙2
) (4) The values in Table 1 are replaced by the
Rotor inertia J, viscous damping B, electrical constant
There are many systems used as drive 𝐾𝑏 , torque constant 𝐾𝑡 , Rotor inductance L rotor
elements in robot arms. One of them, DC motors, are resistance R in the transfer function found in Equation
electromechanical devices that convert electrical (16), and the transfer function for the Faulhaber DC
energy into mechanical energy. In control science, the motor is found. The transfer function for the DC
transfer function is used to model the behavior of a motor is given in Equation (6). If the unknowns in
DC motor. It connects the electrical voltage equation 5 are filled by means of table (1), equation
information entering the system with the output (6) is obtained.
mechanical position information. The Laplace
transform is used to model the nonlinear behavior 𝜃(𝑠) 5,8×10−3
= (5.1+70×10−6 (6)
around the equilibrium point of the DC motor. The 𝑉(𝑠) 𝑠)(0.66×10−7 𝑠+1)𝑠+5,8×10−3 𝑠
transfer function for the 1512406sr type DC motor of
the Faulhaber company used in this study was found If PID control is used correctly in robot arms,
with the values specified in the catalog section. In it enables robots to save energy with precision,
Table 1, the required features of the Faulhaber stability, and less movement. Since the study has two
1524006sr DC motor for TF are given. degrees of freedom, two PID control blocks were
used. The reference value for the PID control block is
Table 1. Faulhaber 1524006sr DC motor specifications. obtained from inverse kinematic analysis. Since each
PID control has three variables, there are six
Feature Name Value
parameter values in total. Angle obtained after the
Rotor Inertia 0.66 𝑔𝑐𝑚2
Viscous Damping 0 PID control block value is sent to the motors,
Electrical Constant 𝐴 respectively. The operation block of the angle values
0.172
𝑚𝑁𝑚
𝑚𝑁𝑚
sent to the motors against the entered reference x and
Torque Constant 5.8 y axes is given in Figure 4.
𝐴
Robor Inductance 70 𝜇𝐻
Terminal Resistance 1.1 Ω
195
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
For square movement, the robot arm started (8.19). Afterwards, it goes to (8.14), (3.14), and (3.19)
from the point where theta1 and theta2 limb angles points, respectively, and finishes the movement. The
were 0 degrees and followed the points determined on end point of the robot arm follows a square shape with
a coordinate axis. The determined points form a a corner length of 5cm. The reference dimension
square shape. The gripper end of the two-limbed robot placed on the coordinate axis of the square shape is
arm first starts from point (3.19) and goes to point indicated in Figure 5.
In order to achieve the desired movement in PID expression for control. The PID parameters
robot arms, it is necessary to utilize inverse obtained as a result of the optimization process were
kinematics and any controller. The trajectory created set as controller parameters in the real system. The
with the Simulink Support Package for Arduino block diagram of the realized system is shown in
Hardware was converted into an angle value with Figure 6.
inverse kinematics and sent to the
Figure 6. Block diagram of the two-limbed robot arm in the Simulink Support Package for Arduino Hardware.
196
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
In the system implemented with Arduino feedback to the PID control block. The 8-second
support from Simulink, 8 seconds are determined for temporal change reference for 𝜃1 and 𝜃2 separately is
square movement. During the sampling period, given in Figure 7.
angular position data from the encoders provided
Figure 7. Angular positions that a two-limbed robot arm must make for square motion tracking.
Optimization is the process of finding the best value 2.2.1. Particle Swarm Optimization Algorithm
of a given objective function with constraints. This
process is encountered in many fields, from PSO is a meta-heuristic optimization algorithm that
engineering systems to economics, from health to mimics particle swarm behavior to solve optimization
business. Optimization problems can be categorized problems. It was developed in 1995 by Dr. Kennedy
as continuous or discrete, dynamic or static, and Dr. Eberhart. PSO is applied in many different
constrained or unconstrained. These algorithms are a fields thanks to its easy implementation, fast solution,
sub-branch of artificial intelligence, and as the and high success rate. PSO is based on the principle
popularity of artificial intelligence increases, so does of particles searching for the optimal solution to a
its use for different problems [8]. given problem [10].
Meta-heuristic algorithms can often be The velocity and position of each particle are
classified according to their inspiration. Another expressed as a vector. There is also a fitness function
classification is the type of initial solution, i.e., that measures the fitness of each particle, which varies
multiple or single solution-based. Multiple solution- according to the problem. Each particle also keeps
based algorithms are usually called population-based, track of its past best position (pbest) and the best
while single solution-based algorithms are called position in the swarm (gbest). The particles move
trajectory-based [9]. Classifying metaheuristic towards the optimal solution by continuously
optimization algorithms according to the source of updating pbest and gbest. Finally, when the optimal
inspiration is usually classified as human, solution is obtained, the solution is achieved [11]. The
evolutionary, swarm logic, or science-based. PSO, steps that the particle swarm optimization algorithm
takes to solve a problem are shown in Figure 8 as a
flowchart.
197
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
198
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
optimization problems. The biggest difference from similarities of the solution candidates and keeps the
other optimization algorithms is that it is parameter- best solution.
free. In other words, it does not need any additional
parameters other than parameters such as population
size, and maximum iteration. Thanks to this feature, 3. Results and Discussion
it overcomes challenging problems. The algorithm There are six controller parameters in total for the
starts optimization by initially generating random realized two-legged robot arm. Particle swarm,
search candidates, and this initialization process is artificial bee colony, and chaos game optimization
performed depending on the population size, the algorithms were used to find the most suitable values
number of decision variables, and the bounds of the of these parameters. The simulation results obtained
solution space [15]. More details about the CGO from each metaheuristic optimization algorithm are
compared. As a result of the simulation process, the
algorithm are given in Figure 10 as a flowchart.
controller parameters found for trajectory tracking in
the real robot arm are specified.
In all three simulations, the maximum
number of function evaluations was carried out at 40
and the number of populations at 50 in order to
perform the most appropriate tracking of the square
trajectory for the robot arm. The social and cognitive
constants of the PSO algorithm were determined to be
2, and the inertia weight was determined to be [0.9,
0.4] [7]. The limit value for the ABC is determined to
be 100. These coefficients were used at the same
values for each step throughout the study. If we put
the PID parameters in order
𝑘𝑝1 , 𝑘𝑖1 , 𝑘𝑑1 , 𝑘𝑝2 , 𝑘𝑖2 , 𝑘𝑑2 limit [0 0 0 0 0 0], and
upper limit [20,000 15,000 18,000 20,000 15,000
18,000]. The simulation results obtained as a result of
the optimization process for frame motion tracking
are shown in Figures 11 for the chaos game, 12 for the
particle swarm, and 13 for the artificial bee colony.
It is clearly seen in Figure 8, Figure 9, and
Figure 10 that CGO and ABC algorithms give better
results than PSO algorithms. The ABC and CGO
algorithms gave similar results. Figure 14 shows that
the CGO algorithm gives better results than the ABC
algorithm. In Figure 14, (A) is a close view of CGO,
and (B) is a close view of the ABC algorithm at the
point (8,14) forming the square. It is noted that CGO
is closer to the reference value of red dots than ABC.
Figure 10. Flowchart of Chaos game optimization
In the simulation environment, all three algorithms
algorithm flowchart [16]. gave successful results, but CGO gave better results
with differences. For this problem, each algorithm is
In the CGO algorithm, the success of each successful but the best ranking is CGO, ABC, and
solution constitutes the individual performance of the PSO. The reason for this is the parameters in the PSO
algorithm. The CGO algorithm tries to find the best and ABC algorithms, and it is thought that the CGO
solution by randomly moving each solution candidate algorithm is more successful in generating new
on a fractal structure. While solving the optimization values.
problem, the CGO algorithm compares the
199
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
200
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
Mean Square Error (MSE) and Root Mean and 𝜃2 that make up the two-limbed robot arm. The
Squared Error (RMSE) were used to compare the MSE and RMSE values obtained by CGO, PSO, and
error parts of the optimization process of the angles 𝜃1 ABC are given in Table 2.
Table 2. MSE and RMSE error metrics of CGO, PSO, and ABC algorithms for reference tracking.
𝜃1 angle 𝜃2 angle
MSE RMSE MSE RMSE
CGO 32.33 5.68 154.38 12.42
PSO 58.98 7.67 238.79 15.45
YAKA 32.74 5.72 155.36 12.46
As a result of the optimization process, six were obtained for each optimization algorithm. The
optimization parameters 𝑘𝑝1 , 𝑘𝑖1 ,𝑘𝑑1 ,𝑘𝑝2 ,𝑘𝑖2 ,𝑘𝑑2 PID parameters found are given in Table 3.
Each metaheuristic optimization algorithm, has been tested separately on the real system. Table 2
CGO, PSO, and ABC, which determines the PID shows the differences in the controller parameters
parameters obtained as a result of the simulation obtained by the CGO, PSO, and ABC algorithms.
performed on the robot arm controlled in real time These differences come from the structure of the
thanks to the Simulink support package for Arduino, optimization algorithms.
201
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
The angle value that each motor should make given in Figure 15 (a) for 𝜃1 and Figure 15 (b) for
for 8 seconds in order for the two-limbed robot arm to 𝜃2 for the CGO algorithm, Figure 16 (a) for 𝜃1 and
perform the reference motion is given in Figure 7. The Figure 16 (b) for 𝜃2 for the PSO algorithm, Figure 17
results obtained by realizing the PID controller (a) for 𝜃1 , and Figure 17 (b) for 𝜃2 for the ABC
parameters specified in Table 2 on the real system are algorithm.
Figure 15. Reference tracking of PID parameters obtained by CGO for square orbit at angle.
(a) θ1 (b) θ2 .
Figure 16. Reference tracking of PID parameters obtained by PSO for square orbit at angle (a) θ1 (b) θ2 .
Figure 17. Reference tracking of PID parameters obtained by ABC for square orbit at angle (a) θ1 (b) θ2 .
202
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
203
S. Müftü, B. Gökçe / BEU Fen Bilimleri Dergisi 13 (1), 192-204, 2024
References
204