Thursday, April 4, 2013

PID Controller

At uni, I did study fuzzy controllers and after a bit of searching I found my text book and lecture notes. However, fuzzy controllers suffer a bit from tuning. I experimented a bit, read a bit and did all those sorts of things until I kind of kept on stumbling on the internet phrases like "fuzzy controllers are a good option when standard controller don't work well". Hmm, look, these PID controllers look simpler and easier. Again lots of reading, experimenting etc, and then I discovered that in my situation I should break down the problem into two control problems. The first controller should focus on keeping it upright and then the second setting the speed.

First Controller - Keeping it Upright

In this controller the error term is angle speed with the objective of finding the best values that minimise energy and that the angle stays between -0.5 and 0.5 radians over a period of time. In effect this drives the solution to be making the angle as close to 0 as possible.

Using a "sophisticated" technique of iterating through a large number of permutations, I found the best co-efficient values were Kp = -64.9 Kd = 0, Ki = -846.3. The Kd = 0 is interesting because it seems controlling is not based at all on current angle acceleration. Hmm, I can't think with total confidence why this is. The only thing I can visualise is acceleration at different angle positions and speeds. Say would the controller do anything different if the acceleration is -ve or +ve when the angle is 0.5 and speed is -10 rad/s. I'm thinking from an energy point of view, maybe not.

Second Controller - Setting the Speed Point

In this controller the error term is speed with the objective of finding the best values that minimise speed over a period of time.

Again, using a "sophisticated" technique of iterating through a large number of permutations, I found the best co-efficient values were Kp = -434.5, Kd = 337.4, Ki = 0.0. The Ki = 0.0 is interesting because obviously the speed of the robot has nothing to do with its position and that makes sense.

Graph

The controller seems to work well, you can see that the angle and speed goes to zero.

You can see the robot is driven up until the blue line makes a sharp turn upwards. 




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.