# inverted pendulum

• posted

Hi I am working on a project on inverted pendulum. I have to control pendulum rotation as well as cart position within given specifications. I am using Matlab/Simulink and am designing as a single input-multiple output system. I am able to control pendulum angle but not the cart position. Has anybody worked on similar problem?

Any input will be of great help!

Regards,

Shashikant

• posted

Hi,

If you're using the cart position (or velocity) alone as the control input, then by definition you can't control the cart position! You'll need to find another input. Have a look at the examples in the Matlab demos.

Pramit

• posted

Are you sure you've got the assignment described correctly? You have to measure both cart position and pendulum angle to make this work, and that represents a two input system. If, for example, you only measure cart position and don't know what the pendulum angle is, you don't have a chance of keeping it balanced. dave y.

• posted

Check at first controllability and observabillity of the system :)

• posted

It is definitely possible (at least in theory...) to control both cart position and stabilize upright position of the pendulumm using force on cart as (single) input. This is done in numerous published articles. One that springs to mind, is

@article {Ata99, AUTHOR = {Atassi, Ahmad N. and Khalil, Hassan K.}, TITLE = {A separation principle for the stabilization of a class of nonlinear systems}, JOURNAL = {IEEE Trans. Aut. Control}, FJOURNAL = {Institute of Electrical and Electronics Engineers. Transactions on Automatic Control}, VOLUME = {44}, YEAR = {1999}, NUMBER = {9}, PAGES = {1672--1687}, ISSN = {0018-9286}, }

• posted

Tell you what, why don't you assume just a tiny bit of noise in the system and then tell me you can do this. In the meantime, just to experiment with the concept of open loop a bit, the next time you're driving down the x-way, why don't you point the car straight down the road, then take your hands off the wheel and close your eyes. You can use the time remaining to contemplate the merits of your position (at least in theory).

• posted

Thank you Group! for your input.

What I mean by a single input is that we have one actuator connected to the cart. While all of the following can be sensed for feedback: position, velocity of cart; and angle and angular velocity of the inverted pendulum.

I approached the problem following way:

1) Linearized the non-linear equations of motion. Assumed cart position and angle of the pendulum to be available for feedback.

2) Got transfer function x/f and a/f where, f is force, x is cart displ and a is angle.

3) Because of linearization we have got pole-zero cancellation by the system. Below are the TFs: 1.6 s^2 - 40 x/f= ----------------------------- zeros at -5 and 5 s^4 + 0.16 s^3 - 40 s^2 - 4 s 4 s^2 a/f= ------------------------- zeros at 0, 0 s^4 + 0.16 s^3 - 40 s^2 - 4 s poles at 0 -0.1 -6.3 6.3

4) Please observe that the system has non-minium phase zeros and has unstable poles.

5) I am using cascaded controller with inner loop for pendulum and outer loop for cart position.

6) I can stabilize the inner loop (i.e. pendulum angle) using lead and lag compensator with angle as feedback.

7) I am also able to get stable open loop (for complete system) with feedback from both, angle and position. However, position feedback is making inner loop unstable (Note: inner loop is initially designed with feedback from angle only)

8) I am using rltool/SISO tool in matlab for design purpose.

I am trying hard to get solution to the problem. This is my first exposure to control. Any input for any of the steps above would be of great help.

I checked controllability and observability in matlab. The system is controllable and observable (matlab returns rank=4 for both). I looked into the IEEE paper, most part of it is Greek and Latin for me.

Regards,

|Tell you what, why don't you assume just a tiny bit of noise in the |system and then tell me you can do this. In the meantime, just to |experiment with the concept of open loop a bit, the next time you're |driving down the x-way, why don't you point the car straight down |the road, then take your hands off the wheel and close your eyes. |You can use the time remaining to contemplate the merits of your |position (at least in theory). | | |On 14 Nov 2003 10:08:12 +0100, Lars Imsland |wrote: | |>dave y. writes: |>

|>> Are you sure you've got the assignment described correctly? You have |>> to measure both cart position and pendulum angle to make this work, |>> and that represents a two input system. If, for example, you only |>> measure cart position and don't know what the pendulum angle is, you |>> don't have a chance of keeping it balanced. |>

|>It is definitely possible (at least in theory...) to control both cart |>position and stabilize upright position of the pendulumm using force |>on cart as (single) input. This is done in numerous published |>articles. One that springs to mind, is |>

|>@article {Ata99, |> AUTHOR = {Atassi, Ahmad N. and Khalil, Hassan K.}, |> TITLE = {A separation principle for the stabilization of a class of |> nonlinear systems}, |> JOURNAL = {IEEE Trans. Aut. Control}, |> FJOURNAL = {Institute of Electrical and Electronics Engineers. |> Transactions on Automatic Control}, |> VOLUME = {44}, |> YEAR = {1999}, |> NUMBER = {9}, |> PAGES = {1672--1687}, |> ISSN = {0018-9286}, |>} |>

|>> On Mon, 10 Nov 2003 23:53:47 -0600, Shashikant N Sarada |>> wrote: |>> |>> >Hi |>> >I am working on a project on inverted pendulum. I have to control pendulum |>> >rotation as well as cart position within given specifications. I am using |>> >Matlab/Simulink and am designing as a single input-multiple output system. |>> >I am able to control pendulum angle but not the cart position. Has |>> >anybody worked on similar problem? |>> >

|>> >Any input will be of great help! |>> >

|>> >Regards, |>> >

|>> >Shashikant | | |

• posted

Then your system has one OUTPUT (cart acceleration) and two inputs (cart position and pendulum angle). This problem has a solution -- circus performers do it all the time. I'm trying it at my desk with a ruler but I'm having a bit of a problem solving the necessary equations mentally in real time. ;-)

If you the pendulum is presently balanced and you wish it to be balanced in a position to the left of its present position, you must:

1 - move the cart slightly to the right. This will leave the pendulum leaning to the left and starting to fall over.

2 - let it fall a bit then move the cart to the left sufficiently quickly to

*almost* bring the pendulum vertical.

3 - continue to chase the falling pendulum until it is near the required cart position.

4 - accelerate a bit to the left more to bring the pendulum vertical and then hold it there.

I haven't a clue how to write the math for this so if I had to do it I would use some form of fuzzy logic approach. Or more practice.

Walter

• posted

Thank you Walter! But, are you referring to a physical system. I am sorry if, my earlier creates the impression that I am involved in experiments.

I want to solve the problem in matlab/simulink...nothing more.

Regards,

Shashikant

|> What I mean by a single input is that we have one actuator connected to |> the cart. While all of the following can be sensed for feedback: |> position, velocity of cart; and angle and angular velocity of the inverted |> pendulum. |>

|> I approached the problem following way: |>

|> 1) Linearized the non-linear equations of motion. Assumed cart position |> and angle of the pendulum to be available for feedback. |>

|> 2) Got transfer function x/f and a/f where, f is force, x is cart displ |> and a is angle. |>

|> 3) Because of linearization we have got pole-zero cancellation by the |> system. Below are the TFs: |> 1.6 s^2 - 40 |> x/f= ----------------------------- zeros at -5 and 5 |> s^4 + 0.16 s^3 - 40 s^2 - 4 s |>

|> 4 s^2 |> a/f= ------------------------- zeros at 0, 0 |> s^4 + 0.16 s^3 - 40 s^2 - 4 s |>

|> poles at 0 -0.1 -6.3 6.3 |>

|> 4) Please observe that the system has non-minium phase zeros and has |> unstable poles. |>

|> 5) I am using cascaded controller with inner loop for pendulum and outer |> loop for cart position. |>

|> 6) I can stabilize the inner loop (i.e. pendulum angle) using lead and lag |> compensator with angle as feedback. |>

|> 7) I am also able to get stable open loop (for complete system) with |> feedback from both, angle and position. However, position feedback is |> making inner loop unstable (Note: inner loop is initially designed with |> feedback from angle only) |>

|> 8) I am using rltool/SISO tool in matlab for design purpose. |>

|> I am trying hard to get solution to the problem. This is my first exposure |> to control. Any input for any of the steps above would be of great help. |>

