+ Reply to Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 63

Thread: PID Controller

  1. #31
    Wirererer tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    101

    Default Re: PID Controller

    Agreed!
    "Vote PID for Presid-err-I mean official Wire component!"

  2. #32
    Wire Noob noobontouR's Avatar
    Join Date
    May 2008
    Posts
    11

    Default Re: PID Controller

    seriously i can't get it to wirk :/
    P, I and D are set to 0 and the rest to max,
    like standart settings, i out a gyro and wire it up,
    but the thrusters doesnt to anything, always off ? :V

    what am i doing wrong ?
    can anyone post working example ?

  3. #33
    Wirererer 3dfactor's Avatar
    Join Date
    Aug 2008
    Posts
    178

    Default Re: PID Controller

    Quote Originally Posted by noobontouR View Post
    seriously i can't get it to wirk :/
    P, I and D are set to 0 and the rest to max,
    like standart settings, i out a gyro and wire it up,
    but the thrusters doesnt to anything, always off ? :V

    what am i doing wrong ?
    can anyone post working example ?
    When P I and D are 0, the result is always 0!

    First leave them all 0, and try putting some numbers in D starting with 1 or less (or you can go from 100 and down). When the thing will be stable (It won't adjust to the needed position, but it just won't be wobbling around when droped in the air and such) adjust the P parameter. Now, P needs to start like from 0.1 and going up, if the thing gets all jiggy and wobly, try lowering the value. With P and D set, the device should now adjust itself to the needed position - but still, the numbers will be in predictable range, so say if I will put weight on one side, it will not be able to adjust, because it's max strength will be the same. Now you can add I parameter to the show. Start with number like 0.01 or even 0.001 and go up until the device can self adjust to the needed errors (weight) in desirable time and stable motions. The crazy thing about I param, is that if your error won't correct itself in some time, it will spaz out (for example if you keep the object frozen while testing your thrusters), so while you're playing with the numbers, I'd suggest you updating the PID chip each time you unfreeze your creation.

    Hope that helps
    2d head with 3d brains

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

    Thumbs up Re: PID Controller

    Quote Originally Posted by 3dfactor View Post
    When P I and D are 0, the result is always 0!

    First leave them all 0, and try putting some numbers in D starting with 1 or less (or you can go from 100 and down). When the thing will be stable (It won't adjust to the needed position, but it just won't be wobbling around when droped in the air and such) adjust the P parameter. Now, P needs to start like from 0.1 and going up, if the thing gets all jiggy and wobly, try lowering the value. With P and D set, the device should now adjust itself to the needed position - but still, the numbers will be in predictable range, so say if I will put weight on one side, it will not be able to adjust, because it's max strength will be the same. Now you can add I parameter to the show. Start with number like 0.01 or even 0.001 and go up until the device can self adjust to the needed errors (weight) in desirable time and stable motions. The crazy thing about I param, is that if your error won't correct itself in some time, it will spaz out (for example if you keep the object frozen while testing your thrusters), so while you're playing with the numbers, I'd suggest you updating the PID chip each time you unfreeze your creation.

    Hope that helps

    Excellent and easy guide for adjusting the PID! Thanks!

  5. #35
    Wirererer 3dfactor's Avatar
    Join Date
    Aug 2008
    Posts
    178

    Default Re: PID Controller

    I've also written the PID expression gate, so that I could use it in ALL wire servers, instead of just ones who run wire extras.

    Code:
    N@PID expression
    I@CurPos EndPos P I D Dcut Ilim Omin Omax On Reset
    O@Out
    interval(50)
    first() -> Time = curtime();
    first() -> It = 0;
    
    !clk() -> end;
    
    On ->
     Time = curtime()
     Error = EndPos - CurPos
     Pt = P * Error
     Dt = ($Time > 0 ? ($Error/$Time) : 0) * D
     abs(Dt) < Dcut -> It += I * Error;
     It > Ilim & Error > 0 -> It = Ilim;
     It < -Ilim & Error < 0 -> It = -Ilim;
     Out = Pt + It + Dt
     Out > Omax -> Out = Omax;
     Out < Omin -> Out = Omin;
    ;
    !On ->
     Out = 0
     Time = curtime()
    ;
    Reset -> It = 0;
    Since it heavier than running lua code, try increasing the interval value since your contraption might not need such rapid update. Just keep it in reasonable range (for thruster stabilisation interval(50) was more than enaugh for me )

    Dcut - Derivative cut
    Ilim - Integral limit
    Omin, Omax - Output min and max, so that it would only output numbers in range

    Also I've added Reset input, so you could reset your PID chip without the need to update it or remake it


    Hope this will be useful,
    Cheers!
    2d head with 3d brains

  6. #36
    Wirererer tuusita's Avatar
    Join Date
    Jul 2007
    Posts
    101

    Default Re: PID Controller

    Oh man, you rock!

  7. #37
    Wire Noob Moyer's Avatar
    Join Date
    May 2008
    Posts
    9

    Default Re: PID Controller

    Quote Originally Posted by 3dfactor View Post
    When P I and D are 0, the result is always 0!

    First leave them all 0, and try putting some numbers in D starting with 1 or less (or you can go from 100 and down). When the thing will be stable (It won't adjust to the needed position, but it just won't be wobbling around when droped in the air and such) adjust the P parameter. Now, P needs to start like from 0.1 and going up, if the thing gets all jiggy and wobly, try lowering the value. With P and D set, the device should now adjust itself to the needed position - but still, the numbers will be in predictable range, so say if I will put weight on one side, it will not be able to adjust, because it's max strength will be the same. Now you can add I parameter to the show. Start with number like 0.01 or even 0.001 and go up until the device can self adjust to the needed errors (weight) in desirable time and stable motions. The crazy thing about I param, is that if your error won't correct itself in some time, it will spaz out (for example if you keep the object frozen while testing your thrusters), so while you're playing with the numbers, I'd suggest you updating the PID chip each time you unfreeze your creation.

    Hope that helps

    I usually start by tuning P so that it just spazzes out, add in D until it doesn't, and increase I to eliminate any error that's left. If you set the I limit to a low enough value, freezing shouldn't cause too much of a problem. Updating the loop does reset the I term though.

    I started with discrete gates, that was good for about three loops at a time. Expression gate was faster, but a seperate entity ended up being easier to use and the fastest. It is annoying though when you go to add a loop and the server doesn't have PID.

  8. #38
    Wire Noob MonkeyPilot's Avatar
    Join Date
    May 2008
    Posts
    2

    Default Re: PID Controller

    I get weird stuff using this PID. Whever I make one myself out of discrete gates, Zeigler Nicols tuning seems to work fine for pretty much everything, but when I try using it with this one, any integral term higher than about 0.01 causes it to spazz out horribly (growing oscillations etc). Anyone else getting something similar?

  9. #39
    Wirererer 3dfactor's Avatar
    Join Date
    Aug 2008
    Posts
    178

    Default Re: PID Controller

    Quote Originally Posted by MonkeyPilot View Post
    I get weird stuff using this PID. Whever I make one myself out of discrete gates, Zeigler Nicols tuning seems to work fine for pretty much everything, but when I try using it with this one, any integral term higher than about 0.01 causes it to spazz out horribly (growing oscillations etc). Anyone else getting something similar?
    It strongly depends on the weight and strength of tools you're dealing with. Usualy in contraptions I don't need more than 0.05 on "I", sometimes even 0.001 ... It all depends on the specs - try increasing/decreasing thruster multiplier, playing with weight also helps
    2d head with 3d brains

  10. #40
    Wire Noob MonkeyPilot's Avatar
    Join Date
    May 2008
    Posts
    2

    Default Re: PID Controller

    It does seem odd to me though, as even using the exact same terms for the same system it is so different. I'll have to look through the LUA code to see how it differs from doing it at the gate level. May even try my hand at making an auto tuning routine for it, see how well those control modules I failed hold up.

    Edit: Looking back over my notes, I think I am being a bit ambitions for my first LUA project, oh well, gonna give it a go anyway (Anyone know an easy way for computing a generic transfer function given a known input and a measured output? :P)
    Last edited by MonkeyPilot; 08-24-2008 at 06:43 PM.

+ Reply to Thread
Page 4 of 7 FirstFirst ... 23456 ... 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