+ Reply to Thread
Page 6 of 7 FirstFirst ... 4567 LastLast
Results 51 to 60 of 63

Thread: PID Controller

  1. #51
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    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?

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  2. #52
    Wirererer tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    101

    Default Re: PID Controller

    1.5 month BUMP!
    Sorry about that. :blush:

    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 01:05 PM. Reason: Results

  3. #53
    Wire Amateur 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:
    [highlight=e2]
    @name PID Gate E2
    @inputs On CurValue GoalValue P I D Dcut Ilim Omin Omax Reset
    @outputs Value
    @persist Time Error Pt It Dt
    @trigger On Reset CurValue GoalValue

    interval(50)

    if (first()) {
    Time = curtime()
    It = 0
    }

    if (!clk()) { exit() }

    if (On) {
    Time = curtime()
    Error = GoalValue - CurValue
    Pt = P * Error
    Dt = ($Time > 0 ? ($Error/$Time) : 0) * D

    if (abs(Dt) < Dcut) { It += I * Error }
    if (It > Ilim & Error > 0) { It = Ilim }
    if (It < -Ilim & Error < 0) { It = -Ilim }

    Value = Pt + It + Dt
    Value = (Value > Omax ? Omax : Value)
    Value = (Value < Omin ? Omin : Value)
    }

    if (!On) {
    Value = 0
    Time = curtime()
    }

    It = (Reset ? 0 : It)
    [/highlight]
    Last edited by Pyroclastic; 03-20-2009 at 09:16 PM.

  4. #54
    Wirererer tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    101

    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 12:42 PM. Reason: Results

  5. #55
    Wire Amateur 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's Avatar
    Join Date
    Apr 2009
    Location
    On the planet earth
    Posts
    267

    Default Re: PID Controller

    where is the dupe file, i cant find it

  7. #57
    Bug Buster TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,796

    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&#237;fi&#240; l&#230;&#240;ist l&#250;mskt &#225;fram

  8. #58
    Banned Nicolai1's Avatar
    Join Date
    Nov 2008
    Location
    Denmark.
    Posts
    1,251

    Default Re: PID Controller

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

  9. #59
    Wire Noob Ryusho's Avatar
    Join Date
    Mar 2008
    Posts
    22

    Default Re: PID Controller

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

  10. #60
    Wire Amateur krazyfool's Avatar
    Join Date
    Jul 2009
    Posts
    77

    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 ... 4567 LastLast

LinkBacks (?)

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

Similar Threads

  1. Turret with Adv. Pod Controller and Cam Controller?
    By Jaded Misanthrope in forum Installation and Malfunctions Support
    Replies: 6
    Last Post: 07-21-2008, 11: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
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots