|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Gyro Autobalancing
Team 1124 has gotten autonomous bridge balancing to work very well. Here's a video of our previous year's robot with the balancing code on it (this was before this year's robot was completed) You'll notice the bridge in this video is easily tipped. Our bridge was too light, which made balancing harder to achieve. The code worked even better when we tried it with a competition bridge.
http://www.youtube.com/watch?v=z2RpnQAU1dY If anyone's interested in our method: We use both a gyro and accelerometer to balance our robot. The gyro is good at giving an accurate angular rate, but not absolute angle, while the accelerometer is good at giving an accurate absolute angle, but not angular rate. We decided to combine the best features of both these sensors to get the best control. I don't want to release the entire code yet, but here's essentially how it works. It uses a state machine to decide how to behave. The driver drives the robot slowly up the bridge until the gyro rate is greater than a certain amount in either direction, at which point the code takes control of driving. The robot then drives in the opposite direction until a second significant angular rate is detected. After this sequence, the accelerometer is read for an accurate angle reading. If it is determined that balancing failed, it restarts. If it determines it is balanced, it holds its position and waits for the gyro to return a significant rate allowing it to re-balance. You should be able to see all of these steps from the video above. We use closed loop control on the drive (with PID) to control the rate at which the robot drives up the ramp in order to keep consistency. Our drivers have been very pleased with this feature. It has yet to fail. It almost always balances the robot on the first try. When it doesn't, it gets it on its second, as seen in the video. This method is much faster than when our drivers attempted it manually. I'd be happy to answer any questions related to our method of balancing, PID, or the sensors we used. Good luck to anyone else attempting this! |
|
#2
|
|||
|
|||
|
Re: Gyro Autobalancing
Quote:
It is, in fact, a double hinge.Quote:
![]() |
|
#3
|
||||
|
||||
|
Re: Gyro Autobalancing
Quote:
Quote:
Searching the forums will yield a wealth of discussion on how to tune a PID loop; there are also a number of discussions about how to tune PI loops and ignore the D. |
|
#4
|
|||
|
|||
|
Re: Gyro Autobalancing
Well my plan was to just get the robot on the bridge on regular control, then press the button to begin the balancing then just let go of the button when its sufficiently balanced. Now for mounting the gyro it would be mounted vertically, not laying flat parallel to the floor right?
|
|
#5
|
|||
|
|||
|
Re: Gyro Autobalancing
Quote:
Correct. The axis of rotation of the KOP gyro is perpendicular to the chip. For balancing, you probably want this axis to be parallel to the axels of your wheels, which means mounting it vertically. |
|
#6
|
|||
|
|||
|
Re: Gyro Autobalancing
Now from what I read, I know to tune the PID I must start with zero values on I and D and then adjust the PID until it begins to oscillate ( which I assumes means the robot) then divide it by half. (from what I read on wikipedia) but do I increase the P or decrease, and in what increments should increase by? It then says,"Then increase Ki until any offset is corrected in sufficient time for the process" which I really don't understand. Do I adjust this if I see any lag or what does it mean?
|
|
#7
|
||||
|
||||
|
Re: Gyro Autobalancing
Quote:
Ki is the integration coefficient; that is, the I function of the PID controller integrates, i.e. accumulates, your error (how far you are from the setpoint), and allows you to correct for error that has accumulated as a result of oscillation from tuning P alone. -edit- There's no definitive answer; it's almost wholly experimental, especially because the return rate of the gyro doesn't directly correlate with the "wobbling" of the bridge as you try to balance. |
|
#8
|
|||||
|
|||||
|
Re: Gyro Autobalancing
Quote:
Quote:
With that base, I don't really use a set system to tune Ki. I just usually start with a very small value (like around 0.01) and test it out. From there, if you watch your system and how long it takes to reach its setpoint, and determine how Ki should be changed. I usually tweak numbers by a factor of 2 or by a factor of 10 (depending on how much I think needs to be adjusted) and go from there. tl;dr: Tune PID constants by guessing and checking until you get something satisfactory. |
|
#9
|
|||
|
|||
|
Re: Gyro Autobalancing
My P value by default is at 1. Should I leave it like this or start from .01. or should I start from 1 and then increase by .01.
|
|
#10
|
|||||
|
|||||
|
Re: Gyro Autobalancing
Quote:
Do you need the system to correct more? Raise Kp. Do you need the system to correct faster? Raise Ki. Do you need the system to slow down as it approaches the setpoint? Raise Kd. Those are some overly general descriptions, but they work well in a pinch (and they also work oppositely). It will be very hard to give specifics on PID constants without knowing about the system it will be acting on, because sometimes small changes can have huge impacts. That's why PID tuning takes such a long time - it's a lot of guess and check work until it works in a way you like. In the meantime, I suggest to you do some reading on PID controller theory/tuning theory. Also, try and understand how the math behind them works in as much depth as possible (look through source code - I know you can look through the PID VI in LabVIEW). If you can understand how and why a PID controller works, it becomes that much easier to make one do your bidding. Some other links to read when you have time (in no particular order. I like this one because NI is awesome and does a great job with their tutorials and support). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|