Don't let that image intimidate you. It's not that bad! I was surfing on the Parallax Propeller forums and I noticed a post on PID controllers for UAVs that might be useful to some of you:PID Stuff for you UAV Nuts out there!PID controllers are commonly used in UAVs to keep the airplane on a specified path. Sniper King discusses each of the three parts of a PID controller in easy to understand language. He also gives advice for flight testing your software and tuning your gains.I haven't looked at the PID code in the Parallax OBEX, but I believe there is an alternate PID form that uses only one gain. For a more thorough explanation on PID controllers, you may want to check out the wikipedia article.
some of my examples:
roll of aircraft in X-Plane flight sim: only P control, you can see oscillations here. You can calibrate P gain so that you do not have such oscillation, but this is possible only for one target value, for example I calibrated for 20 degree roll, but when I tried 30 degree roll I still had problems.
and here: PID control. This gave same results on 10,20 or 30 degree rolls.
previous_error = 0
start:
error = setpoint - actual_position
P = Kp * error
I = I + Ki * error * dt
D = (Kd / dt) * (error - previous_error)
output = P + I + D
previous_error = error
wait(dt)
goto start
You just need to adjust the values Kp, Ki, Kd between .01 to 20, depending you model, the only way is the method better know as "Trial and Error", till you get it... There is a professional way too (but was in german and i don't remember anything).. if you search in torrents you going to find very interesting things.. =)
mmprestine
A hyperlink takes two parts: the URL and a text description (what you click on). You're not the first one to miss the second part.
<a href="http://www.embedded.com/2000/0010/0010feat3.htm">need text description here</a>
This is great! Too bad the code object in is Propeller Spin, and not C, but the write-up is refreshingly clear. My takehome: I've been using "P"s already, could easily add "I"s, and maybe don't need "D"s ;-)
Comments
roll of aircraft in X-Plane flight sim:
only P control, you can see oscillations here. You can calibrate P gain so that you do not have such oscillation, but this is possible only for one target value, for example I calibrated for 20 degree roll, but when I tried 30 degree roll I still had problems.
and here: PID control. This gave same results on 10,20 or 30 degree rolls.
This is the difference between a normal way, and the PID system =)...
previous_error = 0
start:
error = setpoint - actual_position
P = Kp * error
I = I + Ki * error * dt
D = (Kd / dt) * (error - previous_error)
output = P + I + D
previous_error = error
wait(dt)
goto start
You just need to adjust the values Kp, Ki, Kd between .01 to 20, depending you model, the only way is the method better know as "Trial and Error", till you get it... There is a professional way too (but was in german and i don't remember anything).. if you search in torrents you going to find very interesting things.. =)
A hyperlink takes two parts: the URL and a text description (what you click on). You're not the first one to miss the second part.
<a href="http://www.embedded.com/2000/0010/0010feat3.htm">need text description here</a>
Here's the C code from the article: ftp://ftp.embedded.com/pub/2000/wescott
http://www.embedded.com/2000/0010/0010feat3.htm
here is a easy to read PID loop from the BasicX web site