|> I checked controllability and observability in matlab. The system is |> controllable and observable (matlab returns rank=4 for both). I looked |> into the IEEE paper, most part of it is Greek and Latin for me. |>

|> Regards, |>

|> Shashikant |> (sarada at tamu.edu) |>

|>

|> On Fri, 14 Nov 2003, dave y. wrote: |>

|> |Tell you what, why don't you assume just a tiny bit of noise in the |> |system and then tell me you can do this. In the meantime, just to |> |experiment with the concept of open loop a bit, the next time you're |> |driving down the x-way, why don't you point the car straight down |> |the road, then take your hands off the wheel and close your eyes. |> |You can use the time remaining to contemplate the merits of your |> |position (at least in theory). |> | |> | |> |On 14 Nov 2003 10:08:12 +0100, Lars Imsland |> |wrote: |> | |> |>dave y. writes: |> |>

|> |>> Are you sure you've got the assignment described correctly? You have |> |>> to measure both cart position and pendulum angle to make this work, |> |>> and that represents a two input system. If, for example, you only |> |>> measure cart position and don't know what the pendulum angle is, you |> |>> don't have a chance of keeping it balanced. |> |>

|> |>It is definitely possible (at least in theory...) to control both cart |> |>position and stabilize upright position of the pendulumm using force |> |>on cart as (single) input. This is done in numerous published |> |>articles. One that springs to mind, is |> |>

|> |>@article {Ata99, |> |> AUTHOR = {Atassi, Ahmad N. and Khalil, Hassan K.}, |> |> TITLE = {A separation principle for the stabilization of a class of |> |> nonlinear systems}, |> |> JOURNAL = {IEEE Trans. Aut. Control}, |> |> FJOURNAL = {Institute of Electrical and Electronics Engineers. |> |> Transactions on Automatic Control}, |> |> VOLUME = {44}, |> |> YEAR = {1999}, |> |> NUMBER = {9}, |> |> PAGES = {1672--1687}, |> |> ISSN = {0018-9286}, |> |>} |> |>

|> |>> On Mon, 10 Nov 2003 23:53:47 -0600, Shashikant N Sarada |> |>> wrote: |> |>>

|> |>> >Hi |> |>> >I am working on a project on inverted pendulum. I have to control |pendulum |> |>> >rotation as well as cart position within given specifications. I am |using |> |>> >Matlab/Simulink and am designing as a single input-multiple output |system. |> |>> >I am able to control pendulum angle but not the cart position. Has |> |>> >anybody worked on similar problem? |> |>> >

|> |>> >Any input will be of great help! |> |>> >

|> |>> >Regards, |> |>> >

|> |>> >Shashikant |> | |> | |> | |>

| | | |

• posted

To be a little more helpful, I can suggest a few ideas. To be exact though I would have to locate my old homework which I haven't seen in a while, so this is going on pure memory.

Anyway, you need to think about pole placement, where do you want the closed loop poles to be. For example, sometimes a standard pattern is selected such as buttersorth. Another is to use the function in Matlab that designs an optimal regulator and selects the pole locations for you. This is what I remember doing for this problem.

You evidently want a transfer function solution. I think it's easier to find the solution in state space. You can then use Matlab to convert to the transfer function solution.

If this doesn't help I might have a reference that will.

dave y.

• posted

Shashikant,

Simulation gives insight to reality.

Reality gives insight to simulation.

The fact that a given situation has a solution in reality means that it must have a solution in theory. I find I learn a lot form that. On the other hand, the fact that an algorithm produces numbers does not prove anything about reality. For example, the fact that five to a large power produces an extremely big number does not mean that we will all become millionaires from chain letters.

Walter.

• posted

What do you mean with "open loop" here? It seems to me that with stable operation with feedback from both angle and position you have solved your problem.

You cannot replace the angle measurement with the position measurement (if that's what you are saying). If you mean that the outer loop makes the inner loop unstable, then I would look at the inner loop again.

Lars

• posted

A lot of people have already done this. Search google for "inverted pendulum" (or "furuta pendulum") and "video", and see for yourself. For example