Keywords: Inverted Pendulum, Neurocontroller, PD controller
1. Introduction:
Inverted pendulum application using various control methods has been a typical example for advanced control education, as well as interesting research. Control of an inverted pendulum has been considered as a fascinating, but difficult problem to solve since the system has very challenging characteristics such as nonlinearity and a single-input multi-output structure. Many successful results using the advanced control theories for balancing the inverted pendulum using a cart have been reported throughout various literatures[1,4]. Those successful results have been mainly focused on balancing the pendulum, rather than on controlling the position of the cart.
The difficulty of controlling both the angle and the position of the inverted pendulum system comes from different dynamic movement patterns of the pendulum and the cart. For example, let us consider the case that a controller for the cart tries to move toward one direction to minimize a positional error while a controller for the pendulum tries to move in the opposite direction to minimize the angle error. When this contradiction occurs, it is difficult to decide the suitable control law. This is one reason that the conventional fixed PD controller cannot control both the angle of the pendulum and the position of the cart concurrently.
Neural network based control is another good candidate for this application. In this paper, describes the design of Neurocontroller for an Inverted Pendulum using Backpropagation Neural Networks (BPNNs) and Radial Basis Function Networks (RBFNs). Neural Networks are used as auxiliary controllers to help the PD controller for the system to minimize the errors of angles and position of each axis. Two separate Neural Networks are used for controlling each axis of Inverted Pendulum. Here Neural Network is used to control both angle and position of Inverted Pendulum.
2. System structure:
The cart with an inverted pendulum is shown figure 1[2,6].

The system transfer function for both pendulum angle and Cart position are,
where,
The physical parameters of the Inverted Pendulum system are as under
Parameter
Value
Mass of the cart(M) 0.5 kg
Mass of the pendulum (m) 0.2 kg
Friction of the cart(b) 0.1 N/m/sec
Length of the pendulum(l) 0.3 m
Inertia of the pendulum(I) 0.006 kg.m2
3. Design of Neurocontroller for Inverted Pendulum system:
Here we use decoupled neural network structure for balancing Inverted Pendulum. Decoupled neural networks structure means that two separate neural networks are used for controlling each axis instead of using a single neural network. Since the structure is a more likely decoupled system, the use of two separate neural networks is suitable for eliminating any coupling effects[3].
This scheme is identical to the feedback error learning method in that it performs inverse dynamic control, but it is also different in that compensation is done without modifying pre-fixed linear controllers. This control scheme is depicted in figure 2. The basic concept of this scheme is that the NN controller acts as the inverse of the system under PD control so that the system response q tracks the desired response qd with minimal distortion. Neural networks are placed in front of the closed loop controlled system as pre-filters as seen in figure 2. Neural network outputs are added to reference trajectories. Added terms are subtracted by output signals to generate error signals e. The errors are multiplied by controller gains. Therefore, they eventually shape the reference input trajectory qr in such a way that the output error e is minimized to zero.

Same type of control Block can be used for Y axis control of Inverted Pendulum and Cart position with different values of PD controller gain. The PD gains are optimized by trial and error basis. However, gain values are small enough to maintain stability so that Neural Network is allowed to perform the most of control. We found from experiments that if the PD gains are set too large, performance is even worse. Different values of controller gains are,
kdqx = 0.8, kpqx = 6, kdpx = -0.6, kppx = 0.5 for X axis control.
kdqy = 1.4, kpqy = 8.5, kdpy = 0.95, kppy = 0.8 for Y axis control
The typical sample of training and testing data for X axis control are shown in table 1. Same types of data are used for Y axis control.
4. Experiment and Results:
The experiments for the control of Inverted Pendulum using Neural Networks are carried out by two ways.
(1) Backpropagation Neural Networks
(2) Radial Basis Function networks
4.1 Backpropagation Neural Networks:
The Neural Network structure for X axis control is shown in figure 3. A two layer feed-forward structure is used. For experiment, nine hidden unit is used. Selection of the number of hidden units is based on the trial and error. The activation function for the hidden layer is tangent hyperbolic, and for output layer is linear. Same Neural Network is used for Y axis control

For the Neural Networks Learning rate hx = 0.0011, hy = 0.001 and momentum ax =0.15, ay =0.05 are optimized. These constant values are optimized by trial and error basis[5].
To test the control network we use sixty input data(sixty different pendulum angle from –90 degree to +90 degree and sixty different cart position from –4.5 meter to+ 4.5 meter) apply to the control network and check the output. Network error plot for X axis and Y axis control of both inverted pendulum and cart position are shown in figure 4.

The outputs for given inputs for both pendulum angle and cart position are shown in figure 5.

Same way Y axis control for Inverted Pendulum angle and Cart Position is shown in figure 6.

If we combined the output from both the X axis control network and the Y axis control network then we get the location of Inverted Pendulum and Cart on X-Y plane. The result is shown in figure 7.
4.2 Radial Basis Function networks:
Radial basis networks may require more neuron then standard feed forward backpropagation networks, but often they can be designed in a fraction of time it takes to train standard feed forward network. For this networks set sum-squared error goal and
spread constant are eg=0.02 sc=0.01 respectively. Here we use same test data as we used in Backpropagation training algorithm.
Network error plot for X axis and Y axis control of both inverted pendulum and cart position are shown in figure 8.
The output result of X axis control for Inverted Pendulum angle and Cart position is shown in figure 9.



Figure 4 to 7 shows the simulation result while Backpropagation learning algorithm is used. Simulation is carried out with different inputs Pendulum angle and cart position. In all such cases Pendulum angle and Cart position lies within the desired limit.
Figure 8 to 11 shows the simulation result while Radial Basis Network is used. Simulation is carried out with same input as use in Backpropagation learning algorithm. Result shows that Radial Basis Network is more accurate than Backpropagation technique.
5.Conclusion:
The work presented in this paper describes the application of Neural Networks for the control of Inverted Pendulum problem. The technique is very effective for balancing the Inverted Pendulum on x-y plane by decoupling the X and Y axis. The neural compensator helps conventional PD controllers to control the angle of the pendulum and position of the cart simultaneously.
6. References
[1] Seul Jung, Hyun Tack Cho, ‘Decoupled Neural Network Reference Compensation Technique for a PD controlled Two Degree of freedom Inverted Pendulum’, International Journal of Control, Automation and Systems, Vol. 2, No.1, , 2004, pp. 92-98.
[2] Katsuhiko Ogata, “ Modern Control Engineering”, Person Education Pte. Ltd., , 2003, pp. 681-745.
[3] X. Dai, D. He, T. Zhang, K. Zhang, “ ANN generalized inversion for the linerisation and decoupling control of non linear system”,IEE Proc.- Control Theory Appl., Vol. 150, No. 3, 2003, pp. 267-277.
[4] S. Omatu, T. Fujinaka, M. Yoshioka, “Neuro-PID control for inverted single and double pendulums”, IEEE Conference, , 2000, pp. 2685- 2690.
[5] Jacek M. Zurda.² Introduction to Artificial Neural Systems ².Jaico publishing house, mumbai, , 2000,pp. 485-511.
[6] Bernard Fridland, “Control System Design”, Mc Graw-Hill Book Company, 1987,pp.14-57.