Adaptive Intelligent Systems applied to two-wheeled robot and the effect of different terrains on performance

A R T I C L E I N F O A B S T R A C T Article history: Received : 26 November, 2016 Accepted : 22 December, 2016 Online : 28 January, 2017 This work discuss two different intelligent controllers: Online Neuro Fuzzy Controller (ONFC) and Proportional-Integral-Derivative Neural Network (PID-NN). They were applied to maintain the equilibrium and to control the position of a two-wheeled robot prototype. Experiments were carried out to investigate the equilibrium control and movement of the two-wheeled robot first on flat terrain, then in other situations, where terrain may not be flat, horizontal surface. The effectiveness of each controller was verified by experimental results, and the performance was compared with conventional PID control scheme applied for the prototype.


Introduction
Two-wheeled robots have some advantages over other types of mobile robots. The wheel configuration makes them highly maneuverable and still easier to control than legged robots. Having no more than two wheels means more room for larger wheels, potentially allowing them to traverse rougher terrain. In the last decade, auto-balance two-wheeled robots have been intensively discussed [1], [2], [3].
The dynamics of two-wheeled robots have some particular features which complicate their control. Specifically, they are non-minimum phase, under-actuated and also unstable in open loop. Therefore, robust mechanisms of auto-balance are very important to these dynamics systems, requiring proper control based techniques based on suitable sensing.
Many controller designs have been investigated for the autobalance two-wheeled robot [4]. Proportional-Integral-Derivative (PID) controllers are widely used in many areas in industry, because no model of the plant is required, with tuning of just three gains [5]. However the purpose of an intelligent control method is to minimize the stress of control applied for complex plants.
The hybrid systems based on fuzzy logic have demonstrated their capacity of resolve several types of problems in many applications, as in robotic. Using one algorithm based on the gradient descent method, with a cost function using only the error signal, is possible to obtain one controller with good performance, [6], [7]. An important example is the ONFC controller (Online Neuro Fuzzy Controller) [8], which represents one structure with three synaptic weights.
Also, artificial neural networks (ANN) are commonly used as a strategy of adaptive control for auto-balance two-wheeled robots. The algorithm executes the learning process of neural network, where the synaptic weights are adjusted, during the execution of the network as the goal to reach the desired result [9]. The equilibrium will be improved during the neural network learning process.
Moreover, for outdoor applications the robot should also be able to stabilize on inclined or uneven terrain. This invites researchers to design controllers for the control of the stability of two-wheeled robots on inclined terrain at the desired speeds and implemented in real time.
The proposal of this work is to implement intelligent algorithms to control an auto-balance two-wheeled robotic system that can be able to move in terrains with some irregularity.  Figure 1 shows the structure of an two-wheeled robot where m 1 [kg] is the mass of each wheel; m 2 [kg] is the mass of the body; Ι 1 [kgm 2 ] is the inertial moment of the wheel in relation to the gravity center; Ι 2 [kgm 2 ] is the inertial moment of the body in relation to the gravity center; r [m] is the wheel radius; L [m] is the distance of the mass center of body to axis rotation of wheel; τ 1 [Nm] is the wheel torque and τ 2 [Nm] is the body torque; θ 1 is the rotation angle of each wheel in degrees; θ 2 is the inclination angle of the body in degrees. Figure 1: Autobalance diagram of a two-wheeled robot [10] Based on Newton's equations of motion, the dynamic modeling of the robot is described by

Controller Design
The primary objective in the control of two-wheeled robots is always to remain balanced and avoid toppling. Secondary objectives may include tracking a certain speed or trajectory.
In the prototype, there were implemented the balance and position control. For the balance control all variables are subtracted of the desired reference value. Therefore, null vector is the condition of auto-balance:

Online Neuro Fuzzy Control
Reference [3] presents the Online Neuro Fuzzy Control (ONFC) to the implementation of the online algorithm. Figure 3 shows one block diagram of the generic system using the ONFC control and its internal structure. The ONFC control uses only three membership functions (triangular and complementary) as it can be seen in Figure 4. For all values in the universe of discourse, the sum of the three membership functions μ p , μ z and μ n should be equal to (5).
The control output, u, is defined based on Sugeno model of zero order. Since the membership functions are complements, the output can be written as: If the error is limited and zero average, the weight w z will be limited through of cost function. The same is not valid to the weights w n and w p , that could be unlimited for any disturbance signal in the error or for intermittent variations of the reference.
The update of weights is realized by gradient descent defined by the following cost function, J, described by (7) = where n is the discrete time, e is the error between the desired and obtained signal of the system and γ is one factor between 0 and 1 and will determine the decay rate of the weights adjusted according to the plant used.
Through this cost function, it´s possible to obtain the equations (8) to perform the update of the weights in order to minimize

