Bacterial foraging-optimized PID control of a two-wheeled machine with a two-directional handling mechanism
Goher and Fadlallah Robot. Biomim.
Bacterial foraging-optimized PID control of?a two-wheeled machine with?a two-directional handling mechanism
K. M. Goher 0
S. O. Fadlallah 1
0 Department of Informatics and Enabling Technologies, Lincoln University , Lincoln , New Zealand
1 Mechanical Engineering Department, Auckland University of Technology , Auckland , New Zealand
This paper presents the performance of utilizing a bacterial foraging optimization algorithm on a PID control scheme for controlling a five DOF two-wheeled robotic machine with two-directional handling mechanism. The system under investigation provides solutions for industrial robotic applications that require a limited-space working environment. The system nonlinear mathematical model, derived using Lagrangian modeling approach, is simulated in MATLAB/ Simulink? environment. Bacterial foraging-optimized PID control with decoupled nature is designed and implemented. Various working scenarios with multiple initial conditions are used to test the robustness and the system performance. Simulation results revealed the effectiveness of the bacterial foraging-optimized PID control method in improving the system performance compared to the PID control scheme.
Two-wheeled machine; Inverted pendulum; Two-directional handling; Lagrangian modeling; PID; BFO
body (IB) was developed by Goher and Tokhi . For
providing multiple lifting levels for a carried payload,
the developed machine is equipped with a linear
actuator. The previously mentioned WRM was later improved
by Almeshal et?al. . Increasing the machine?s flexibility
and workspace led to a novel five DOFs two-wheeled IP
with an extended rod.
its application to optimization, it helps in reducing the
behavior of stagnation (i.e., being trapped in a
premature solution point or local optima) often seen in such
parallel search algorithms. Table? 1 represents the main
parameters of BFO algorithm.
Table 1 BFO algorithm parameters 
This paper presents a bacterial foraging technique for
determining the optimal parameters of a PID
controller to control the stability of a five degrees-of-freedom
(DOF) two-wheeled machine (TWM) developed by
The novel 5-DOF TWM provides payload handling in
two mutually perpendicular directions while attached
to the IB. Compared to existing TWRMs, this design
increases both workspace and flexibility of two-wheeled
machines and allows them to be employed in service and
industrial robotic applications including objects
assembly and material handling. Bacterial foraging algorithm?s
potential, as illustrated in the literature, was a source of
encouragement to examine the proposed optimization
technique on the novel 5 DOF two-wheeled machine?s
controller in order to improve the system?s stability
The rest of the paper is organized as follows: ?Bacterial
foraging optimization (BFO) algorithm? section presents
an overview of the BFO algorithm and a rationale about
the implementation on various nonlinear dynamic
systems, the system description machine is presented in
?TWRM system description,? and ?System modeling?
sections present the previously developed
mathematical model using Lagrangian approach. ?Control system
design? section describes the control system design and
the implementation of bacterial foraging optimization
technique including various courses of motion and
testing of the robustness of the control approach. At last, the
main conclusions of the paper are presented in
TWRM system description
Figure? 1 illustrates the schematics diagram of the
twowheeled robotic machine (TWRM). The proposed
system consists of a chassis with center of gravity at point P1
and the mass of the linear actuators with center of gravity
at point P2. The coordinates of P1 and P2 will change as
long as the robot maneuvers away from its initial
position along the X axis. The two motors attached to each
wheel are in charge of providing the necessary torque,
?R and ?L, for controlling the TWRM. For enabling the
control strategy to maintain the two-wheeled machine?s
position at the upright position continuously, the system
is equipped with both accelerometer and gyroscope
sensors that provide multiple state variables information at
any given time. The system design provides
compactness with offering proper rooms for system electronics
and accessories. Other targeted features include a
lightweight structure without affecting the robot stiffness and
Fig. 1 System schematic diagrams
Fig. 2 TWRM courses of motion
Linear actuator I, F1
Linear actuator II, F2
Moving and picking
Extension: end effector
Reverse: end effector
Placing the object
counts on the selected subtask (i.e., picking, placing,
both tasks). As a main part of the control algorithms,
switching mechanisms are designed to define the
period of engagement of each individual actuator in
Among the diverse methods of deriving the equations of
motion, and due to the fact that it is a powerful approach,
Lagrangian modeling approach is employed to model the
TWRM. Based on the system schematic diagrams
illustrated earlier, the vehicle?s mathematical model is derived
by relating the system?s kinematics to the torques/forces
applied (details of the model derivation can be found
in the work of Goher ). The system?s mathematical
model is presented as five nonlinear-coupled differential
equations as follows:
For the vertical linear link displacement (h1):
2 m2 2g cos ? ? 2h1??2 ? 4h? 2?? ? 2h2?? + 2h? 1
For the horizontal link displacement (h2):
2 m2 2g sin ? + 2h2??2 ? 4h? 1?? ? 2h1?? ? 2h? 2
2 ??R + 2 ??L ? l??2 sin ? + l?? cos ?
+ 2mw??R + 2Jw ?R2 = ?R ? ?w
+ ?? J1 + J2 + m1l2 + m2h22 + m2h1
Table 3 System simulation parameters
Mass of the chassis
Mass of the linear actuators
Mass of wheel
Distance of chassis?s center of mass for
Rotation inertia of chassis
Rotation inertia of moving mass
Rotation inertia of a wheel
Coefficient of friction between chassis
Coefficient of friction between wheel 0
Coefficient of friction of vertical linear 0.3
Coefficient of friction of horizontal linear 0.3
BFO?optimized PID control design
In this part, bacterial foraging optimization technique is
applied on the system in order to optimize the PID
controller gains employed in a previous research study 
by maintaining the system in the upright position and
to counteract the disturbances occurring in different
where e(t) is the error signal in time domain.
Implementation of?BFO?PID algorithm
The behavior of the robotic machine was observed for
the tilt angle of the entire vehicle, angular displacements
Fig. 3 TWRM?s BFO-optimized PID control scheme
of the two wheels, and linear displacements of the linear
actuators using different motion scenarios.
Payload free motion (h1?=?h2?=?0)
Figure? 5a, b demonstrates the simulation results of the
system performance and inputs control signals. The
Fig. 4 Simulink? model of the BFO-optimized PID controller
Settling time (s)
Rise time (s)
Peak time (s)
Payload vertical movement only
In addition, the system stability was examined for each
BFO optimization criterion against the vertical linear
motion of its center of mass. Considering the following
initial conditions: ? = ? 5?, h1 = 0.28 m and neglecting
the effect of the horizontal linear actuators h2, Fig.?6
demonstrates outputs and inputs simulation of the system in
the case where the payload is kept fixed for a period of
12? s from the start of the simulation and then activated
to move in a vertical direction along the IB for a distance
of 10?cm before settling again at a height of around 38?cm
from the chassis of the vehicle. It is clear, since no
disturbance occurred in the stabilization condition of the IB,
that the control scheme was robust and maintained the
system?s stability against the motion of h1. Out of the five
methods, the BFO optimized by IAE performed better
than the other methods.
criterion, the system stability was affected by the
activation of the horizontal actuator and the TWRM keeps
moving instead of maintaining its position. On the other
hand, the remaining methods produce better
performance and good robust against the movement of the
Trajectory of?a 1?m straight?line motion
The system stability was examined during moving the
TWRM in a straight line for 1? m after balancing the
robot in the upside position, and the simulation results
are shown in Fig.? 9. Referring to Fig.? 9a, the control
scheme, including the five tested criterions, was
capable to counter the occurred disturbances caused by the
wheels? motors? activation at the beginning (8?s) and the
end (18?s) of the straight-line motion. As can be observed
in Fig.?9b, the maximum control effort spent for
maneuvering the system in a 1-m straight-line trajectory,
compared to the other criterions, was noted for the ITSE
method, around 1.8?N.
Control system robustness
Moreover, the system stability was examined against the
effect of disturbance forces illustrated in Fig.? 10a and
the simulation results are shown in Fig.? 10b, c. As it is
shown that disturbance force affects the system, but the
controller reacts against this force to stabilize the
system. However, the controller resulted from MSE shows
that the displacement of the system is effected with slight
change, while the other optimized controllers show
Comparison between?implementation of?PID
The boundary limits of the controller gain parameters
for each loop that were applied in MATLAB/Simulink
environment were obtained by trial and error. In this
section, the authors carry out a comparison of the
system response based on the implementation of two
approaches. The control gain parameters employed in
each control loop for the control schemes in order to
achieve a satisfactory system performance are listed in
For the following cases, payload free movement,
payload vertical movement only, payload horizontal
movement only, simultaneous horizontal and vertical motion,
and 1-m straight-line vehicle motion, Figs.?11, 12, 13, 14,
and 15 demonstrate the output results of the simulated
TWRM model and the applied control effort. It is clear,
from the previous figures, that the optimized controller
by BFO provides better performance for the system and
minimizes the applied force demanded for the TWRM
stabilization process. Observing the payload free
movement (h1? =? h2? =? 0) scenario, as an example of how the
BFO-optimized PID controller performance is better way
than the PID, Table? 6 illustrates a system performance
comparison between the previously mentioned
controllers in terms of overshoots, settling time, peak time, and
Starting with system overshoot, the BFO-optimized
PID control scheme provides better overshoot value
(27.9%), which is much less than the PID-recorded
overshoot value by almost 42%. Moving to settling
time, it is observable that by implementing the PID
control strategy the system takes around 2.3? s to
settle, which is greater than the BFO-optimized PID
control method?s settling time (0.78? s). Therefore, the
Table 5 Gain values for?different control schemes
Table 6 Comparison between? the system?s performance
using PID and?BFO
where the optimum controller values are resultant from
the IAE criterion.
in terms of performance, robustness, and instability
The upper and lower boundaries, shown in Table?5, are
associated with the BFO-optimized control scheme with
switching mechanism. Those parameters are required by
the BFO algorithm in order to calculate the optimal gain
KMG initiated the concept of two-wheeled machine with the two-directional
handling mechanism. He derived the mathematical model in the linear
and nonlinear forms. KMG simulated the system model and designed and
implemented the control approach. SOF helped in writing the final format of
the paper and analyzing and interpreting the results. Both authors read and
approved the final manuscript.
The authors of this paper would like to thank Sultan Qaboos University in
Oman for hosting the initial stage of this research.
The authors declare that they have no competing interests.
This research has been funded by Sultan Qaboos University (Oman) and
Lincoln University (NZ).
1. Lee J , Shin H , Lee S , Jung S. Mechatronics balancing control of a single-wheel inverted pendulum system using air blowers: evolution of mechatronics capstone design . Mechatronics . 2013 ; 23 ( 8 ): 926 - 32 .
2. Chinnadurai G , Ranganathan H. IOT controlled two wheel self supporting robot without external sensor . Middle-East J Sci Res (Sens Signal Process Secur) . 2015 ; 23 : 286 - 90 .
3. Goher KM , Tokhi O. Balance control of a TWRM with a dynamic payload . In: Proceedings of the 11th international conference on climbing and walking robots and the support technologies for mobile machines , Coimbra, Portugal; 2008 .
4. Almeshal A , Goher KM , Tokhi M. Dynamic modelling and stabilization of a new configuration of two-wheeled machines . Robot Auton Syst . 2013 ; 61 ( 5 ): 443 - 72 .
5. Chan R , Stol K , Halkyard C. Review of modelling and control of twowheeled robots . Annu Rev Control . 2013 ; 37 ( 1 ): 89 - 103 .
6. Olivares M , Albertos P. Linear control of the flywheel inverted pendulum . ISA Trans . 2014 ; 53 ( 5 ): 1396 - 403 .
7. Sun J , Li Z. Development and Implementation of a wheeled inverted pendulum vehicle using adaptive neural control with extreme learning machines . Cogn Comput . 2015 ; 7 ( 6 ): 740 - 52 .
8. Vinodh Kumar E , Jerome J. Robust LQR controller design for stabilizing and trajectory tracking of inverted pendulum . Proc Eng . 2013 ; 64 : 169 - 78 .
9. Kennedy J , Eberhart R. Particle swarm optimization . In: Proceedings of the IEEE international conference on neural networks , vol 4 , Perth, WA ; 1995 , p. 1942 - 48 .
10. Tamura K , Yasuda K. Primary study of spiral dynamics inspired optimization . IEEJ Trans Electr Electron Eng . 2011 ; 6 (S1): 98 - 100 .
11. Goldberg D. Genetic algorithms in search, optimization, and machine learning . Reading: Addison-Wesley ; 1989 .
12. Passino K. Biomimicry of bacterial foraging for distributed optimization and control . Proc IEEE Control Syst Mag 2002 ; 22 : 52 - 67 .
13. Supriyono H , Tokhi M. Parametric modelling approach using bacterial foraging algorithms for modelling of flexible manipulator systems . Eng Appl Artif Intell . 2012 ; 25 ( 5 ): 898 - 916 .
14. Kalaam R , Hasanien HM , Al-Durra A , Al-Wahedi K , Muyeen SM . Optimal design of cascaded control scheme for PV system using BFO algorithm . In: International conference on renewable energy research and applications (ICRERA), Palermo; 2015 , p. 907 - 12 .
15. Almeshal A , Goher K M , Alenezi M , A Almazeed, J Almatawah, Moaz M. BFA optimized intelligent controller for path following unicycle robot over irregular terrains . Int J Curr Eng Technol . 2015 ; 5 ( 2 ): 1199 - 204 .
16. Nasir A , Tokhi M , Ghani N. Novel adaptive bacterial foraging algorithms for global optimisation with application to modelling of a TRS . Expert Syst Appl . 2015 ; 42 ( 3 ): 1513 - 30 .
17. Agouri S , Tokhi M , Almeshal A , Goher KM . BFA optimisation of control parameters of a new structure two-wheeled robot on inclined surface . Paper presented at the nature-inspired mobile robotics: proceedings of the 16th international conference on climbing and walking robots and the support technologies for mobile machines , CLAWAR 2013 ; 2013 , p. 189 - 96 .
18. Nasir A , Tokhi M , Omar M , Ghani N. An improved spiral dynamic algorithm and its application to fuzzy modelling of a twin rotor system . In: 2014 world symposium on computer applications & research (WSCAR); 2014 , p. 1 - 6 .
19. Nasir A , Tokhi M , Ghani N. Novel hybrid bacterial foraging and spiral dynamics algorithms . In: 13th UK workshop on computational intelligence (UKCI) , Guildford; 2013 , p. 199 - 205 .
20. Nasir A , Tokhi M. A novel hybrid bacteria-chemotaxis spiral-dynamic algorithm with application to modelling of flexible systems . Eng Appl Artif Intell . 2014 ; 33 : 31 - 46 .
21. Almeshal A , Goher K , Nasir A , Tokhi M , Agouri S. Fuzzy logic optimized control of a novel structure two-wheeled robotic vehicle using HSDBC, SDA and BFA: a comparative study . In: 18th international conference on methods and models in automation and robotics (MMAR); 2013 , p. 656 - 61 .
22. Goher KM . A two-wheeled machine with a handling mechanism in two-different directions . Robot Biomim . 2016 ; 3 ( 17 ): 1 - 22 . doi:10.1186/ s40638- 016 - 0049 -8.
23. O'Mahony T , Downing CJ , Fatla K. Genetic algorithms for PID parameter optimisation: minimising error criteria . 2000 . http://zas.ie. pwr.wroc.pl/ kf_glas00 .pdf. Accessed 19 Mar 2017 .