LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coding Challenge: Inverted Pendulum

 


@Bruce Ammons wrote:

The length of the pendulum really is 0.78 m.  I drew it a lot shorter in the simulation just to save space.  The rest of the parameters are correct.  The simulation matches the real system to the best of my ability.

 

Bruce


Thank you Mr Ammons for the answer.

 

What I meant in my previous post is that developing some code for the control, I have some constants that are strongly linked to the physical system. So that, if you change the system, probably the control will not work.

I can't get by now how to make a "less sensible to system" control. It may be true that it's not possible to make a system free control, because the pendulum works in random ways.

I hope what I say makes some sense.

On my personal side I don't usually develop or work on controls, nor I used LabView.

I am new to LabView and I like it, expecially for the friendly graphical interface and its big collection of functions.

I'm looking to have some "fun" coding for the pendulum control. I don't even master high level maths such as solving for differential equation. I just play with basic motion rules.

I really like the pendulum application.

I once saw an inverted pendulum live in an electronic exposition and it looked great to see it live.

Good idea to make it a challenge.

 

Have a nice day.

 





0 Kudos
Message 41 of 50
(2,331 Views)

The system will not change for the competition.  The model you are using to write your control algorithm is the exact same one that will be used to test the algorithms.

 

The only change will be for the winner.  When we move the code to the real system, there will be some changes.  I modeled it as close as I could, but there are always small differences between a model and reality.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 42 of 50
(2,323 Views)

Hi, it's me again.

I hope not to annoy. I have a big doubt.

 

I did a "measure" on the simulation, which goes like this:

Put the pendulum at:

X = 0

V = 0

T = 0.01

w = 0

 

PWM = 0 always.

Let pendulum fall down, free falling.

Each iteration of the simulation, I log on a file V, T and w

Then I look at the data.

When T is PI / 2, (horizontal toward right side), I look at w.

V= 0.059711    T= 1.569226    w= 6.093119    
V= 0.060408    T= 1.575509    w= 6.111969  

 

dw is 6.111969 - 6.093119 = 0.001885

With dt = 0.001

dw/dt = 18.85 rad/s^2

 

Multiply by radious which is 0.78m

gives me

14.703 m/s^2

So, the downward component of the pendulum acceleration at T =PI/2 is 14.703 m/s^2

 

Now the only two forces which act on the pendulum are:

- gravity g toward the bottom (angle = PI)

- centrifugal force toward right (angle = PI/2)

 

PWM is always 0, but even if not zero, the cart is forced to move horizontally, so any acceleration from the cart cannot accelerate the pendulum angular speed w.

Centrifugal force is right angled, so it cannot accelerate the pendulum.

 

Then why the acceleration toward the bottom is not equal to the gravity g ?

I got 14.703 m/s^2  while g = 9.98 m/s^2

 

There is something wrong in my measure or do I have something wrong in my computations ?

I don't usually use this formuals, so I may be wrong in their application.

 

I would really like to hear any comment, Bruce Ammons may be very helpful.

 

Anyone tried to swing the pendulum ?

 

See you.

 





0 Kudos
Message 43 of 50
(2,305 Views)

You are trying to use physics for a free falling object, where this is a rotating object.  For a pendulum, you have rotational inertia and center of mass at the equivalent length.  For an ideal pendulum (this pendulum is not 100% ideal, so it won't match exactly) the center of mass of the pendulum is located at the center of the rod = 0.38 m.  You calculate the moment of inertia around the center of the rod using standard formulas, then shift it to the end where the center of rotation is.  You calculate the moment created by the gravity pulling down at the center of the rod and the support pulling up at the end.  You plug everything into the acceleration equation:  M = I * alpha to get the angular acceleration.

 

For a rough calculation, you could apply the gravity force at the center of the rod, which will accelerate at roughly 9.8 m/s^2.  The pivot end will not accelerate at all, and the free end will accelerate twice as much.  There are other forces and energies involved, but it comes close to your calculations.

 

Trust me, the physics of the simulation are quite accurate.  It is good to learn more about these things, though, so I don't mind the questions.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 44 of 50
(2,298 Views)

We have our first entry!  I tested it and it appears to satisfy all the requirements.

 

Now how about a few more???

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 45 of 50
(2,287 Views)

Here are the hints that I promised for the swing up:

 

If you open up the simulation code, you will see the equations of motion for the system.  For the pendulum, the equation is:

 

ddT = A (ddx cosT - g sinT) - B dT

 

We can't do anything about the gravity term or the friction term, so let's look at the term with the cart acceleration:

 

ddT = A ddx cosT

 

From this you can tell a few things:

 

The acceleration of the pendulum is proportional to the acceleration of the cart.

 

The velocity of the cart has no effect on the pendulum, just the acceleration.

 

The pendulum always accelerates in the opposite direction of the cart acceleration.

 

Depending on the direction that the pendulum is rotating, the acceleration will make the speed either increase or decrease.

 

The cosT term limits the interaction between the two.  When the pendulum is horizontal, cosT = 0 and the pendulum will not accelerate when the cart accelerates.  When the pendulum is vertical, cosT = 1 or -1 and you get the largest acceleration of the pendulum for a given acceleration of the cart.

 

This concludes the math lecture for today.  Hopefully it helps people develop some ideas.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 46 of 50
(2,282 Views)

Only 1 entry? That makes me sad 😞 if I wasn't busy with my graduation I would have made a shot.

0 Kudos
Message 47 of 50
(2,071 Views)

I'm so desperately sad that I didn't get time to submit an entry. I've wanted to enter one of the LabVIEW challenges for a long time, but I'm just so busy that it's been impossible to find a single moment to focus on it. Smiley Sad

 

I hope there was more than just one entry in the end??

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 48 of 50
(2,038 Views)

I submitted an entry too, so minimum 2 entries.

 

0 Kudos
Message 49 of 50
(1,964 Views)

Hello,

is there any chance to see a winner here ?

 

 





0 Kudos
Message 50 of 50
(1,833 Views)