+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 20 of 49

Thread: S2 internal Pen Lifter and a couple questions for Phil

  1. #1

    Default S2 internal Pen Lifter and a couple questions for Phil

    First, here's the Pen Lifter, it works awesomely well if I do say so myself...

    See the blog entry for more details.



    Now for some questions;

    1. The speaker makes a constant but quiet tick tick tick at about 10 hz. Is that normal?

    2. Could you take a look at this code? The goal is to control the S2 using my XBee equipped remote controller. The goal is met, it does control it quite well. The problem however is that I cannot get the S2 to maintain a perfectly steady speed. It is as if every second or two the motors will stutter for just a moment even though they are receiving a steady move value.

    3. Related to the above perhaps, if I stop the S2 suddenly and then very gently reverse direction, it will lurch slightly.

    If I have not described the issues adequately I can put a video on YouTube.

    Rich H
    Attached Files Attached Files
    Last edited by W9GFO; 12-30-2010 at 09:18 PM.

  2. #2

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    That is a really cool mod. I make that to my S1.

  3. #3

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Rich,

    Very nice pen lifter! And a beautiful installation! (I'm amazed it all fit.) In response to your questions:

    1. No, the ticking is not normal. (At least I've never noticed it.) Does it do it all the time? What about if you don't start the audio cog?

    2. The "stuttering" you observe is related to the encoder resolution and the way wheel movements are coordinated. In the motor driver object, the motion of each wheel is monitored in relation to the other one. If one wheel should get ahead, it will not receive PWM pulses until the other wheel has caught up with it. That way, if you grip one of the wheels during a movement to slow it down, the other will slow proportionally. Now, if the motion values going to the two wheels differ by a small number, say, two (e.g. 1000 and 1002), there will be two points along the trajectory where one wheel will appear to get ahead of the other (just due to the encoder math) and will hesitate while the other "catches up". This may be the "stutter" that you notice.

    One may also notice a stutter during the drawing routines when drawing arcs. For example, when drawing a full circle, it is necessary to break it into two arcs. Sometimes the correct ending point for the first arc will not have integer coordinates, and you have to round them to integers. If, when the second arc begins, the arc radius is deemed too small for the distance to the ending point, the drawing software will move toward the ending point in a straight line, far enough to make up the extra distance, then draw the arc.

    3. The lurching you see upon reversing direction may be related to backlash in the gearbox, but I'm not sure. If you post an example program that produces this behavior, I'll have a look at it.

    -Phil

  4. #4

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Thanks Phil,

    I've just discovered that the ticking vanishes completely when I turn off the remote controller and returns after it has turned back on and booted up - and is in sync with the XBee TX Led on the controller.

    Looking at the well documented PASM motor code it looks like there should be something that I could do to disable the encoders, or at least the part where one is compared against the other. But since I don't really know PASM I do not know how to accomplish that.

    I doubt that the lurching is gear backlash. It only occurs after the S2 is stopped abruptly while moving at faster than half speed. As soon as it begins to move again it appears to be trying to make up some encoder counts.

    Rich H
    Last edited by W9GFO; 12-30-2010 at 09:19 PM.

  5. #5

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Hi Phil,
    Something about the problem with circles....(from LOGO Theory)
    Try this algorithm: REPEAT(36) FORWARD (5 cm or any distance) ROTATE-RIGHT (10 degrees)
    When I say Forward I mean both whees must have the same direction and velocity. If the s2 can rotate precisely 10 degrees you 'll have a perfect circle after the 36 steps.
    I have tried this method 6 years ago with a homemade robot (with very cheap DC motors with no accuracy) and I had great results.
    Unfortunately I don't have a s2 to try this but I believe that you 'll have result.

    Nikos Giannakopoulos

  6. #6

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    W9GFO - if you want to control the s2's wheel motors directly youself without using the s2 object or the encoders you could use something like this example
    Code:
    Con                                      ''s2 direct wheel motor control                                                                            
      _clkmode = xtal1 + pll16x                                                                                                                         
      _xinfreq = 5_000_000                                                                                                                              
     
      pwm = 16                               ''pwm base io for s2                                                                                       
     
    Var                                                                                                                                                 
     
    Obj                                                                                                                                                 
     
      pw : "pwmx8"                           ''pwm object                                                                                               
     
    Pub main                                                                                                                                            
     
      pw.start(16, %00001100, 20_000)        ''start pwm object on pwm base i/o pin @ 20khz                                                             
      dira[16..17]~~                         ''set s2's motor direction control i/o pins to output                                                      
     
      repeat                                                                                                                                            
                  'left      right                                                                                                                      
        move_robot(-75,      255)            ''set s2's left wheel slow reverse, set s2's right wheel maximum forward                                   
     
     
    Pub move_robot(left_wheel, right_wheel)  ''set s2's left & right wheel motor's speed from -255 maximum reverse to 255 maximum forward, 0 = stop     
     
      left_wheel := -255 #> left_wheel <# 255                                                                                                           
      right_wheel := -255 #> right_wheel <# 255                                                                                                         
     
      ifnot right_wheel & $80_00_00_00                                                                                                                  
        outa[pwm + 1] := 1                                                                                                                              
        pw.duty(pwm + 3, right_wheel & $ff)                                                                                                             
      else                                                                                                                                              
        outa[pwm + 1] := 0                                                                                                                              
        pw.duty(pwm + 3, (0 - right_wheel) & $ff)                                                                                                       
     
      ifnot left_wheel & $80_00_00_00                                                                                                                   
        outa[pwm] := 1                                                                                                                                  
        pw.duty(pwm + 2, left_wheel & $ff)                                                                                                              
      else                                                                                                                                              
        outa[pwm] := 0                                                                                                                                  
        pw.duty(pwm + 2, (0 - left_wheel) & $ff)
    Attached Files Attached Files
    Last edited by ratronic; 12-31-2010 at 07:42 AM.
    Fix it, if it ain't broke!

    D Rat

    Dave

  7. #7

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Thanks Dave,

    Not sure why I didn't go that direction, maybe it's because I was hoping to use as much of the 'native' S2 code as possible. I think using a separate driver object is very sensible.

    Rich H

  8. #8

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    w9gfo - sorry i posted the wrong file - use the one thats attached in my above post now to get the motors to run the right direction
    Last edited by ratronic; 12-31-2010 at 07:44 AM.
    Fix it, if it ain't broke!

    D Rat

    Dave

  9. #9

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    The file you attached worked just great for me.

    Thanks,

    Rich H

  10. #10

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    I've added a video of the pen lifter to the blog.

    Here's a direct link.

    http://www.youtube.com/watch?v=FqahLvqI-dk

    Rich H

  11. #11

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    That's some pretty nice scribblin! What is that controller you are using?
    Fix it, if it ain't broke!

    D Rat

    Dave

  12. #12

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Thanks!

    The controller is described in this thread.

    RIch H

  13. #13

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Very cool! I missed that one.
    Fix it, if it ain't broke!

    D Rat

    Dave

  14. #14

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    GREAT Scribblin', Rich! I got a bad S2, turns out. I'll have to get mine swapped out before I can Scribble!

  15. #15

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Thanks!

    Here's another;



    Rich H

  16. #16

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Super cool! I thought I had done some cool scribbling...
    Last edited by Whit; 03-07-2012 at 12:55 AM.
    Whit+

    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney

  17. #17

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Rich,

    That's even better repeatability than I would've guessed possible. Did you use the drawing commands in the S2 object? Did you have to tweak the calibration coefficients? (And what's with "SAINTS"? For Whit's benefit, I hope! Go Seahawks! Not that I give a rip. It's just for editorial balance. )

    -Phil

  18. #18

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    It was all done with move_to and arc_to commands. Calibration coefficients? Didn't even know there were any.

    "Saints" is for the Interlake Saints Robotics Team.

    Rich H

  19. #19

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Quote Originally Posted by W9GFO
    Calibration coefficients? Didn't even know there were any.
    No matter: it doesn't look like you need 'em!

    Quote Originally Posted by W9GFO
    "Saints" is for the Interlake Saints Robotics Team.
    Nice save! Um, go Saints! Yeah!

    -Phil

  20. #20

    Default Re: S2 internal Pen Lifter and a couple questions for Phil

    Here is a larger version. By Larger, I mean the letters are scaled up four times.

    http://forums.parallax.com/entry.php...in-big-letters

    And here is the code for the "A", any idea why it messed it up? It seems like it lost some encoder counts on the first two arcs.

    Code:
    Pub A
    
     s2.move_to(420, 0)
     pen_down
    
     s2.begin_path
     s2.move_to(420, 416)
     s2.arc_to(544, 540, -124)
     s2.move_to(656, 540)
     s2.arc_to(780, 416, -124)
     s2.move_to(780, 0)
     s2.move_to(660, 0)
     s2.move_to(660, 180)
     s2.move_to(540, 180)
     s2.move_to(540, 0)
     s2.move_to(420, 0)
     s2.end_path
    
     pen_up
    
     s2.move_to(540, 300)
     pen_down
    
     s2.begin_path
     s2.move_to(540, 388)
     s2.arc_to(568, 420, -32)
     s2.move_to(628, 420)
     s2.arc_to(660, 388, -32)
     s2.move_to(660, 300)
     s2.move_to(540, 300)
     s2.end_path
    
     pen_up
    Rich H
    Last edited by W9GFO; 01-05-2011 at 04:58 AM.

+ Reply to Thread

Similar Threads

  1. I have a couple of questions
    By ccake in forum BASIC Stamp
    Replies: 3
    Last Post: 03-12-2010, 12:26 PM
  2. A couple of questions
    By The Captain in forum Propeller 1 Multicore Microcontroller
    Replies: 7
    Last Post: 10-14-2007, 11:56 PM
  3. Couple of questions for Jon W. on LED's
    By slotcarz in forum BASIC Stamp
    Replies: 1
    Last Post: 05-11-2005, 01:35 PM
  4. couple of questions - USB ?
    By Archiver in forum BASIC Stamps Archive
    Replies: 0
    Last Post: 02-01-2004, 04:05 AM
  5. A couple of questions
    By Archiver in forum BASIC Stamps Archive
    Replies: 0
    Last Post: 11-12-2003, 12:41 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