Professional Documents
Culture Documents
Tuning of FP-PID Controller Based On PSO Algorithm Applied To A Human Gait
Tuning of FP-PID Controller Based On PSO Algorithm Applied To A Human Gait
109
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.
the inputs of the fuzzy system, which provide from its control
bases the output that is added to θdn and produces the
precompensated value θpren (t), as shown in (6),
θpren (t) = KSn F LCn (en (t), ∆en (t)) + θdn (t). (6)
Fig. 1: The 2-DOF planar robot manipulator. The torque τ (t) supplied to the manipulator is calculated
using the conventional PID formula shown below,
Z
τ (t) = KP n e′n (t) + KDn ∆e′n (t) + KIn e′n (t)dt. (8)
τ1 = m2 l22 (θ¨1
+ θ¨2 ) + m2 l1 l2 c2 (2θ¨1 + θ¨2 ) (2)
Finally, the generated torque is processed by the plant to
+ (m1 +2 )l12 θ¨1 · · ·
calculate θ1 (t) and θ2 (t) positions for manipulator movement
− m2 l1 l2 s2 θ˙22 − 2m2 l1 l2 s2 θ˙1 θ˙2 · · · and control system feedback.
+ m2 l2 gc12 + (m1 + m2 )l1 gc1 , IV. P ROPOSED F UZZY LOGIC PRECOMPENSATOR
Fuzzy logic controllers (FLC) have been explored in con-
junction with traditional PID controllers because they offer
τ2 = m2 l1 l2 c2 θ¨1 + m2 l1 l2 s2 θ˙12 · · ·
many advantages, such as the inclusion of human expertise,
+ m2 l1 gc12 + m2 l2 (θ¨1 + θ¨2 ), (3) the fact that an exact dynamic model is not required, and the
With s2 = sin(θ2 ), c1 = cos(θ1 ), c2 = cos(θ2 ) and reduced development effort and maintenance costs. A fuzzy
c12 = cos(θ1 + θ2 ). The indices on the variables denote set is a set in which degrees of membership other than 0
the parameters of link 1 and 2 [9]. The values used for and 1 are allowed, unlike a binary set. Vague expressions can
the simulation were derived from two biomechanical data be represented by membership functions (MF), for example:
of human gait, the normal gait [10] and the stair climbing very large, large, not very large. FLCs have three main blocks:
condition [11]. We used l1 = 0.314 m, l2 = 0.425 m, m1 = Fuzzification, fuzzy inference associated with a set of rules,
5.670 kg, m2 = 2.636 kg for both datasets. and defuzzification [12]. Fig. 3 shows the block diagram.
110
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.
Fuzzy Pre-compensator PID Controller
0.5
Control output
0
1
NB NM NS Z0 PS PM PB
1 0.5 1
0 0.5
0
-0.5
0.8 -0.5
-1 -1 e
Degree of membership
0.6
0.4
Fig. 5: Surface plot MFs.
0.2
111
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.
where the position of a particle is a possible solution to the algorithm to tune them [9] and the dataset we resort to is the
problem. The following equations show the mathematical basis normal gait. Since there are two links with three parameters
of the algorithm, each, this is a 6-dimensional optimization problem. The search
space has been restricted to [0;350] for KP n and [0;50] for
(t+1) (t+1)
xij = xtij + vij , (10) KDn and KIn . The set of these values must minimize the cost
function given by (12),
inertia cognitive component social component
z }| { z }| { z }| { v
(i+1) (i) (i) (i) (i) (i) u k
vij = wvij + c1 U1j (yij − xij ) + c2 U2j (ysj − xij ) . u1 X
(11) cfan =t (θdn,k − θn,k )2 , (12)
k i=1
where i is the current iteration and vij and xij are the velocity
and position of a particle. Equation (10) represents the updates which represents the root mean square error (RMSE), i.e., the
of positions in the N -dimensional search space as a function statistical metric of the error between the desired value θdn
of velocity. The variable yij is the best individual position, and the value obtained from the plant θn . Another important
ysj is the global best position among all particles, c1 is the metric is the cfbn overshoot, which indicates how much the
cognitive coefficient, c2 is the social coefficient, and U1 and signal exceeds the desired value as below,
U2 are uniformly distributed random numbers between 0 and
1. The inertia factor w, which decreases linearly during the ||max(θn )| − |θdn ||
execution of the algorithm, is used to refine a solution during cfbn = . (13)
|θdn |
the final iterations. Equation (11) shows how these velocities
are updated as a function of the above parameters. A high The final fitness function is given by Equation (14),
c1 indicates greater confidence in the individual experience
represented by the cognitive component, and c2 expresses f itness = min q1 .cfa1 + q2 .cfb1 + q3 .cfa2 + q4 .cfb2 , (14)
greater confidence in the swarm represented by the social
component [16]. The pseudocode of the PSO is presented in Here, the weights q1 = 0.3, q2 = 0.2, q3 = 0.3, and q4 = 0.2
Algorithm 1 and consists of three steps: Evaluating and finding are assigned to the sum of the RMSE values and the overshoots
the best individual position, finding the global best position, of link 1 and 2. The values q1 and q3 are larger to ensure
and updating the parameters and particles in the search space. greater significance for the RMSE metric.
B. Optimization problem formulation for FLC tuning
Algorithm 1 Particle swarm optimization algorithm
FLC adjustment is applied only to parameters KS1 and
Require: S, N, C1 , C2 , xmax , vmax , M AXiter , threshold
KS2 , since this variable is a scaling factor for the controller
Ensure: gbest and f (gbest )
output that affects precompensation. Instead of starting from
Initialization ▷ swarm startup
the initial and final points of the dataset as in PID, the robotic
while f (ys < threshold) do
manipulator is sampled point by point at each iteration to
for k = 1 to S do ▷ finding the best individual
generate a set of solutions for the entire system. For this
if f (xk ) ≤ f (yik ) then
purpose, the entire human gait dataset is used, consisting of
yik = xk
106 values for θd1 and θd2 obtained at 1.5 second intervals.
end if
Thus, in the FLC scenario, the cost function is the sum of the
end for
RSME of the individual links.
calculate ys using the S values f (yik ) ▷ best global
for k = 1 to S do ▷ update VI. R ESULTS
for j = 1 to N do To modularize the process, the settings of the FLC and
vkj = wvkj + c1 U1 (yikj − xkj ) + c2 U2 (xsj − xkj ) PID modules are independent of each other and each has
xkj = xkj + vkj its own specifics. However, the PSO parameters are used
end for in common, such as: the cognitive and social coefficients
Check bounds c1 = 2.0, c2 = 2.1 and the inertia factor w, which takes
end for values between 0.9 and 0.1, with a constant decay rate as a
end while function of the number of iterations. Sixteen experiments were
performed to statistically validate the processes.
A. Optimization problem formulation for PID tuning A. PID controller tuning
PID controllers require optimal values for their tuning The simulation consisted of 100 particles with 100 iterations
parameters, i.e., the proportional constant KP n , the integral in each experiment. The algorithm fetches the PID parameters
constant KIn , and the derivative constant KDn . However, from a set point for each link, where [3.184; 2.993] are the
since there are hardly any well-defined mathematical models initial and set points for θ1 and [0.815; 0.295] for θ2 , both
for MIMO robotic manipulators, in this work we use the PSO given in radians.
112
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.
The statistical values for the mean, median, minimum, and
1.2 -0.5
standard deviation of the cost function with respect to the 16 Database
experiments are shown in Table II. The values for the PID 1
Manipulator
-0.6
parameters for the minimum value are given in Table III.
-0.7
0.8
TABLE II: Statistics for PID tuning. -0.8
0.6
Stats Mean Median Minimum Standard deviation
-0.9
Fitness 0.460 0.461 0.460 0.001
0.4
-1
0.2
-1.1
TABLE III: PID parameters for link 1 and 2.
0 -1.2
KP 1 KD1 KI1 KP 2 KD2 KI2
338.423 49.996 45.553 336.057 44.293 44.592 -0.2 -1.3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
time(s)
After tuning, the trajectory curves of the manipulator with-
out precompensation is shown together with the normal gait Fig. 7: θ2 curve without precompensator.
dataset reference in Fig. 6 for θ1 and in Fig. 7 for θ2 shown
in blue. To validate the result with the obtained parameters,
3.3 5
the results is tested under stair climbing conditions (upstairs) Database
and shown in orange. Manipulator
4.8
3.2
4.6
3.3 5 3.1
Database
4.4
Manipulator
4.8 3
3.2
4.2
4.6
3.1 2.9
4
4.4
3 2.8
3.8
4.2
2.8
3.8 Fig. 8: θ1 curve with precompensator.
2.7 3.6
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
time(s) 1.2 -0.5
Database
Manipulator
Fig. 6: θ1 curve without precompensator. 1 -0.6
-0.7
0.8
-0.8
B. FLC tuning 0.6
-0.9
The simulation includes 20 particles and 10 iterations in
0.4
each experiment. These numbers are smaller than for PID -1
tuning because each iteration is computationally high. The 0.2
search space was [0.5;1.5] for KS1 and KS2 . -1.1
TABLE IV: Statistics for FLC tuning. Fig. 9: θ2 curve with precompensator.
113
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.
was an improvement with the addition of the fuzzy precom- dynamic control analysis of the robotic manipulators. Another
pensator. The improvement was over 50% in all conditions important point for future applications is the development of an
and even reached 73.846% for link 1 of the normal gait. embedded system for the design of the manipulator, focusing
on the implementation of the fuzzy controller in hardware, e.g.,
TABLE V: RMSE without and with precompensator. with a Field Programmable Gate Array (FPGA) to reduce the
Link/RMSE Without With Improvement % response time.
Normal gait θ1 0.130 0.034 73.846 R EFERENCES
Normal gait θ2 0.271 0.113 50.302
[1] A. Kumar and V. Kumar, “Evolving an interval type-2 fuzzy PID
Upstairs θ1 0.245 0.097 60.408 controller for the redundant robotic manipulator,” Expert Syst. Appl.,
Upstairs θ2 0.222 0.079 64.414 vol. 73, pp. 161–177, 2017.
[2] W. Sun, J.-W. Lin, S.-F. Su, N. Wang, and M. J. Er, “Reduced
adaptive fuzzy decoupling control for lower limb exoskeleton,” IEEE
Nevertheless, better results were obtained in other studies. Transactions on Cybernetics, vol. 51, no. 3, pp. 1099–1109, 2021.
For example, in [9], the author applied the multiobjective [3] J.-H. Kim, K.-C. Kim, and E. Chong, “Fuzzy precompensated PID
algorithm NSGA-II without precompensation to tune the same controllers,” IEEE Transactions on Control Systems Technology, vol. 2,
no. 4, pp. 406–411, 1994.
manipulator used in this work and obtained more satisfactory [4] “Hybridized ABC-GA optimized fractional order fuzzy pre-compensated
results in terms of approximating the manipulator trajectory FOPID control design for 2-DOF robot manipulator,” AEU - Interna-
to the one originally desired. In [4], the author also used tional Journal of Electronics and Communications, vol. 79, pp. 219–233,
2017.
the same manipulator but tuned it with the ABC-GA hybrid [5] S. Dumitru, C. Copilusi, and N. Dumitru, “A leg exoskeleton command
algorithm with precompensation and obtained better results. unit for human walking rehabilitation,” in 2018 IEEE International
Nevertheless, in both studies the desired trajectories were Conference on Automation, Quality and Testing, Robotics (AQTR), 2018,
pp. 1–6.
modeled as polynomial functions with predictable behavior. [6] Y. Yang, X. Dong, X. Liu, and D. Huang, “Robust repetitive learning-
To our knowledge, no other study has used a real human gait based trajectory tracking control for a leg exoskeleton driven by hybrid
dataset to tune a fuzzy PID controller with precompensation hydraulic system,” IEEE Access, vol. 8, pp. 27 705–27 714, 2020.
[7] M. H. Mohd Zaman, M. F. Ibrahim, and A. Moubark, “Dimensional
for a 2-DOF robotic manipulator. It is important to highlight optimization of 4-DOF robot manipulator using artificial bee colony
that the proposed precompensation approach compensates for algorithm,” in 2021 International Conference on Electrical Engineering
the lack of generalization common to PID controllers for and Informatics (ICEEI), 2021, pp. 1–4.
[8] H.-C. Huang and C.-C. Chuang, “Artificial bee colony optimization
robotic manipulators. algorithm incorporated with fuzzy theory for real-time machine learning
Despite the improvement in RMSE for both links, it was control of articulated robotic manipulators,” IEEE Access, vol. 8, pp.
found that the torque of the controller with the precompensator 192 481–192 492, 2020.
[9] H. V. Hultmann Ayala and L. dos Santos Coelho, “Tuning of PID
fluctuated several times when trying to reach the set point for controller based on a multiobjective genetic algorithm applied to a
each point, as shown in Fig. 10 for link 1, which can cause robotic manipulator,” Expert Systems with Applications, vol. 39, no. 10,
damage to the actuators of the robotic manipulator. This was pp. 8968–8974, 2012.
[10] D. A. Winter, Appendix A: Kinematic, Kinetic, and Energy Data. John
also observed in [17] and in [9]. In the latter, multiobjective Wiley Sons, Ltd, 2009, pp. 296–360.
algorithms were used to smooth the torque. [11] Y. Luo, S. Coppola, P. Dixon, S. Li, J. Dennerlein, and B. Hu, “A
database of human gait performance on irregular and uneven surfaces
collected by wearable sensors,” Scientific Data, vol. 7, p. 219, 07 2020.
[12] Z. Kovacic and S. Bogdan, Fuzzy Controller Design: Theory and
4
Applications, ser. Automation and Control Engineering. Taylor &
Without precompensator
With precompensator Francis, 2005.
2 [13] T. Romeiro de Jesus and D. M. Muñoz, “Controle fuzzy embarcado em
arquiteturas reconfiguráveis para desvio de obstáculos em sistemas de
navegação para deficientes visuais,” in Anais do Simpósio Brasileiro de
0 Automação Inteligente - SBAI, 2017, pp. 1–6.
[14] T. Romeiro de Jesus, “Arquiteturas de hardware dedicadas de con-
troladores nebulosos para auxı́lio à locomoção de deficientes visuais,”
-2 Master’s Thesis, University of Brasilia, august 2017.
[15] P. Carvalho Faria, “Arquitetura de hardware para cálculo do centroide
aplicado a defuzzificação de sistemas nebulosos com inferência do tipo
-4
Mamdani,” Undergraduate Final Report, november 2021.
[16] J. Kennedy and R. Eberhart, “Particle swarm optimization,” in Proceed-
-6 ings of ICNN’95 - International Conference on Neural Networks, vol. 4,
1995, pp. 1942–1948 vol.4.
[17] Z. Bingül and O. Karahan, “A fuzzy logic controller tuned with PSO
-8 for 2 DOF robot trajectory control,” Expert Systems with Applications,
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
vol. 38, no. 1, pp. 1017–1031, 2011.
time(s)
[18] U. Zakia, M. Moallem, and C. Menon, “PID-SMC controller for a 2-
DOF planar robot,” in 2019 International Conference on Electrical,
Fig. 10: τ1 curve with precompensator. Computer and Communication Engineering (ECCE), 2019, pp. 1–5.
114
Authorized licensed use limited to: FUDAN UNIVERSITY. Downloaded on February 25,2023 at 04:33:12 UTC from IEEE Xplore. Restrictions apply.