| View previous topic :: View next topic |
| Author |
Message |
robotjay co-admin
Joined: 01 Aug 2006 Posts: 225 Location: Nebraska, USA
|
Posted: Wed Apr 25, 2007 5:56 pm Post subject: PID auto-tuning |
|
|
Hello Friends!
I have recently had a little extra time to actually sit and play with the OpenServos, installed inside a TowerPro MG995 servo. I quickly realized that I have no clue what values to set to the P, I, and D registers. The values that Mike Thompson gave me (0x0600, 0x0800, 0x0000) cause the servo to operate almost as expected. The servo moves to the commanded position, overshoots, then overcorrects, then overcorrects again, causing the servo to "bounce" around the position I want. This overcorrection repeats and decreases over a period of about 2 seconds until the servo finally settles at the commanded position.
After searching the OpenServo forums and Google, I am begining to have a grasp of what the PID values do to the action of the servo. What I am also learning, is that even though it is possible to tune the PID values to a specific load, these values will need to be re-tuned for different loads. I am specifically involved in this project to develop a bipedal robot, which will have varying loads on the servo because of differing movement speeds and momentums.
I am curious to know if anyone in the community has any experience that they may be able to relate to this problem, to help develop a solution so the OpenServo can auto-tune itself to varying loads.
It is also entirely possible that my understanding of PID is wrong, and that if I tune the servo for one load, it should work across most/all loads. Any and all help is appreciated. Thanks a lot. Talk to you soon.
-Jay _________________ "Nothing is fool-proof; For we fools are ingenious and will find a way." |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Wed Apr 25, 2007 8:01 pm Post subject: |
|
|
Hi jay,
I have a little I can say on this subject, but I don't have all the answers. Maybe someone else with a more biped specific knowledge base can chip in.
I see that you have looked into what PID is and how to tune it for a specific load, so I won't go into that. Instead I will give you some ideas based on my experience.
As you know I have a rather large robot arm. The loading of the arm varies in a number of ways, including how far the arm is extended, what it is holding, and the angle from ground. The motors behave in completely different ways depending on these factors.
I deal with the most obvious one with a patch to the OpenServo codebase. If the motor is moving against gravity it uses one set of PID values, and the other way uses a different set. I dynamically change the PID of my larger shoulder joint on the fly by using an autotuning PID function. This monitors the movement of the arm at quick intervals near the end of it's travel, and updates the PID to iron out the oscillations based on a look up table. The last PID tuning method I use is completely manual. After taking a few (hundred) samples of the movement, I manually tune the PID to sit between a "island of sanity" where any oscillation is negligible.
The sort of load differences you will encounter will differ for each segment of your biped. For example, the legs and ankles will have more loading than the torso elements. With that in mind you should be able to find an optimum for each area of your biped in this "island of sanity". I can't see the amount of loading difference being a major problem for you, as the loading will only vary by a nominal amount. With that said, there is a lot you can do to help yourself here. A few examples are given above. The PID values are only 6 bytes, so it is not bus intensive. You can send new PID values after a position write based on what type of motion you are doing.
I hope my rambling makes some sense.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
robotjay co-admin
Joined: 01 Aug 2006 Posts: 225 Location: Nebraska, USA
|
Posted: Wed Apr 25, 2007 8:31 pm Post subject: |
|
|
Barry,
I think I've seen mention of using look-up tables elsewhere in this forum, and I had hoped to avoid using this method because it's not as universal as full auto-tuning. I will take your advice, though, and use the look-up tables (you'll probably be getting a flurry of e-mails from me when I begin to write the code. ) This will work for what I am trying to do, although I think it would be of great benefit to this project and to the world if someone were to develop or discover an OpenSource PID auto-tuner that didn't rely on manually setting up a look-up table.
In fact, after doing a little research, it seems that auto-tuning algorithms are very difficult to create, and the few companies that have developed them have put copyrights and patents on their implementations. It is likely that the high-end digital servos from Futaba and HiTec are using proprietary auto-tuners. I think that if we bounce this around the community for long enough, someone will eventually solve this problem. I realize that this will take a long time, but it's just something to think about. Anyone else's thoughts are still appreciated.
-Jay _________________ "Nothing is fool-proof; For we fools are ingenious and will find a way." |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Thu Apr 26, 2007 12:44 am Post subject: |
|
|
Jay,
When the time comes to that I have some tools that will help out.
This runs 50 iterations of a movement and was designed to tune the PID according to a rule set. The rules change each P I or D value according to the many methods I have seen for PID tuning on the net. The screen shows the last measurements from the servo and the time taken to transfer the data. The red line is the line used to calculate the new PID values to be sent over on the next run.
Most of the screenshot is meaningless to anyone but me at the moment, but I am sure you get the idea.
The above screenshot only works with my Gumstix communicating over ethernet at the moment, but I can polish this up in time and get it OSIF ready. Removing the random comments and changing the buttons to a more formal wording would be a good start
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
robotjay co-admin
Joined: 01 Aug 2006 Posts: 225 Location: Nebraska, USA
|
Posted: Thu Apr 26, 2007 1:54 am Post subject: |
|
|
Barry,
Having this tool work in conjunction with the OSIF will be extremely useful to anyone using the OpenServo. I have only one request: Please leave in the "Tune me baby!" button. I can't believe you just have code like this lying around. If you packaged it right, there are a ton of motion control engineers who could benefit from this app. Bravo. E-mail me if you can get it to work in XP.
-Jay _________________ "Nothing is fool-proof; For we fools are ingenious and will find a way." |
|
| Back to top |
|
 |
jayph
Joined: 08 Apr 2007 Posts: 5
|
Posted: Thu Apr 26, 2007 5:14 pm Post subject: |
|
|
(Pre-caveat: I may have no idea of what I'm talking about.)
I'm a newbie in control systems having received all of my electronics training in digital. Everything I say here may be wrong.
My (limited)study to date leads me to believe the situation we have here (one set of PID gains not working for all situations) is an indication of a non-linear system.
A first order solution is the lookup table approach, which works well as long as the different regimes are easily identified and the system approximates a linear system while in a given regime.
A more complex solution is an adaptive control system. Here's where my knowledge (or delusion) goes to zero (or infiinity!). I'm attempting to grind my way through math I forgot 25 years ago to understand how these work. I think this is what I eventually want to implement, but I plan to step my way through successively more complex solutions until I'm happy with the results. _________________ Tronix LLC |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|