Artificial Neural-Networks Control
The Proportional-Integral-Derivative Neural-Networks (PID-NN) controller [4] is based on the discrete equation model of the transfer function of the PID control.
First, the PID-NN is trained off-line and the data are generated by one simulated PID system and used for training the neural network. The learning is supervised and the desired goal is to minimize the sum of the squared errors, E sq , of the trained data.
Combining the equations of the discrete time PID controller, we can obtain one recurrent neural network ( Figure 6). The input of network is the error signal e(n) and the output of the control signal is u(n). Activation functions of the neurons are linear. The After the off-line training, the PID-NN is combined in series with the system for online tuning, as observed in Figure 7. In this form of learning, the update of the weights is done before the presentation of each example of training. The difference between the response of the output of the plant and the reference signal generates the error e 1 that will be the input signal of the controller. The error e 2 is generated by difference between the response of the output of the plant and the response of the reference of the model. This signal is directly related with the update of the online weights.
According to the method of gradient descent, the weights update follows the equations:  Figure 8 shows the robot system used in the experiments. The hardware of whole system includes a microcontroller (AT91SAM7S256), gyro sensor (NGY1044), ultrasonic sensor, servomotors and structural support parts. Although the system has ultrasonic sensor it was not used in these experiments at this moment. Table 1 shows the gains of the Proportional-Integral-Derivative (PID) control of the two-wheeled robot based on the Ziegler-Nichols method. These results will be necessary to compare the performance of the other controllers.

PID Control
The experimental tests have shown that K d gain needs to be reduced to 0.000504 to ensure system stability. The proportional gain K pos to position control was obtained by trial and error. The best value found was K pos = 0.495.

Computational Model
The simulation platform of the two-wheeled robot was developed in the MatLab-Simulink software. The computational model was validated to reproduce the same response of the autobalance two-wheeled robot during its operation in the real world. The correlations between the simulated and experimental results were satisfactory considering the nonlinearity of the system.

ONFC Control Implementation
To evaluate the effectiveness of the proposed architecture, the proposed ONFC controller is implemented and equipped in the two-wheeled robot. The proposed control laws are represented in equations (5)(6)(7)(8). To tune the ONFC control, several real experiments in the two-wheeled robot NXT was realized to evaluate the effect of the following parameters: learning rate α, regularization rate γ, and the universe of discourse of the membership functions. The best parameter values found were: α=0.05 and γ=0.005. The best universe of discourse of the membership functions was -100 to +100. In Figure 9 it is possible to observe the update of the weights through time for these parameters. The addition of regularization ensures a satisfactory performance.

PID-NN Control Implementation
In order to evaluate the proposed algorithm, it was simulated on the Simulink. In this simulation platform several experiments were realized to obtain the best parameter values. The proposed control laws are represented in equations (9)(10)(11)(12)(13)(14)(15)(16)(17). Considering the learning rate value α 1 =1.0*10 -7 , the average weight of the gains obtained to the online and off-line training could be defined in Table 2. The implementation of the online training was developed in Simulink software.

Controllers Performance
The performance of each controlled system was observed for its 1. Stationary balancing on a horizontal flat surface, Balancing during motion at a desired speed on a horizontal flat surface, and 3. Balancing during motion at a desired speed on inclined surface, 10 degrees.
The initial valures of inclination angle were assumed zero and the desired speed were set to be 10% of the maximum velocity.
The results indicate that the increase in speed and terrain inclination unfavourably affects the performance of the speed control. Figure 10 shows the range of the oscillation of the inclination angle of figure 10 (a) is smaller than plot 10 (b) and 10 (c). Then the error stays close to null value (θ 2 =0 o ). To quantify the analysis of controllers some comparisons among the integral of plots in Figure 10 is showed in Table 3.
Through this calculus get the error between the function of curve and the zero value (equilibrium point). If the value is smaller so the error is smaller. In the case of ONFC, the mean square error in 1200 seconds of the test was of the 0.0172 while for the same interval the PID controller means square error was of the 0.276. Therefore the ONFC control is more stable and it has a better performance for the two-wheeled robot.

Conclusion
The ONFC and PID-NN controllers are developed for a twowheeled robot prototype and they are successfully applied to control the equilibrium of the two-wheeled robot. Compared with conventional PID control schemes, the intelligent controls present better performance, which was verified by experiments. It was verified the effects of terrain inclination in real experiment. The design of such controllers shows versatility, simplicity, improved performance and robustness.