 Research
 Open Access
 Published:
PID, BFOoptimized PID, and PDFLC control of a twowheeled machine with twodirection handling mechanism: a comparative study
Robotics and Biomimetics volume 5, Article number: 6 (2018)
Abstract
In this paper; three control approaches are utilized in order to control the stability of a novel fivedegreesoffreedom twowheeled robotic machine designed for industrial applications that demand a limitedspace working environment. Proportional–integral–derivative (PID) control scheme, bacterial foraging optimization of PID control method, and fuzzy logic control method are applied to the wheeled machine to obtain the optimum control strategy that provides the best system stabilization performance. According to simulation results, considering multiple motion scenarios, the PID controller optimized by bacterial foraging optimization method outperformed the other two control methods in terms of minimum overshoot, rise time, and applied input forces.
Introduction
For a tremendous amount of research studies, providing the ideal control strategy for inverted pendulum (IP)based systems has been and still remains a field of interest. This can be related to the incomparable increase in the twowheeled machines (TWMs) that serves nowadays in many applications, especially in applications that demand working in bounded spaces. For these types of highly unstable nonlinear systems, divergent control approaches have been established [1]. Some of these control methods include proportional–integral–derivative (PID) control scheme, bacterial foraging optimization (BFO) of PID control method, and fuzzy logic control (FLC) method.
Proportional–integral–derivative (PID) control method
This control loop feedback mechanism has been commonly utilized in various control systems, specifically in systems that are based on the inverted pendulum principle. Ren et al. [2] presented a motion control and stability analysis study of a twowheeled vehicle (TWV). For providing a motion control system that balances the TWV and enables the vehicle to track a predefined path, a selftuning PID control strategy is proposed. By employing the same PID control approach with an observerbased state feedback control algorithm, Olivares and Albertos [3] presented and controlled an underactuated flywheel IP system. The study conducted by Wang [4] addressed in detail the issue of adjusting multiple PID controllers simultaneously for the purpose of stabilization and tracking control of three types of IPs.
Bacterial foraging optimization (BFO) algorithm
Initiated by Passino [5], bacterial foraging optimization (BFO) algorithm has been utilized in multiple research aspects and in different applications. Kalaam et al. [6] implemented BFO algorithm in a cascaded control scheme designed for controlling a gridconnected photovoltaic system. For modeling a singlelink flexible manipulator system, Supriyono and Tokhi [7] developed an adaptable chemotactic step size bacterial foraging optimization (BFO) technique. Almeshal et al. [8] utilized the BFO algorithm on a smart fuzzy logic control scheme applied on a unicycle class of differential drive robot on irregular rough terrain.
Significant research studies focused on improving the BFO algorithm’s performance. These improvements were achieved either by combining BFO with another optimization approach [9, 10] or by modifying the algorithm’s actual parameters [11].
Focusing on IPbased systems, Agouri et al. [12] developed a control scheme based on quadratic adaptive bacterial foraging algorithm (QABFA) for controlling a twowheeled robot with an extendable intermediate body (IB) moving on an inclined surface. Alrashid et al. [13] applied a constrained adaptive bacterial foraging optimization strategy for optimizing the control gains of a singlelink inverted pendulum on cart system. On the other hand, Jain et al. [14] implemented BFO algorithm in tuning a PID controller utilized in controlling an inverted pendulum system on fieldprogrammable gate array (FPGA).
Fuzzy logic control (FLC) method
Although the concept of fuzzy logic controller (FLC) was initiated in the 1960s [15], tremendous research studies applied this type of control scheme on IPbased systems because of its ability to deal with nonlinear systems, not to mention its intuitive nature. Czogała et al. [16] presented a rough fuzzy logic controller for stabilizing a pendulumcar system. As for Cheng et al. [17], their study focused on developing a FLC, with a high accuracy and resolution, for the purpose of stabilizing a double IP. On the other hand, Xu et al. [18] designed a FLC which obtains fuzzy rules from a simplified lookup table to stabilize a twowheeled inverted pendulum. For the same aim, Azizan et al. [19] proposed a smart fuzzy control scheme for twowheeled human transporter. The applied control method, when tested against different mass values that represent the transporter’s rider, revealed a high robustness. For an underactuated twowheeled inverted pendulum vehicle with an unstable suspension that is subjected to nonholonomic constraint, Yue et al. [20] developed a composite control approach that consists of a direct fuzzy controller and an adaptive sliding mode technique. Amir et al. [21], for an IP on a cart, developed an effective hybrid swingup and stabilization controller (HSSC) that consists of three controllers: swingup controller, fuzzy stabilization controller, and fuzzy switching controller. As for Yue et al. [22], their study aimed to develop an indirect adaptive fuzzy control that is based on an error databased trajectory planner for controlling a wheeled inverted pendulum vehicle. Other research studies, such as Tinkir et al. [23], focused on comparing a conventional PID controller and an interval type 2 fuzzy logic (IT2FL) control method in order to control the swingup position of a double IP.
Research objective and paper organization
In order to provide the optimal control strategy for IPbased machines and to improve their stability performance, this paper sets a comparison between three control methods: PID controller, bacterial foraging optimization of PID controller, and fuzzy logic controller applied to control and stabilize a fivedegreesoffreedom (DOF) twowheeled robotic machine (TWRM) introduced by Goher [24]. Despite the tremendous amount of control methods, the potential of the three selected approaches when it comes to dealing with highly unstable nonlinear systems such as inverted pendulums, as demonstrated in the literature, has encouraged the authors to investigate their implantation on the new fiveDOF TWRM. The developed fiveDOF twowheeled machine, compared to current TWRMs, delivers payload handling in two mutually perpendicular directions while attached to the intermediate body (IB). This feature, as a result, increases the vehicle’s flexibility and workspace and permits the employment of TWRMs in service and industrial robotic applications (i.e., material handling, objects assembly). The rest of the paper is organized as follows: "Twowheeled robotic machine system description" section demonstrates a detailed description of the fiveDOF twowheeled machine that the control approaches were implemented on. The system’s derived mathematical model is presented in "TWRM mathematical modeling" section. As for "Control system design" section, it illustrates the control system design and the implementation of the three control methods: PID controller, bacterial foraging optimization of PID controller, and fuzzy logic controller on the TWRM’s derived mathematical model. "Conclusions" section concludes the paper by highlighting the findings of the research.
Twowheeled robotic machine system description
The schematics diagram of the developed twowheeled robotic machine (TWRM) is illustrated in Fig. 1. The robotic system consists of chassis, with center of gravity at point P_{1}, and the linear actuators’ mass, with center of gravity at point P_{2}. As long as the wheeled machine maneuvers far from its initial position, along the Xaxis, P_{1} and P_{2} coordinates will vary. Each wheel has been connected to a motor that provides the substantial torque, τ_{R} and τ_{L}, needed to control the TWRM. Both accelerometer and gyroscope sensors were fit to the robotic system in order to provide the necessary state variables that enables the applied control scheme to preserve the TWRM’s position at the upright position uninterruptedly. With respect to the X and Zaxis and referring to Fig. 1, the TWRM’s five DOFs can be defined as the following:

The attached payload linear displacement in vertical direction (h_{1}).

The attached payload linear displacement in horizontal direction (h_{2}).

The angular displacement of the angular rotation of the right wheel (δ_{R}).

The angular displacement of the angular rotation of the left wheel (δ_{L}).

The tilt angle of the intermediate body around the vertical Zaxis (θ).
For a picking and placing scenario, Table 1 demonstrates the engagement of each of the wheeled machine’s actuators for each subtask, along with the DOFs associated with the corresponding process task. The reason behind the continuous activation of the TWRM wheels’ motors is due to the external disturbances taking place while performing the picking and/or placing task, as well as the center of mass’s continuous variation. Therefore, it is crucial to the wheels’ motors to develop the necessary torque signal in order to maintain the upright vertical position of the TWRM. Moving to the linear actuators, their engagement is related to the appointed subtask. Switching mechanisms are designed, as a major part of the three investigated control schemes, in order to define the period of engagement of each individual actuator in service.
TWRM mathematical modeling
The TWRM’s mathematical model, explained in detail by Goher [24], is derived by employing Lagrangian modeling approach, which is considered as one of the powerful techniques for obtaining the equations of motion for any sophisticated system. Referring to the twowheeled robotic machine’s schematics diagram in Fig. 1 and its physical parametric specifications listed in Table 2, the system’s kinematics was related to the torques/forces applied to its links and the five highly coupled differential equations of motion are represented as follows:
The developed mathematical model of the TWRM, considering the simulation parameters listed in Table 2, is simulated in MATLAB/Simulink^{®} environment, and an openloop response investigation was carried out in order to examine the behavior of the developed model. Figure 2 illustrates the system’s openloop simulation results. It is clear from the simulation results of the five targeted control variables [i.e., pitch angle (θ), vertical link displacement (h_{1}), horizontal link displacement (h_{2}), right wheel displacement (δ_{R}), and left wheel displacement (δ_{L})] that the TWRM is a nonlinear unstable system that requires a closedloop configuration in order to achieve the desired performance in terms of stabilizing the TWRM.
Control system design
This section concentrates on implementing and comparing the three control strategies (i.e., PID, bacterial foraging optimization of PID, and fuzzy logic control) for the sake of providing the optimal control strategy that improves the stability performance of the fiveDOF TWRM by controlling the system’s main variables [i.e., angle of the robot’s chassis (θ), angular position of the right wheel (δ_{R}), angular position of the left wheel (δ_{L}), linear displacement of the attached payload in vertical direction (h_{1}), linear displacements of the attached payload in horizontal direction (h_{2})].
PID control design
The strategy schematics which are based on designing a feedback control mechanism mainly consist of five control loops, for controlling the TWRM by employing PID control scheme which is demonstrated in Fig. 3. By measuring the error in the tilt angle of the IB, the angular position of the IB is controlled. Out of the five feedback control loops, two are designed in order to control the position of the object by considering the object position’s error as an input and the actuation force as an output. As for the two remaining control loops, they are designed with a view to mobilize the TWRM to follow a certain planner motion in the XY plane. For these two feedback loops, the error in the angular position of each wheel is considered as an input. Referring to Fig. 3, both the linear actuator forces (F_{1}, F_{2}) and the driving torques of the right and left wheels’ motors (τ_{R}, τ_{L}) are defined as inputs to the TWRM. In order to prevent any disturbance at the start of working as a result of lifting an object, since the TWRM is designed for the applications of picking and/or placing, two switching mechanisms are added to the system to insure the occurrence of system stability before proceeding with the object handling task and to prevent any disturbance that might affect the control effort. The mechanisms are designed in a way that the linear actuators will activate only when the TWRM’s IB reaches the stable upright position.
BFOPID control design
This part deals with employing bacterial foraging optimization technique on the fiveDOF TWRM’s PID control scheme, employed at earlier stages of this research, in order to control the vehicle by maintaining the TWRM’s IB in the upright position while counteracting the disturbances occurring due to various motion scenarios. The BFO main parameters are listed in Table 3, whereas Fig. 4 demonstrates the algorithm’s flowchart.
In applying optimization techniques, the most crucial part is to select the objective functions that will be employed to evaluate the fitness function. Using performance indices to evaluate the controlled loops’ errors, the objective functions can be created. These performance indices, that have been utilized to optimize the system’s errors, can be defined as the following:

Mean of the squared error (MSE).

Integral of time multiplied by absolute error (ITAE).

Integral of absolute magnitude of the error (IAE).

Integral of the squared error (ISE).

Integral of time multiplied by the squared error (ITSE).
Based on the study conducted by Goher and Fadlallah [25], the best optimized PID controller was the one optimized by IAE for the low percent overshoot and minimum settling time. MATLAB/Simulink model of the BFOPID control method built to control the TWRM is illustrated in Fig. 5. Table 4 lists the controller gain parameters boundary limits for each of the five control loops that are implemented in MATLAB/Simulink environment with a view to optimize these gains.
PDFLC control design
For the fiveDOF TWRM, the author propose a control scheme that consists of a robust PDlike fuzzy logic control strategy (FLC), as demonstrated in Fig. 6, with five independent control loops designed to control the vehicle for multiplemotion scenarios. Simple Mamdani fuzzy approach are implemented in the control of the twowheeled robotic machine, where the inputs are the angle and velocity and the output is multiplication factor. This factor will be multiplied with the potentiometer data and will affect the TWRM’s both right and left wheels’ velocity. The vehicle’s pitch angle and angular velocity feedback values are combined with fuzzy control, where the output is a multiplication factor that represents each wheel’s actuation values. Both the wheels’ angular velocity and the pitch angle consist of five membership functions. It is worth to mention that the steering system’s value will impact each wheel (left and right) independently but simultaneously. The multiplication factor consists of five membership functions from 0 to 1 [i.e., negative big (NB), negative small (NS), zero (Z), positive small (PS), and positive big (PB)]. The fuzzy output is multiplied with the steering value so it has two conditions for both right and left wheels. Each of the data will be combined in order to balance the vehicle’s IB while performing left and right turns. The total rules implemented to the fiveDOF TWRM are listed in Table 5.
Comparison between implementation of PID, BFOPID, and PDFLC
This section carries out a system response comparison, for various motion scenarios, between the three implemented control methods: PID controller, bacterial foragingoptimized PID controller, and PDlike fuzzy logic controller. Table 6 lists the control gain parameters utilized in each control loop for the three control methods with a view to attain a satisfactory system performance.
Figures 7, 8, 9, 10, and 11 illustrates the twowheeled robotic machine mathematical model simulation output results, including the applied control effort, for five different case scenarios: payload free movement, payload vertical movement only, payload horizontal movement only, simultaneous horizontal and vertical motion, and 1m straight line vehicle motion. As visualized in the previous figures, the BFOPID control scheme has a superior performance and optimized behavior compared to the PID and PDlike FLC control methods. It is also observable that the optimized controller by BFO algorithm reduces the applied input forces required to stabilize the robotic machine.
Taking the first motion scenario of payload free movement (h_{1} = h_{2} = 0) (Fig. 7) as an example, Table 7 lists a performance comparison between PID, PIDBFO, and PDFLC control methods characterized by percentage overshoot, settling, rise, and peak times. Beginning with the system’s percentage overshoot, the PID controller optimized by bacterial foraging algorithm gives better overshoot value (27.9%), which is much lower than the recorded overshoot values for both PID and PDlike FLC control schemes, 48.1% and 38.6%, respectively. As for the system’s settling time, the control strategy which is based on PIDBFO settles the vehicle in 0.78 s, which is three times less than the PID control method’s settling time (2.287 s) and two times less than the PDFLC scheme (1.441 s). Moving to rise time values, the best result is given by PDFLC (0.217 s), followed by BFOPID method (0.23 s), and finally PID control scheme (0.2790 s). It can be seen that the rise time values are almost the same for all methods with small difference between them. As for peak time values, the PID controller has the highest peak value (0.5710 s), where the PDFLC method value is the lowest but almost the same as the BFO scheme (0.4 s).
A phenomenon has been noticed in the scenarios of payload horizontal movement only case (Fig. 9) and the simultaneous horizontal and vertical motion case (Fig. 10). The TWRM’s stability was disturbed by the horizontal actuator’s activation, and the vehicle continues maneuvering instead of maintaining its initial position. This issue was only compensated by the BFoptimized PID controller, where it produced a satisfactory performance and robustness against the disturbance excited by the horizontal actuator’s activation.
Investigating real path trajectory with payload mass
Since the TWRM is developed to be employed in industrial applications, Fig. 12 demonstrates the application where the robot will be used to manoeuver in a straight line and then activates both vertical and horizontal actuators in order to pick an object and return it to its initial position. As can be seen in Fig. 12a, the robot starts moving in straight line after achieving stabilization and the controllers act to maintain the robot’s stability. At the time the robot handles the load object, the stability of the system is not affected. Therefore, the controllers provide a good performance. Based on Fig. 12b, which represents the applied forces of the actuators, the PID control method consumes more forces than the forces applied by both BFOPID and PDFLC.
Control system robustness investigation
For the three proposed control methods, the TWRM stability was tested against the impact of disturbance force shown in Fig. 13a and the system performance is illustrated in Fig. 13b, c. As can be seen for the three control approaches, the vehicle in few seconds achieved its stability region about the vertical axis. However, the BFoptimized PID control method surpassed both PID and PDFLC approaches in terms of withstanding the impact of disturbance on the vehicle wheels’ displacement (δ_{R}, δ_{L}) and the horizontal linear actuator displacement (h_{2}). Therefore, in terms of robustness and instability minimization, BFoptimized PID control approach has a superior performance.
Conclusions
Proportional–integral–derivative (PID) control scheme, bacterial foraging optimization (BFO) of PID control method, and fuzzy logic control (FLC) method have been applied on a novel fiveDOF twowheeled robotic machine (TWRM), and their performance has been compared in order to determine the optimum control strategy that provides the best stabilization performance for the system. The proposed TWRM’s nonlinear equations of motion have been derived using Lagrangian modeling approach and simulated with the assistance of MATLAB/Simulink^{®} environment. Based on the five case scenarios’ simulation results (i.e., payload free movement, payload vertical movement only, payload horizontal movement only, simultaneous horizontal and vertical motion, and 1m straight line vehicle motion), the BFOPID control scheme has a superior performance compared to the other two control methods. This performance has been reflected through the reduction in percent overshoot, rise time, and the applied input forces. The same performance was expected from the BFOPID method when the system was tested against external disturbance forces. Despite the satisfactory performance of the system using BFO technique, BFA has a slow convergence speed and longer computation time which makes the implementation unrealistic in realtime tuning for solving a complex realworld problem. In this research, only simulation scenarios have been considered and hence little concern has been considered about the limitations of BFO. Future considerations of this work will consider implementing and comparing various optimization techniques such as genetic algorithm (GA), spiral dynamics (SD), hybrid spiral dynamics bacterial chemotaxis (HSDBC), and particle swarm optimization algorithm (PSO) for optimizing the TWRM’s PID controller gains in order to improve the system’s stabilization performance. Furthermore, investigating the robustness of the system will be considered not only in the application scenario, but also in the system itself. By changing the system’s physical parametric specifications, the performance of the proposed control methods in different parameters of the system will be evaluated.
Moreover, the TWRM’s hardware model can be built and the performance of the control approaches implemented on the system will be examined against real disturbance forces for real industrial applications.
References
 1.
