+ Reply to Thread
Page 6 of 7
FirstFirst ... 4 5 6 7 LastLast
Results 51 to 60 of 61

Thread: PID Controller

  1. #51
    Wire Sofaking Fizyk will become famous soon enough Fizyk will become famous soon enough Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    585

    Default Re: PID Controller

    PID can do the same as delta, when you use only P and D (I=0). I is used for extra stabilization, for example: if you use only P and D for holding altitude, it will always be a bit below the desired altitude - adding some I gain can eliminate this. It's just math

    Anyway, can someone check the lua file changed by me (3 posts up) and maybe add it to UWSVN, if it's confirmed that it works?

  2. #52
    Wire Amateur tuusita is on a distinguished road tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    86

    Default Re: PID Controller

    1.5 month BUMP!
    Sorry about that.

    Fizyk, to me it looks like the PID does seek to the new setpoint smoother than before.

    But is there a way to make it properly follow a constantly changing setpoint? For example, a steady climbing setpoint on world Z axis makes it over/undershoot it constantly. It over/undershoot gets even worse if I change the rate of climb.

    Hmm, come to think of it. I think I'll test a 'hold velocity' method rather than a 'follow changing coord' method.

    I'll post my findings here:
    EDIT: It seems to work. I can get an object to hover pretty darn perfectly when using GPS (z coord) and a delta gate(for up/down speed) Although there seems to be problems using the speedo, but it matters not since I'm now confident I'll get it working for my intended purpose.
    Last edited by tuusita; 03-12-2009 at 12:05 PM. Reason: Results

  3. #53
    Inactive Pyroclastic is on a distinguished road Pyroclastic's Avatar
    Join Date
    Jan 2009
    Posts
    47

    Default Re: PID Controller

    Bit delayed but I just started reading this thread today. But I did a quick conversion on 3dfactor's E1 to make it an E2. I haven't done much testing, but it should work. All I had to do was shift a few if statements around and add some persists. So here it is:
    e2 Code:
    1. @name PID Gate E2
    2. @inputs On CurValue GoalValue P I D Dcut Ilim Omin Omax Reset
    3. @outputs Value
    4. @persist Time Error Pt It Dt
    5. @trigger On Reset CurValue GoalValue
    6.  
    7. interval(50)
    8.  
    9. if (first()) {
    10. Time = curtime()
    11. It = 0
    12. }
    13.  
    14. if (!clk()) { exit() }
    15.  
    16. if (On) {
    17. Time = curtime()
    18. Error = GoalValue - CurValue
    19. Pt = P * Error
    20. Dt = ($Time > 0 ? ($Error/$Time) : 0) * D
    21.  
    22. if (abs(Dt) < Dcut) { It += I * Error }
    23. if (It > Ilim & Error > 0) { It = Ilim }
    24. if (It < -Ilim & Error < 0) { It = -Ilim }
    25.  
    26. Value = Pt + It + Dt
    27. Value = (Value > Omax ? Omax : Value)
    28. Value = (Value < Omin ? Omin : Value)
    29. }
    30.  
    31. if (!On) {
    32. Value = 0
    33. Time = curtime()
    34. }
    35.  
    36. It = (Reset ? 0 : It)
    Last edited by Pyroclastic; 03-20-2009 at 08:16 PM.

  4. #54
    Wire Amateur tuusita is on a distinguished road tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    86

    Default Re: PID Controller

    Quick corrections on your code Pyroclastic.

    Line 14:
    if (first()( {
    The parenthesis in red is facing the wrong way.

    Also, Out variable "doesn't exist". Added to outputs.

    Now it's time to test it.

    EDIT: Oh, hang on. Looking at your code AND thinking about it this time, if Value is the output of the PID, shouldn't you change all the references to Out into Value?

    EDIT: Hmm, I suppose it does handle the change in SetPoint (or GoalValue in your E2) a bit better. Needs more testing to be sure, but I'm dead tired at the moment. 10hr work day does that sometimes... :P

    Thanks for the E2 PID code, Pyroclastic.
    Last edited by tuusita; 03-20-2009 at 11:42 AM. Reason: Results

  5. #55
    Inactive Pyroclastic is on a distinguished road Pyroclastic's Avatar
    Join Date
    Jan 2009
    Posts
    47

    Default Re: PID Controller

    Yeah, I noticed those as soon as I loaded it up, I did the translation in notepad. I edited my post with the corrected and working version (I did test this one).

  6. #56
    Banned ningaglio is on a distinguished road ningaglio's Avatar
    Join Date
    Apr 2009
    Location
    On the planet earth
    Posts
    259

    Default Re: PID Controller

    where is the dupe file, i cant find it

  7. #57
    Bug Buster

    TomyLobo has a spectacular aura about TomyLobo has a spectacular aura about TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,772

    Default Re: PID Controller

    so you can steal that as well, ningaglio?
    great reason for thread necromancy...
    "It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup

    Lífið læðist lúmskt áfram

  8. #58
    Banned Nicolai1 will become famous soon enough Nicolai1's Avatar
    Join Date
    Nov 2008
    Location
    Denmark.
    Posts
    1,002

    Default Re: PID Controller

    Ningaglio has succesfuly bumped a pretty goddamn old thread...
    *Facepalm*

  9. #59
    Inactive Ryusho is on a distinguished road Ryusho's Avatar
    Join Date
    Mar 2008
    Posts
    13

    Default Re: PID Controller

    Great..so I downloaded a 'obsolete' tool because someone necrobumped it? great >.<

  10. #60
    Wire Amateur krazyfool has a little shameless behaviour in the past krazyfool's Avatar
    Join Date
    Jul 2009
    Posts
    41

    Default Re: PID Controller

    Can some one explain to me how to use this. I currently use delta and i heard this was a good alternative. For some reason i just can't grasp how to use it. Any help?

+ Reply to Thread
Page 6 of 7
FirstFirst ... 4 5 6 7 LastLast

LinkBacks (?)

  1. 01-27-2010, 10:36 AM

Similar Threads

  1. Turret with Adv. Pod Controller and Cam Controller?
    By Jaded Misanthrope in forum Help & Support
    Replies: 6
    Last Post: 07-21-2008, 10:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts