I couldn’t wait to blog this one, so sleep will wait a little longer.
I recalculated the gains using a less aggressive setting, and came up with coefficients that are about an order of magnitude smaller. In the simulation, things move a little slower but everything runs very smoothly. The transition between swingup and a stable inverted pendulum looks a lot smoother also. I also fixed the issues in the control algorithm from yesterday.
I tried out the new stuff on the real hardware. First I tried moving from one position to another while hanging. It moves less smoothly than the simulation (kind of jerky), but it gets there and keeps the pendulum from swinging. Then I tried inverting the pendulum… (drum roll, please) and it worked great! The swingup didn’t quite get it all the way up, so I had to tweak the algorithm a little bit. Once it was inverted, it did a really good job of keeping it inverted. I can tell it to move to different positions, and it keeps it inverted while moving to those positions. I also tried tapping the pendulum lightly with my finger, and it recovered nicely. It is a little slow and kind of jerky, but it is still a success and a great second try.
The cart tends to oscillate while balancing the pendulum. It isn’t very large, and I guess it is to be expected. Every now and then, the cart stops completely and the pendulum stays balanced for a second or two, then it starts to fall and the cart zigs out to keep it upright. When the set screw is tight, the cart oscillates less.
One of my big problems right now is the set screw. I haven’t done anything about it yet, so it keeps coming lose after running for about a minute. Right now I just tighten it back up and restart the system. I really need to decide how to keep it in place and do it. If I don’t, I am going to shred all the pieces of shim foil that I have. I would feel silly if I had to go ask for more foil again.
I also want to work on the gains. I plan on gradually increasing the gains (and system speed) until I reach the limits of the system. I am just happy I have something that works at the moment.