Chan RPM, Stol KA, Halkyard CR. Review of modelling and control of twowheeled robots. Annu Rev Control. 2013;37(1):89–103.
 2.
Ren TJ, Chen TC, Chen CJ. Motion control for a twowheeled vehicle using a selftuning PID controller. Control Eng Pract. 2008;16:365–75.
 3.
Olivares M, Albertos P. Linear control of the flywheel inverted pendulum. ISA Trans. 2014;53(5):1396–403.
 4.
Wang J. Simulation studies of inverted pendulum based on PID controllers. Simul Model Pract Theory. 2011;19(1):440–9.
 5.
Passino KM. Biomimicry of bacterial foraging for distributed optimization and control. In: Proceedings of the IEEE control system magazine; 2002. p. 52–67.
 6.
Kalaam RN, Hasanien HM, AlDurra A, AlWahedi 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.
 7.
Supriyono H, Tokhi MO. Parametric modelling approach using bacterial foraging algorithms for modelling of flexible manipulator systems. Eng Appl Artif Intell. 2012;25(5):898–916.
 8.
Almeshal A, Goher K, Alenezi MR, Almazeed A, Almatawah J, Moaz M. BFA optimized intelligent controller for path following unicycle robot over irregular terrains. Int J Curr Eng Technol. 2015;5(2):1199–204.
 9.
