Building an Inverted Pendulum System The Ups and Downs of Defying Gravity…

May 5, 2010

First inversion try

Filed under: Software — Bruce Ammons @ 11:32 pm

I worked a little more on the model, and decided it is probably close enough.  I got tired of waiting and decided to just try the current algorithm on the actual pendulum.

I added the control code to the existing pendulum interface, which wasn’t too difficult to do.  I started running the program and immediately discovered a problem.  The gains I had selected, which worked fine on the ideal model, were way too high for the real system.  The noise in the signals made the cart chatter while just trying to maintain a hanging position.  Moving to a new hanging position made the cart go crazy.  For a quick solution, I reduced the gains to about 1/4 their original value, and it seemed okay.  The chatter went away, but the pendulum wasn’t really staying still.  I could move to different positions without too many problems.

After getting the hanging controls in reasonable shape, I decided to try the swingup and had more problems.  It seems like nothing works as easily on a real system as it does in simulation, not that I am surprised.  In my swingup logic, I was using the angular position of the pendulum to make some decisions on control.  In the simulation, looking at the sign of the angle worked great.  The sign was always either +1 or -1.  However, on the real system the encoder makes it possible to have an angle of exactly zero, which gives a sign of zero.  My swingup kept moving in one direction and never reversed directions.  That just doesn’t work if you want to swing up the pendulum.  I did a quick fix that started the pendulum swinging, but the quick fix only worked until the pendulum was halfway up.  I will have to do a more permanent fix to handle the zero angle situation.

It was nice to see the pendulum doing something other than a sinusoid, even though I didn’t have a lot of success on my first try.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress