Shop OBEX P1 Docs P2 Docs Learn Events
Help with continuous rotation servos — Parallax Forums

Help with continuous rotation servos

skatjskatj Posts: 88
edited 2008-01-30 05:53 in BASIC Stamp
Hi, I'm working on a robot and I'm just finished building the chassis so I tested out the drive system with some code. However, whenever I run the program, the servos move very very slowly. When I press the reset button, or re-upload the program while this is happening, the servos start to run as normal. This isn't that big of a deal but could become a problem later on. Any ideas why this is happening?

(I'm using the PSC serial)
' {$STAMP BS2}
' {$PBASIC 2.5}

Sdat CON 12
baud CON 396

ServoPos1 VAR Word
ServoPos2 VAR Word

ServoPos1 = 1250
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 5, 20,  servoPos1.LOWBYTE, servoPos1.HIGHBYTE, CR]

ServoPos2 = 250
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 13, 20,  servoPos2.LOWBYTE, servoPos2.HIGHBYTE, CR]

END




In addition, the code above moves the robot foward, for some reason the servos will go in opposite directions with the same pulse widths (their orientation is the same)

Comments

  • edited 2008-01-30 03:17
    Hi, I was just doing the same thing a few days ago and found out that in your code :
    ServoPos1 = 1250
    SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 5, 20, servoPos1.LOWBYTE, servoPos1.HIGHBYTE, CR]

    When you look at the bolded 20, this is the servo speed. If you set this value to 1 your servos will move as fast as they do in the program [noparse]:)[/noparse]
    I hope this helps!!!!

    Andy

    "A man with a plan"
  • skatjskatj Posts: 88
    edited 2008-01-30 03:29
    Well I found out what I did wrong.

    I didn't loop the signal, so it sent it once. What happened was, I guess the Stamp centers each servo when it is turned on, so this overrode the initial pulse in the program. I fixed this by adding a 3 sec pause before sending the pulses.
  • edited 2008-01-30 05:53
    Since you are also using the PSC to control servos I was wondering when you build your motion files how do you import them so the robot acts how you want it to. I have a 2 1\2 robot i am working on and transfered the positions over manually after recording the positions off the screen but when i run them on the basic stamp they did not work. Any help would be welcome.

    -Andy
Sign In or Register to comment.