Nasir ANK, Tokhi MO. A novel hybrid bacteriachemotaxis spiraldynamic algorithm with application to modelling of flexible systems. Eng Appl Artif Intell. 2014;33:31–46.
 10.
Nasir ANK, Tokhi MO, Ghani NMA. Novel hybrid bacterial foraging and spiral dynamics algorithms. In: 13th UK workshop on computational intelligence (UKCI), Guildford; 2013. p. 199–205.
 11.
Nasir ANK, Tokhi MO, Ghani NMA. Novel adaptive bacterial foraging algorithms for global optimisation with application to modelling of a TRS. Expert Syst Appl. 2015;42(3):1513–30.
 12.
Agouri SA, Tokhi MO, Almeshal AM, Goher KM. BFA optimisation of control parameters of a new structure twowheeled robot on inclined surface. In: Paper presented at the natureinspired 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.
 13.
Alrashid N, Alfarsi Y, AlKhudhier H. Application of constrained quadratic adaptive bacterial foraging optimisation algorithm on a single link inverted pendulum. Int J Curr Eng Technol. 2015;5(5):3301–4.
 14.
Jain T, Patel V, Nigam MJ. Implementation of PID controlled SIMO process on FPGA using bacterial foraging for optimal performance. Int J Comput Electr Eng. 2009;1(2):107–10.
 15.
