Shop OBEX P1 Docs P2 Docs Learn Events
Poly1 is back as PIDPoly — Parallax Forums

Poly1 is back as PIDPoly

Ray0665Ray0665 Posts: 231
edited 2011-02-02 08:01 in Robotics
Hi All
Some time ago I posted a program to an encoder thread it was quite primitive. I have been off doing other things and finally am back to my Stingray. As my first attempt of the new round, here is an updated stingray program It kinda sorta implements a turtle graphics like function I call it PIDPoly

Big shoutout to Kye for his new PID object it works great out of the box.

Encoder thread with Poly1 code
http://forums.parallax.com/showthread.php?118906-Stingray-Motor-Shaft-Encoders

My Apologies to everyone trying to upload the pidpoly archive.
I have no idea why it was coming up empty but it was, and I did not notice it. At any rate, here is the spin directly, you also need PWM1C_PIDEngine from the object exchange. here's the link: http://obex.parallax.com/objects/673/

Comments

  • KyeKye Posts: 2,200
    edited 2011-01-07 12:36
    No code in the upload! =) You may want to fix that.
  • WhitWhit Posts: 4,191
    edited 2011-01-07 12:54
    Same for me...
  • Ray0665Ray0665 Posts: 231
    edited 2011-01-08 13:16
    Addressed the empty archive problem in the first post.
    Sorry for the inconvenience.
  • ThreeRulesSafeThreeRulesSafe Posts: 2
    edited 2011-01-18 09:19
    Heya. I downloaded and tried the PidPoly30Dec2010.spin file and then combined with previously posted files and got odd behavior. I'm not confident that I have all the correct files. Could you post the entire set of files in objExchange or with a zip? For instance the MyLed3 file I was unable to find. I commented it out since I didn't really need it, but it definitely raises the possibility that I don't have the correct set of files combined.

    Thanks for working up these starter files. It has been very useful for me. I just picked up a Stingray last week and am new to Propeller, so a solid starting point project especially using the encoders would help me a bunch.
  • Ray0665Ray0665 Posts: 231
    edited 2011-01-18 10:10
    I must be totally brain dead with this thread first the empty archive (NOT my fault I swear) and now MyLed3.
    On my bot I have built a serial interface and the leds are attached to the serial to parallel chip whicc I doubt you have so there is no sense posting that module. You will just have to remove all reference to the Leds. All they do is blink the lights for some eye candy.

    The other module is a PID controller by Kye and there is a link to it in the first post.
    I have the QME-01 wheel encoders attached to my stingray and Kye's object relies on them for PID control on my Stingray. If you don't have the same model wheel encoders the PID will not function as written so you will have to tune the PID for your hardware which is probably something you will have to do anyway because there are always variations in the hardware.

    I run my bot mostly on a short Berber carpet.

    PidPoly as written makes a 5 meter forward run, then makes a right turn 1 meter square followed by a left turn 1 meter square and finally returns to the starting point and reorients itself.

    I manage to get it back to within 10 - 11 inches of the starting point 40% of the time.
    The failures occur because there is no speed ramping and the tail bounces on stopping and turning introducing errors. Slowing it down and ramping will make it a little better but there will always be some errors.

    Enjoy

    Some after thoughts:
    I think it is obvious but just in case
    You will also need to verify and adjust the Stingray parameters in the comments section to match your bot.
    There are several good pieces on the web about tuning a PID drive just google for them.
  • ThreeRulesSafeThreeRulesSafe Posts: 2
    edited 2011-01-18 19:23
    Heya. I did comment out the led stuff (not too hard to figure out), and I combined it as best I could with material .spin files from previous posts. I get odd behavior. I have commented out your behavioral code and just have it doing one drive straight operation with no polys (square) or turns and at slow speed. what i see happen is the left drive motor spins at what looks like medium to high speed and the right motor spins VERY slowly, about a 200% difference in speed. I understand how to tune the PID values and have started doing that but I think what is really going on is that i have some mismatched code. Could I trouble you to zip up the entire project in its current form so that I know I am starting from the same square as you (all pertinent files are the correct rev). If I still have the same problems then I'll tuck into seriously doing tune on PID constant values. You can email it if you prefer to ThreeRulesSafeBots@gmail.com or post here or wherever and let me know where to find it.

    Thanks, TRS
  • Ray0665Ray0665 Posts: 231
    edited 2011-01-19 07:43
    I'll contact you at the address given and proceed from there
    because you have everything you need above.
  • Ray0665Ray0665 Posts: 231
    edited 2011-02-02 08:01
    @threerulessafe: I'm really happy to hear that you found the intermittent connection on your left wheel and that PIDPoly is performing as expected after tuning. Good luck and have fun with your stingray.
Sign In or Register to comment.