PDA

View Full Version : inverse pendulum on a cart


runway
12-29-2005, 03:32 PM
Dear colleagues,

I am trying to program a java application which should demonstrate
the control of the inverse pendulum on a cart using a complex of two
neural
networks using two-stage learning process. The problem is keeping the
balance
of the rod of the pendulum.

I have found this web site which thorougly describes the problem of the
inverse
pendulum on a cart:

http://gershwin.ens.fr/vdaniel/Doc-Locale/Cours-Mirrored/Methodes-Maths/white/sdyn/s7/s7invp1/s7invp1.html
http://gershwin.ens.fr/vdaniel/Doc-Locale/Cours-Mirrored/Methodes-Maths/white/sdyn/s7/s7invp2/s7invp2.html

Equations (7.64) and (7.65) should give a complete state space
representation
of the nonlinear inverted pendulum.

Equations (7.55) and (7.57)

m*x''*cos(theta) + m*l*theta'' = m*g*sin(theta) (7.57)
(M+m)*x'' - m*l*sin(theta)*(theta')^2 + m*l*cos(theta)*theta'' = u (7.55)

define this system according to the figure.

I've managed to derive those equations but I don't know at all how to
use them to compute what force must I apply to the cart in order to keep the balance of the pendulum when theta != 0. (non zero - then the pendulim is not balanced).

Is there any method to solve those equations when initial conditions are given?

What force 'u' do I need to apply to the cart when the angle between the axis perpendicular to the cart and the rod of the pendulum is theta?

Thank you for any hints.

Tomas Selnekovic

stonebro
03-16-2007, 04:02 AM
I'm inclined to ask what you know about control theory. Controlling a system as susceptible to noise and fluctuations as a cart / inverted pendulum is normally fairly hard to pull off.

One possible solution I see is to control the cart using f.ex. a DC motor that can pull in both directions. One possible setup is to have the cart/pendulum on a tabletop, connected at both ends to a DC motor through some pulleys such that the motor can pull the cart in both directions.

To control the system, add the equation for a (f.ex.) current-controlled DC motor to the model;

J_m * d^2/dt^2(theta_m) = K_t * u - T_L

Where J_m is the inertia of the motor, theta_m is the motor angle, u the current input, K_T some torque constant that depends on the motor used, and T_L the load torque caused by the cart.

If the radius of the pulley is r, then we have T_L = r*F as long as the pulley is fixed with respect to the motor axis. Furthermore we should in that case also get d/dt(x) = r*d/dt(theta_m), which can be inserted into the motor model above to yield:

J_m/r^2*d^2/dt^2(x) = K_t/r*u - F

This means that the cart->motor equations are now compatible so you can insert the model you showed the derivation of to get

(m + m_b)*d^2/dt^2(x) + m_b*L_b*cos(theta_b*d^2/dt^2(theta_b)) - m_b*(d/dt(theta_b))^2*L_b*sin(theta_b) = K_t/r*u

and

m_b*L_b^2*d^2/dt^2(theta_b) + m_b*L_b*d^2/dt^2(x)*cos(theta_b) = m_b*L_b*g*sin(theta_b).

The two equations above relate the cart/pendulum to the DC motor which is controlled by the input u = I, or the current supplied. There is no general way of computing what I should be for all theta as far as I know, so in order to actually control and stabilize the system you need to design some sort of controller, see the opening statement.