Shop OBEX P1 Docs P2 Docs Learn Events
Hexapod servo stepping question — Parallax Forums

Hexapod servo stepping question

ArchiverArchiver Posts: 46,084
edited 2002-04-10 21:20 in General Discussion
Hello all:

I have created a hexapod from scratch and am now programming it to
walk. I am using a Basic stamp2 and 2 Scott Edwards SSC's for serial
leg control. I have succeded in programming the hexapod to perform
pushups and a rough walking cycle. My issue is that I would like to
slow the leg movements down, especially the "stride" part of the leg
walk cycle. I stripped my code down to just one leg to try to "step"
the servo's through a walk cycle, however only 1 servo of the leg
seems to step through properly. I put debug commands throughout the
code below to ensure correct values and that the "for/next" loops as
well as the "serout" commands have the correct values...all's well.
What is absolutely stumping me is the fact that the 1st servo
(servoposa(0)- the stride servo) steps slowly as the code dictates,
but the 2nd servo (the lift servo) does not (it quickly goes to a set
position without stepping), even though the codes debug command shows
it stepping through the entire range of values. I have looked and
tried all kinds of things with the code to solve it but to no avail.
I think another pair of eyes on the code below will spot the issue
(s)? FYI, I have swapped connectors on the leg end to ensure proper
functioning of the hardware....all ok. Any and all feedback would be
appreciated!

Here is the code:


'{$STAMP BS2}
x var nib
y var byte
serposa var byte(2)
serposb var byte(2)
stride var byte
liftl var byte

stride = 70
liftl = -20

serposb(0)= 150
serposb(1)= 90
'
serposa(0) = 150
serposa(1) = 130
gosub serout1

stand: ' stride and lift routine values

serposa(0) = serposb(0) + stride
' debug dec serposa(0)
serposa(1) = serposb(1) + liftl
' debug dec serposa(1)
gosub serout2
end

serout2: ' This will have the legs step through its values so they
move slowly

x=0
for x=0 to 1
' debug dec x
y=serposb(x)
' debug dec y
for y=serposb(x) to serposa(x)
serout 8,$4054,[noparse][[/noparse]255,x,y(x)]
'debug dec y
pause 20
next
pause 1000
next
pause 500
return


serout1:' this will put the legs in a "home position" before the walk
cycle