Zadeh LA. Fuzzy sets. Inf Control. 1965;8:353–83.
 16.
Czogała E, Mrózekb A, Pawlakc Z. The idea of a rough fuzzy controller and its application to the stabilization of a pendulumcar system. Fuzzy Sets Syst. 1995;72:61–73.
 17.
Cheng F, Zhong G, Li Y, Xu Z. Fuzzy control of a double inverted pendulum. Fuzzy Sets Syst. 1996;79:315–21.
 18.
Xu J, Guo Z, Heng T. Synthesized design of a fuzzy logic controller for an underactuated unicycle. Fuzzy Sets Syst. 2012;207:77–93.
 19.
Azizan H, Jafarinasab M, Behbahani S, Danesh M. Fuzzy control based on LMI approach and fuzzy interpretation of the rider input for two wheeled balancing human transporter. In: Proceeding of the 8th IEEE international conference on control and automation (ICCA); 2010. p. 192–7.
 20.
Yue M, Wang S, Sun JZ. Simultaneous balancing and trajectory tracking control for twowheeled inverted pendulum vehicles: a composite control approach. Neurocomputing. 2016;191:44–54.
 21.
Amir D, Chefranov AG. An effective hybrid swingup and stabilization controller for the inverted pendulumcart system. In: IEEE international conference on automation quality and testing robotics (AQTR); 2010. p. 1–6.
 22.
Yue M, An C, Du Y, Sun J. Indirect adaptive fuzzy control for a nonholonomic/underactuated wheeled inverted pendulum vehicle based on a datadriven trajectory planner. Fuzzy Sets Syst. 2016;290:158–77.
 23.
Tinkir M, Onen U, Kalyoncu M, Botsali FM. PID and interval type2 fuzzy logic control of double inverted pendulum system. In: The 2nd international conference on computer and automation engineering (ICCAE); 2010, p. 117–21.
 24.
Goher KM. A twowheeled machine with a handling mechanism in two different directions. Robot Biomim. 2016;3(17):1–22.
 25.
Goher KM, Fadlallah SO. Bacterial foragingoptimized PID control of a twowheeled machine with a twodirectional handling mechanism. Robot Biomim. 2017;4(1):1.
Authors’ contributions
KMG initiated the concept of twowheeled machine with the twodirection 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. SOF also led the work during the revision process and responded to the reviewer’s comments. Both authors read and approved the final manuscript.
Acknowledgements
The authors of this paper would like to thank the University of Lincoln for offering the funding support for this publication.
Competing interests
The authors declare that they have no competing interests.
Funding
This research has been funded by Sultan Qaboos University (Oman) for the simulation studies and the University of Lincoln (UK) for publication charges.
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Author information
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
About this article
Cite this article
Goher, K.M., Fadlallah, S.O. PID, BFOoptimized PID, and PDFLC control of a twowheeled machine with twodirection handling mechanism: a comparative study. Robot. Biomim. 5, 6 (2018). https://doi.org/10.1186/s4063801800893
Received:
Accepted:
Published:
Keywords
 Inverted pendulum
 Twowheeled machine
 Twodirection handling
 PID
 BFO
 FLC