+ Reply to Thread
Page 1 of 7
1 2 3 ... LastLast
Results 1 to 10 of 61

Thread: PID Controller

  1. #1
    Inactive Moyer is on a distinguished road Moyer's Avatar
    Join Date
    May 2008
    Posts
    9

    Default PID Controller

    If you've tried doing PID with discrete gates, you'll know why I made this.

    Inputs:
    In - Input, value you want to control
    Set point - What you want the input to be
    Enable - If 0, the output is 0 and the loop is not evaluated

    Outputs:
    Out - The sum of the P, I, and D terms

    Put WirePID in your addons folder, the tool comes up under Wire - Control. hoverplatform.txt is an advanced dupe of a phx 8x8 hovering at a set height with just thrusters. The small 1x1 is a gps/radio combo to give the platform a zero (since someone doesn't have the ground at z=0 in wire_construct...). Both are frozen after being pasted. Numpad controls to move around/adjust height. I've had 5 or 6 of these running at the same time before things started slowing down (15-18 PID loops).

    The only issue is that you can't pick it up with the physgun. Works with the gravity gun and physics works fine, but not with the physgun.

    Fixed physgun
    Fixed undo text
    Added ghost
    Added output limit
    Attached Files
    Last edited by Moyer; 07-04-2008 at 07:25 PM.

  2. #2
    Inactive MagnetoHydroDynamics is on a distinguished road MagnetoHydroDynamics's Avatar
    Join Date
    Jan 2008
    Location
    Mars, Easth Hellas settlement
    Posts
    90

    Default Re: PID Controller

    What exactly is this?
    Screens? Demos?
    [LEFT][B]Current learning status:[/B]
    [/LEFT]
    [B] Expression chip:[/B] [I]Grand master (seriously, I can rival Syranide)[/I] [B]Lua:[/B] [I]Qute good[/I] [B]CPU:[/B] [I]I get it... I think, But why the registers? [/I][B]Moongate:[/B] [I]I'll look into it when i get time...[/I]
    [CENTER][URL="http://www.free-iqtest.net/"]:cookie:My IQ is 146[/URL] - [B]Free-IQTest.net:cookie:[/B]
    [/CENTER]
    [quote=l3ulletje;52546]How much more "Not there" do you want it to be?[/quote]
    [code]ents.GetByIndex(0):Remove()[/code][CENTER]
    [/CENTER]

  3. #3
    Inactive Moyer is on a distinguished road Moyer's Avatar
    Join Date
    May 2008
    Posts
    9

    Default Re: PID Controller

    [ame=http://en.wikipedia.org/wiki/PID_controller]PID controller - Wikipedia, the free encyclopedia[/ame]

    PID is a pretty versatile control method. I'd get some in game vid, but anything I upload to youtube gets its quality destroyed. There is an advanced dupe to play with...

  4. #4
    Inactive Moyer is on a distinguished road Moyer's Avatar
    Join Date
    May 2008
    Posts
    9

    Default Re: PID Controller

    Hover platform:

    [ame=http://www.youtube.com/watch?v=ckycx_0OZTo]YouTube - GMOD Hover Platform[/ame]

    Making a PHX beam stay standing on end:

    [ame=http://www.youtube.com/watch?v=hRoVWME7piI&feature=user]YouTube - GMOD Pole[/ame]

    Neither one is tuned perfectly, they could be made more responsive and accurate with better tuning of the gains.

  5. #5
    Inactive Mechanical433 is on a distinguished road Mechanical433's Avatar
    Join Date
    Mar 2007
    Posts
    159

    Default Re: PID Controller

    I don't understand its use...



    EDIT: JUST UNDERSTOOD ITS GREAT
    Last edited by Mechanical433; 05-18-2008 at 06:20 PM.
    [img]http://img84.imageshack.us/img84/8387/portalan1.jpg[/img]

  6. #6
    Inactive Ergzay is on a distinguished road Ergzay's Avatar
    Join Date
    Jun 2007
    Posts
    221

    Default Re: PID Controller

    Oh wow.... This is amazing. My head is spinning with everything this allows. Forget delta.... (And in regards to how this works (I've had through calc 3) is the delta we have been using similiar (although its delta not derivative) to the derivative part of the PID?)

    Here is one big vote for this being improved and incorporated into Wire.
    Last edited by Ergzay; 05-18-2008 at 06:38 PM.

  7. #7
    Success: An illusion
    turck3 will become famous soon enough turck3's Avatar
    Join Date
    Jun 2007
    Location
    USA
    Posts
    1,169

    Default Re: PID Controller

    Very interesting indeed... although it seems like a simple algorithm, it's still very useful; good job.

  8. #8
    Inactive Mechanical433 is on a distinguished road Mechanical433's Avatar
    Join Date
    Mar 2007
    Posts
    159

    Default Re: PID Controller

    Halp !!

    I can't set it corectly... ( Cant make it hover )

    What setting would you use ??
    [img]http://img84.imageshack.us/img84/8387/portalan1.jpg[/img]

  9. #9
    Inactive Moyer is on a distinguished road Moyer's Avatar
    Join Date
    May 2008
    Posts
    9

    Default Re: PID Controller

    Play around with mine, you can copy the settings off of those PID loops if you want (right click copies). Generally, you set I and D to 0 and tune P until the system becomes unstable, back of a little, add D until you're satisfied with the response, add I until error is eliminated. Sometimes you might not need to use all three parts, just set some to 0 to disable them. The platform uses three loops, one for pitch, one for roll, and one that is added to all four thrusters to control height, all use P, I, and D. I usually set it up with two hoverballs to let it rotate in one direction and hold it up in the air, then add thrusters/gyro/pid/set point and tune it for that one direction (pitch or roll), the other direction should then use the same settings. After that, I just add in the hovering loop and tune it.

    It might help to start off making a phx pole with an axis to a wall at one end and get PID loop/thruster/gyro to hold the other end up so the whole pole is horizontal. That's a pretty easy to tune system and you can really see what all the parts contribute.

    The D term is actually the derivative of the error. It first calculates the difference between the set point and the measured value and calls that error, then it takes the error it had last time it went through the loop and calculates the difference between the two errors. It then divides that by the time between loops. de/dt I is the integral of error, or the accumulation of error * dt every loop. P is just a constant * error.

    You can actually make this loop using gates (delta, multiply, integrator), but that's only good for one or two loops until it gets too slow. Doing it all in lua speeds it up tremendously.

    Changed my original post with a new attachment, fixed some stuff.

  10. #10
    Inactive Deviance is on a distinguished road Deviance's Avatar
    Join Date
    Mar 2008
    Location
    [Kansas City] MO
    Posts
    94

    Default Re: PID Controller

    Wow great job.
    [I][SIZE="2"]intel e6750 2.66 ghz
    bfg 8800gt oc
    2 gb G.Skill ram
    750w psu
    250 gb hd
    22'' LG 1680x1050
    ms sidewinder
    windows xp
    [/SIZE][/I]

+ Reply to Thread
Page 1 of 7
1 2 3 ... 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 Help & 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