how to control the cart position in the inverted pendulum?

34 views (last 30 days)
this is a great tutorial for inverted pendulum study. but using the pid controller, the cart moves with the constant velocity in one direction. but practically we would like the cart to stay with in some range. also practically , we could move the cart in both directions(+ve and -ve x axis) with the help of motors.so how could be implement this system to make the cart stay within certain boundary limits given that cart could move in both directions? plz help out. thanks!

Accepted Answer

Mischa Kim
Mischa Kim on 20 Jan 2014
Edited: Mischa Kim on 20 Jan 2014
There are a couple of questions in your post.
Essentially, when you are deriving the linearized equations of motion (EOM) you do so around an operating point (also called trim point). If you want the cart to stay in place you trim around ve = 0. If, on the other hand, you are interested in linearizing about a constant velocity you trim around ve = c1 (move forward) or ve = -c2 (move backward), c1 and c2 being positive constants.
Note, that the parameters of the PID controller depend on the trim point. Therefore, in general, you will get different controllers for the three scenarios described above. Especially, when using your PID controllers on the non-linear system, they will only work in a bounded region around the trim points.
One way you could implement a moving cart within bounds is to prescribe a particular path. In other words, you'd define a desired position and velocity as a function of time, x_des(t) and y_des(t), and switch between the different PID controllers depending on whether the cart is stationary or moving.

More Answers (5)

ragesh r menon
ragesh r menon on 31 Mar 2014
Hi there, This is a bench mark problem in control engineering why because
1)system is nonlinear (not a big deal as almost all practical systems are)
2)system identification of the pendulum in upright position is difficult because the system itself is unstable
3)there are two variables (cart position and pendulum position) to be controlled with only one input(force applied with the help of a motor)
So in order to do both, you need two different controllers. One PID control to control the upright position of the pendulum and another PID control so that the cart movement is limited within the specified rail limit. Note that the designed PID controllers will work only in the neighbourhood of your "trim". Also this controller may get destabilized with high disturbances (do this by intentionally giving a push to the pendulum when it is in upright);(as the disturbance increases, the pendulum falls down and to counter this the cart needs to run to max limit of the rail activating the limit switch designed for protection and the motor gets switched off). This model is fine for your purpose of designing a PID loop. And to further refine the mathematical model you can also add a coefficient of friction for pendulum (b*thetadot). For better control design an LQR controller (full state feedback) and see the difference.

apps download
apps download on 20 Jan 2014
thank you but i'm a beginner at the control system designing and yes i'm trying to make the cart stay at a place i.e ve = 0. but as according to the tutorial, it moves in only one direction, since the applied force is only in one direction.
  2 Comments
Mischa Kim
Mischa Kim on 20 Jan 2014
OK. Well in this case you'd choose as trim point ve = 0. To demonstrate that the model is working you would set the applied force equal to zero and/or replace it with some small, random disturbance force. You should see the cart zig-zaging around the stationary point.
Mischa Kim
Mischa Kim on 20 Jan 2014
[commenting on your "answer" below] Typically the (external) forces acting on a dynamical system are split up into the control force (e.g. from a PID controller) and the external, disturbance forces (e.g. wind gust). Control forces are required to counter the disturbance forces. With "applied force" I was referring to the external disturbance forces.

Sign in to comment.


apps download
apps download on 20 Jan 2014
thank you. but setting the applied force to zero, would the pid controller work? does the pid controller produce force to balance the system?

apps download
apps download on 22 Jan 2014
thanks! i really appreciate your help.
  1 Comment
apps download
apps download on 3 Mar 2014
hi there....could you please tell me how to run the simulation considering the practical factors(noises). could we use this model writing our own pid loop and adding noises in the output angle. thank you!

Sign in to comment.


JITHIN
JITHIN on 23 Apr 2015
when i tried to design swing up controller for my pendulum system based on 'energy control', the results obtained are not correct can anyone help me?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!