x=0
for x=0 to 1
serout 8,$4054,[noparse][[/noparse]255,x,serposa(x)]
next
pause 1000
return

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-04-05 16:20
    This doesn't help with your code problem, but I do know of a new
    product coming out soon that may help. It is a 16 Serial Controller
    from a company called Pololu (see www.pololu.com) They offer a more
    robost version of Scott Edwards with control for speed. This way you
    aren't burdening the stamp with trying to slow down the code
    execution. The idea would be to send one command that tells the
    servo not just where to go, but also how fast to move!

    --- In basicstamps@y..., "kasaneus" <alex.dirks@w...> wrote:
    >
    > Hello all:
    >
    > I have created a hexapod from scratch and am now programming it
    to
    > walk. I am using a Basic stamp2 and 2 Scott Edwards SSC's for
    serial
    > leg control. I have succeded in programming the hexapod to perform
    > pushups and a rough walking cycle. My issue is that I would like to
    > slow the leg movements down, especially the "stride" part of the
    leg
    > walk cycle. I stripped my code down to just one leg to try
    to "step"
    > the servo's through a walk cycle, however only 1 servo of the leg
    > seems to step through properly. I put debug commands throughout the
    > code below to ensure correct values and that the "for/next" loops
    as
    > well as the "serout" commands have the correct values...all's well.
    > What is absolutely stumping me is the fact that the 1st servo
    > (servoposa(0)- the stride servo) steps slowly as the code dictates,
    > but the 2nd servo (the lift servo) does not (it quickly goes to a
    set
    > position without stepping), even though the codes debug command
    shows
    > it stepping through the entire range of values. I have looked and
    > tried all kinds of things with the code to solve it but to no
    avail.
    > I think another pair of eyes on the code below will spot the issue
    > (s)? FYI, I have swapped connectors on the leg end to ensure proper
    > functioning of the hardware....all ok. Any and all feedback would
    be
    > appreciated!
    >
    > Here is the code:
    >
    >
    > '{$STAMP BS2}
    > x var nib
    > y var byte
    > serposa var byte(2)
    > serposb var byte(2)
    > stride var byte
    > liftl var byte
    >
    > stride = 70
    > liftl = -20
    >
    > serposb(0)= 150
    > serposb(1)= 90
    > '
    > serposa(0) = 150
    > serposa(1) = 130
    > gosub serout1
    >
    > stand: ' stride and lift routine values
    >
    > serposa(0) = serposb(0) + stride
    > ' debug dec serposa(0)
    > serposa(1) = serposb(1) + liftl
    > ' debug dec serposa(1)
    > gosub serout2
    > end
    >
    > serout2: ' This will have the legs step through its values so they
    > move slowly
    >
    > x=0
    > for x=0 to 1
    > ' debug dec x
    > y=serposb(x)
    > ' debug dec y
    > for y=serposb(x) to serposa(x)
    > serout 8,$4054,[noparse][[/noparse]255,x,y(x)]
    > 'debug dec y
    > pause 20
    > next
    > pause 1000
    > next
    > pause 500
    > return
    >
    >
    > serout1:' this will put the legs in a "home position" before the
    walk
    > cycle
    >
    > x=0
    > for x=0 to 1
    > serout 8,$4054,[noparse][[/noparse]255,x,serposa(x)]
    > next
    > pause 1000
    > return
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-05 17:11
    I just created a hexapod from scratch and am now programming it too!! I
    would love to see some photos of your machine and I could send you some
    photos of mine are you interested? Skip Webb

    Original Message
    From: sjoblin001 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=tCD87xugUlf97hSkfTp48PfVtyzk8GRKtUf7K10Gc1HP-WYmDkNorUu1mFCW_EEnyAiPzGJMHw]sjoblin@m...[/url
    Sent: Friday, April 05, 2002 10:20 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Hexapod servo stepping question


    This doesn't help with your code problem, but I do know of a new
    product coming out soon that may help. It is a 16 Serial Controller
    from a company called Pololu (see www.pololu.com) They offer a more
    robost version of Scott Edwards with control for speed. This way you
    aren't burdening the stamp with trying to slow down the code
    execution. The idea would be to send one command that tells the
    servo not just where to go, but also how fast to move!

    --- In basicstamps@y..., "kasaneus" <alex.dirks@w...> wrote:
    >
    > Hello all:
    >
    > I have created a hexapod from scratch and am now programming it
    to
    > walk. I am using a Basic stamp2 and 2 Scott Edwards SSC's for
    serial
    > leg control. I have succeded in programming the hexapod to perform
    > pushups and a rough walking cycle. My issue is that I would like to
    > slow the leg movements down, especially the "stride" part of the
    leg
    > walk cycle. I stripped my code down to just one leg to try
    to "step"
    > the servo's through a walk cycle, however only 1 servo of the leg
    > seems to step through properly. I put debug commands throughout the
    > code below to ensure correct values and that the "for/next" loops
    as
    > well as the "serout" commands have the correct values...all's well.
    > What is absolutely stumping me is the fact that the 1st servo
    > (servoposa(0)- the stride servo) steps slowly as the code dictates,
    > but the 2nd servo (the lift servo) does not (it quickly goes to a
    set
    > position without stepping), even though the codes debug command
    shows
    > it stepping through the entire range of values. I have looked and
    > tried all kinds of things with the code to solve it but to no
    avail.
    > I think another pair of eyes on the code below will spot the issue
    > (s)? FYI, I have swapped connectors on the leg end to ensure proper
    > functioning of the hardware....all ok. Any and all feedback would
    be
    > appreciated!
    >
    > Here is the code:
    >
    >
    > '{$STAMP BS2}
    > x var nib
    > y var byte
    > serposa var byte(2)
    > serposb var byte(2)
    > stride var byte
    > liftl var byte
    >
    > stride = 70
    > liftl = -20
    >
    > serposb(0)= 150
    > serposb(1)= 90
    > '
    > serposa(0) = 150
    > serposa(1) = 130
    > gosub serout1
    >
    > stand: ' stride and lift routine values
    >
    > serposa(0) = serposb(0) + stride
    > ' debug dec serposa(0)
    > serposa(1) = serposb(1) + liftl
    > ' debug dec serposa(1)
    > gosub serout2
    > end
    >
    > serout2: ' This will have the legs step through its values so they
    > move slowly
    >
    > x=0
    > for x=0 to 1
    > ' debug dec x
    > y=serposb(x)
    > ' debug dec y
    > for y=serposb(x) to serposa(x)
    > serout 8,$4054,[noparse][[/noparse]255,x,y(x)]
    > 'debug dec y
    > pause 20
    > next
    > pause 1000
    > next
    > pause 500
    > return
    >
    >
    > serout1:' this will put the legs in a "home position" before the
    walk
    > cycle
    >
    > x=0
    > for x=0 to 1
    > serout 8,$4054,[noparse][[/noparse]255,x,serposa(x)]
    > next
    > pause 1000
    > return


    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 2002-04-10 21:20
    Absolutely! I would love to see pictures. Problem is, I haven't
    started construction yet, so I can't send you pictures for quite a
    long time. have you seen the MHEX Robot Walker or Frank Scott's
    Hexapod Robots? These are two pretty good sites. Send any pictures
    to sjoblin@m.... I have not yet settled on a mechanical design
    yet. I would be most interested to know of your experiences. What
    materials did you use, how many degrees of freedom does each leg
    have, what routines are you using to turn the hexapod, etc.

    Steve



    --- In basicstamps@y..., "Webb, Skip (FL51)" <skip.webb@h...> wrote:
    > I just created a hexapod from scratch and am now programming it
    too!! I
    > would love to see some photos of your machine and I could send you
    some
    > photos of mine are you interested? Skip Webb
    >
    >
    Original Message
    > From: sjoblin001 [noparse][[/noparse]mailto:sjoblin@m...]
    > Sent: Friday, April 05, 2002 10:20 AM
    > To: basicstamps@y...
    > Subject: [noparse][[/noparse]basicstamps] Re: Hexapod servo stepping question
    >
    >
    > This doesn't help with your code problem, but I do know of a new
    > product coming out soon that may help. It is a 16 Serial
    Controller
    > from a company called Pololu (see www.pololu.com) They offer a
    more
    > robost version of Scott Edwards with control for speed. This way
    you
    > aren't burdening the stamp with trying to slow down the code
    > execution. The idea would be to send one command that tells the
    > servo not just where to go, but also how fast to move!
    >
    > --- In basicstamps@y..., "kasaneus" <alex.dirks@w...> wrote:
    > >
    > > Hello all:
    > >
    > > I have created a hexapod from scratch and am now programming it
    > to
    > > walk. I am using a Basic stamp2 and 2 Scott Edwards SSC's for
    > serial
    > > leg control. I have succeded in programming the hexapod to
    perform
    > > pushups and a rough walking cycle. My issue is that I would like
    to
    > > slow the leg movements down, especially the "stride" part of the
    > leg
    > > walk cycle. I stripped my code down to just one leg to try
    > to "step"
    > > the servo's through a walk cycle, however only 1 servo of the leg
    > > seems to step through properly. I put debug commands throughout
    the
    > > code below to ensure correct values and that the "for/next" loops
    > as
    > > well as the "serout" commands have the correct values...all's
    well.
    > > What is absolutely stumping me is the fact that the 1st servo
    > > (servoposa(0)- the stride servo) steps slowly as the code
    dictates,
    > > but the 2nd servo (the lift servo) does not (it quickly goes to a
    > set
    > > position without stepping), even though the codes debug command
    > shows
    > > it stepping through the entire range of values. I have looked and
    > > tried all kinds of things with the code to solve it but to no
    > avail.
    > > I think another pair of eyes on the code below will spot the issue
    > > (s)? FYI, I have swapped connectors on the leg end to ensure
    proper
    > > functioning of the hardware....all ok. Any and all feedback would
    > be
    > > appreciated!
    > >
    > > Here is the code:
    > >
    > >
    > > '{$STAMP BS2}
    > > x var nib
    > > y var byte
    > > serposa var byte(2)
    > > serposb var byte(2)
    > > stride var byte
    > > liftl var byte
    > >
    > > stride = 70
    > > liftl = -20
    > >
    > > serposb(0)= 150
    > > serposb(1)= 90
    > > '
    > > serposa(0) = 150
    > > serposa(1) = 130
    > > gosub serout1
    > >
    > > stand: ' stride and lift routine values
    > >
    > > serposa(0) = serposb(0) + stride
    > > ' debug dec serposa(0)
    > > serposa(1) = serposb(1) + liftl
    > > ' debug dec serposa(1)
    > > gosub serout2
    > > end
    > >
    > > serout2: ' This will have the legs step through its values so
    they
    > > move slowly
    > >
    > > x=0
    > > for x=0 to 1
    > > ' debug dec x
    > > y=serposb(x)
    > > ' debug dec y
    > > for y=serposb(x) to serposa(x)
    > > serout 8,$4054,[noparse][[/noparse]255,x,y(x)]
    > > 'debug dec y
    > > pause 20
    > > next
    > > pause 1000
    > > next
    > > pause 500
    > > return
    > >
    > >
    > > serout1:' this will put the legs in a "home position" before the
    > walk
    > > cycle
    > >
    > > x=0
    > > for x=0 to 1
    > > serout 8,$4054,[noparse][[/noparse]255,x,serposa(x)]
    > > next
    > > pause 1000
    > > return
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@y...
    > 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.