Shop OBEX P1 Docs P2 Docs Learn Events
4 servo control - smooth — Parallax Forums

4 servo control - smooth

ArchiverArchiver Posts: 46,084
edited 2003-07-16 08:48 in General Discussion
I've searched the archives with no luck. I am attempting to control
4 servos at once to move simultaneously and smoothly - not at full
speed, but through full range. Yes, 4 DC gear motors with encoders
using PWM would probably be the best way to do this, but I've
already got the servos.
They have to be positionally accurate in their start and stop
points and start offset from each other. As in; 1 goes for 1/4 turn
then 2 starts and then 3 starts later, then 4, then they reverse the
sequence after 4 reaches its final position.

So I've got a counter variable for each servo that starts and steps
upward toward its finish pulseout frequency. I've always fed the
servos signals using a pulsout within a 'for' loop for X times with
a Xms pause within to make sure the signal is read by the servo. If
you shorten this - loops less than 10 times and pause less than 5ms,
the servos freak out. Is there a better way to do this?

But as is, it works but the stamp fires all 4 servos sequentially,
making them servo's staccato as the steps have to be large to make
them all go fast enough - maybe a BS2p would solve that.
Any good solution to using a BS2 and 4 high torque analog servos?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-15 16:07
    I wonder if you've looked at a PAK-VIII? These let you generate pulses
    without depending on the Stamp. So your Stamp program sets it and
    forgets it (until you want to change, of course). Have a look at
    http://www.al-williams.com/pak8.htm and
    http://www.al-williams.com/servobot.htm -- might give you some ideas.


    It may be possible to do what you want with the Stamp directly, but I
    don't know that we have enough info. Do you have a code snippet of what
    you are trying to do? That might spur some discussions.

    Al Williams
    AWC
    * 8 channels of PWM
    http://www.al-williams.com/awce/pak5.htm

    P.S. We are getting the edge of the hurricane here in Houston, so we are
    having a "slow" day.




    >
    Original Message
    > From: damonhamm [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=8EnJ-MkJ_xqv7SvJ9FxUsDFulW9GypX3WFIr3SqvFfBuVIZHEmMauD7CuCKv7r5gWboi_9clTj5PNoUa]damonhamm@y...[/url
    > Sent: Tuesday, July 15, 2003 1:38 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] 4 servo control - smooth
    >
    >
    > I've searched the archives with no luck. I am attempting to control
    > 4 servos at once to move simultaneously and smoothly - not at full
    > speed, but through full range. Yes, 4 DC gear motors with encoders
    > using PWM would probably be the best way to do this, but I've
    > already got the servos.
    > They have to be positionally accurate in their start and stop
    > points and start offset from each other. As in; 1 goes for 1/4 turn
    > then 2 starts and then 3 starts later, then 4, then they reverse the
    > sequence after 4 reaches its final position.
    >
    > So I've got a counter variable for each servo that starts and steps
    > upward toward its finish pulseout frequency. I've always fed the
    > servos signals using a pulsout within a 'for' loop for X times with
    > a Xms pause within to make sure the signal is read by the servo. If
    > you shorten this - loops less than 10 times and pause less than 5ms,
    > the servos freak out. Is there a better way to do this?
    >
    > But as is, it works but the stamp fires all 4 servos sequentially,
    > making them servo's staccato as the steps have to be large to make
    > them all go fast enough - maybe a BS2p would solve that.
    > Any good solution to using a BS2 and 4 high torque analog servos?
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-16 06:07
    --- In basicstamps@yahoogroups.com, "Al Williams" <alw@a...> wrote:
    > I wonder if you've looked at a PAK-VIII?

    Looks like that might smooth out the stacatto motion a bit as the
    PAK-VIII could offload the pulseout loops and run faster (see below)


    > It may be possible to do what you want with the Stamp directly,
    but I don't know that we have enough info. Do you have a code
    snippet of what you are trying to do?

    I need to have 4 servos move slowly, so they are sequentially told
    to go to different positions...
    Here's some pseudocode to give you the idea:

    increment Servo1 position
    IF (Servo1 is at X position) AND THEN increment Servo2 position
    IF (Servo2 is at X position) AND THEN increment Servo3 position
    IF (Servo3 is at X position) AND THEN increment Servo4 position

    ... and to increment the servos, I send them position pulses,
    however servos react slowly, so the signal needs to be sent
    repeatedly. Is there a better way of doing this?

    for y = 1 to signaltime
    pulsout servo2, servo2Pos
    pause signalpause
    next

    the for cannot be less than 10 loops and the pause cannot be less
    than 7ms or the servos go nuts.
    (the servos have a resolution of ~50ms)

    so it operates extremely slowly and smoothly (fine position
    increments) or fast and jumpy (big position increments) as there is
    lag as the Stamp tells each one where to go sequentially.

    I need a bit faster but also smooth... Thanks!

    -D
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-16 08:48
    Have you tried putting all the servo moves in a single loop? Instead of
    moving one, then going to another, do them all at once. Not much delay
    between signals for any of the motors.

    Original Message
    From: "damonhamm" <damonhamm@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, July 15, 2003 10:07 PM
    Subject: [noparse][[/noparse]basicstamps] Re: 4 servo control - smooth


    > --- In basicstamps@yahoogroups.com, "Al Williams" <alw@a...> wrote:
    > > I wonder if you've looked at a PAK-VIII?
    >
    > Looks like that might smooth out the stacatto motion a bit as the
    > PAK-VIII could offload the pulseout loops and run faster (see below)
    >
    >
    > > It may be possible to do what you want with the Stamp directly,
    > but I don't know that we have enough info. Do you have a code
    > snippet of what you are trying to do?
    >
    > I need to have 4 servos move slowly, so they are sequentially told
    > to go to different positions...
    > Here's some pseudocode to give you the idea:
    >
    > increment Servo1 position
    > IF (Servo1 is at X position) AND THEN increment Servo2 position
    > IF (Servo2 is at X position) AND THEN increment Servo3 position
    > IF (Servo3 is at X position) AND THEN increment Servo4 position
    >
    > ... and to increment the servos, I send them position pulses,
    > however servos react slowly, so the signal needs to be sent
    > repeatedly. Is there a better way of doing this?
    >
    > for y = 1 to signaltime
    > pulsout servo2, servo2Pos
    > pause signalpause
    > next
    >
    > the for cannot be less than 10 loops and the pause cannot be less
    > than 7ms or the servos go nuts.
    > (the servos have a resolution of ~50ms)
    >
    > so it operates extremely slowly and smoothly (fine position
    > increments) or fast and jumpy (big position increments) as there is
    > lag as the Stamp tells each one where to go sequentially.
    >
    > I need a bit faster but also smooth... Thanks!
    >
    > -D
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
Sign In or Register to comment.