Shop OBEX P1 Docs P2 Docs Learn Events
PID? — Parallax Forums

PID?

floodhoundfloodhound Posts: 45
edited 2007-08-22 15:51 in Propeller 1
I am transplanting the BS2SX with the propeller chip and I wanted to know if there is a PID source code. I remember learning tremendously form the PID used in a book from parallax. Just wanted to know if the code could be translated – remember I am learning slowly so not to complex if you are going to help.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My web site -- > www.floodhound.com <-- take a look if you like

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-08-17 19:21
    Yes, Andy Lindsay has posted code for a Propeller follower bot using PID, check out the PEKbot section of this thread: http://forums.parallax.com/showthread.php?p=617192

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • floodhoundfloodhound Posts: 45
    edited 2007-08-17 22:55
    Thanks a bunch

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My web site -- > www.floodhound.com <-- take a look if you like
  • Al BoothAl Booth Posts: 137
    edited 2007-08-20 17:05
    I've been looking at the PID.Spin file in the PEKBot code and have a question. The file shows this code in the "derivative" section:

    ' Derivative
    temp := f.FSub(E, Ep) ' ΔE = (now) - E(old)
    temp := f.FDiv(E, dt) ' ΔE/Δt
    D := f.FMul(kd, temp) ' D = kd
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-20 18:39
    I should think so, too...
    Whatever the math be, it makes no sense to assign to temp twice..

    One explanation could be, that E is not E as the comments say, but has already been changed to (now)-E(old) in instructions before, so obsoleting the first line...
  • edited 2007-08-22 15:51
    At first glance, it looks like I added disabled the derivative calculations.· Boarding a flight now, will check when I get home, and probably correct the code.

    Andy

    Update 8/23/07 - Corrections and testing in progress; hope to finish this weekend.

    Update 8/27/07 - Corrections completed.··Updated PID object attached.· Also attached is an archive for examining the PID calculations for verification. "Test PID.spin" is the archive's top file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.

    Post Edited (Andy Lindsay (Parallax)) : 8/24/2010 6:47:19 PM GMT
Sign In or Register to comment.