Shop OBEX P1 Docs P2 Docs Learn Events
AH3-R Hexapod with a BS2 microcontroller and Propeller servo controls — Parallax Forums

AH3-R Hexapod with a BS2 microcontroller and Propeller servo controls

vanmunchvanmunch Posts: 568
edited 2009-10-11 21:59 in Robotics
Hello,
I recently built a AH-3 from Lynxmotion, but I wasn't satisfied with the control that I could have over the SSC-32 servo controller so I've replaced the electronics with a BS2 and two of the new Propeller servo controllers. (I also didn't want to have spend the time to learn how to program the Atom or SSC-32 [noparse]:)[/noparse]

Anyhow, here are some pictures of the robot during the build, with the SSC-32 and Atom controllers and some with the BS2 and propeller servo controllers. I have some video of it walking with both sets of electronics, but I need to compress the video or I'll just post them on YouTube. I'm curious to see if anyone else here is working on articulated walkers (4 or 6 legs, 2 or 3DOF). If you like I can post my "painfully obvious, non-professional" [noparse]:)[/noparse] , otherwise I'll try and update this post as I go along.

Dave

update: 10/11/09

Here are some links to it walking with Lynxmotion's code and two with my code (posted below)







enjoy

Post Edited (vanmunch) : 10/11/2009 10:03:54 PM GMT

Comments

  • al-spideral-spider Posts: 42
    edited 2009-10-02 00:28
    wow!
    this is what i would like to do also, i've got the HDAT and would like to convert to the prop-sc.
    i never got far with the gait-pic.
    I have the BS-board but why not use the prop demo board? (sd-card / video )

    i would love to try and go alone with on this project . i'm a little weak in code programing and could use the help looking out!
    i'll try and post some photos later also so you look at my work also.

    ps nice to meet you
  • vanmunchvanmunch Posts: 568
    edited 2009-10-03 02:22
    Hey al-spider,

    Thanks for the compliment. I've been thinking about switching over to the Propeller, but so far the BASIC has been able to do everything that I need. (Although the biggest reason is that I just don’t want to stop working building the walker.) I’m also a little hesitant because there doesn’t seem to be as much documentation support from Parallax on how to use the sensors in spin as they do for PBASIC. I’m guessing that they’ll start writing more example spin code for their sensors now that they’ve come out with the Stingray. (I’m especially interested in the control board. It looks like it can handle 24 servo/sensors).

    Anyhow, it would be great to see some pictures of your project. Below is the code “as is.” It’s a work in progress. I call the very front two legs “paws” because I was/am hoping to make it be able to dig or add grippers.


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    'SixLegWalkVer9.4.bs2


    pw VAR Word
    ra VAR Byte

    sdat CON 15
    baud CON 396

    LFhip CON 5 'Left Front hip
    LFknee CON 6
    LFfoot CON 7

    LFhipV VAR Byte
    LFkneeV VAR Byte
    LFfootV VAR Byte

    LRhip CON 8 'Left Rear hip
    LRknee CON 9
    LRfoot CON 10

    LRhipV VAR Byte
    LRkneeV VAR Byte
    LRfootV VAR Byte

    RFhip CON 0 'Fight Front hip
    RFknee CON 1
    RFfoot CON 2

    RFhipV VAR Byte
    RFkneeV VAR Byte
    RFfootV VAR Byte

    RRhip CON 13 'Right Rear hip
    RRknee CON 14
    RRfoot CON 15

    RRhipV VAR Byte
    RRkneeV VAR Byte
    RRfootV VAR Byte

    LPawHip CON 24 'Left Paw hip
    LPawKnee CON 25
    LPawFoot CON 26

    LPawHipV VAR Byte
    LPawKneeV VAR Byte
    LPawFootV VAR Byte

    RpawHip CON 29 'Right Paw hip
    RPawKnee CON 30
    RPawFoot CON 31

    RpawHipV VAR Byte
    RPawKneeV VAR Byte
    RPawFootV VAR Byte


    DO

    GOSUB RPaw_Down
    GOSUB LF_Down
    GOSUB RR_Down
    PAUSE 500
    GOSUB LPaw_Up
    GOSUB RF_UP
    GOSUB LR_UP
    GOSUB RPaw_Rotate_Backward
    GOSUB LF_Rotate_Backward
    GOSUB LPaw_Rotate_Forward
    GOSUB RF_Rotate_Forward
    GOSUB RR_Rotate_Backward
    GOSUB LR_Rotate_Forward
    PAUSE 200
    GOSUB LPaw_Down
    GOSUB RF_Down
    GOSUB LR_Down
    PAUSE 500
    GOSUB RPaw_Up
    GOSUB LF_UP
    GOSUB RR_UP
    'PAUSE 400
    GOSUB LPaw_Rotate_Backward
    GOSUB RF_Rotate_Backward
    GOSUB RPaw_Rotate_Forward
    GOSUB LF_Rotate_Forward
    GOSUB LR_Rotate_Backward
    GOSUB RR_Rotate_Forward
    PAUSE 200

    LOOP

    '---Subroutine

    RPaw_Down:
    'RPaw
    pw = 750
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RPaw_Rotate_Backward:
    ra = 11
    pw = 500
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 800 TO 750 STEP 20
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    RPaw_Up:
    'RPaw
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RPaw_Rotate_Forward:
    ra = 11
    pw = 650
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RPawHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN

    '

    LF_Down:
    ra = 11
    pw = 650
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 700
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LF_Rotate_Backward:
    ra = 11
    pw = 850
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 800 TO 750 STEP 10
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    LF_UP:
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 900
    'ra = 9
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LF_Rotate_Forward:
    ra = 11
    pw = 650
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    ra = 10
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN

    '


    RR_Down:
    'RR
    pw = 750
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RR_Rotate_Backward:
    ra = 11
    pw = 850
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 750 TO 700 STEP 10
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    RR_Up:
    'RR
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RR_Rotate_Forward:
    ra = 11
    pw = 1000
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RRHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN



    '
    '
    '



    LPaw_Down:
    'LPaw
    pw = 750
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LPaw_Rotate_Backward:
    ra = 11
    pw = 1000
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 800 TO 750 STEP 20
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    LPaw_Up:
    'LPaw
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LPaw_Rotate_Forward:
    ra = 11
    pw = 850
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LPawHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN

    '

    RF_Down:
    ra = 11
    pw = 700
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RF_Rotate_Backward:
    ra = 11
    pw = 650
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 800 TO 750 STEP 10
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    RF_UP:
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 900
    'ra = 9
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    RF_Rotate_Forward:
    ra = 11
    pw = 850
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    ra = 10
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", RFfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN

    '


    LR_Down:
    'LR
    pw = 730 'offset due to servo instalation
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LR_Rotate_Backward:
    ra = 11
    pw = 650
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    FOR pw = 750 TO 700 STEP 10
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    NEXT
    RETURN

    LR_Up:
    'LR
    ra = 11
    pw = 1100
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRknee, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    pw = 800
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRfoot, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    RETURN

    LR_Rotate_Forward:
    ra = 11
    pw = 500
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SC", LRHip, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    RETURN
  • FranklinFranklin Posts: 4,747
    edited 2009-10-05 22:46
    al-spider, 8legs or 6legs?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • al-spideral-spider Posts: 42
    edited 2009-10-06 01:21
    HELLO ALL

    MY BOT is the 6 six legged HDAT crustcrawler
    i changed out the controllers from the PSC to the PSCU.
    FIRST i had the legs connected as Leg1(0,1,2,) Leg2(4,5,6,) Leg3(8,9,10) ran your code and got nothing no movement at all from legs.
    After looking at your photos closer i change them to the way your bot is connected with Leg1(0,1,2,) Leg2(5,6,7,) Leg3(9,10,11) both jumpers installed on pscu ran your code and still nothing.changed out PSCU batts to full chaged ones and still nothing.
    i have some photo but i need to change the size will try and attach later.
    have you gotton your's to walk yet??
  • al-spideral-spider Posts: 42
    edited 2009-10-06 04:17
    here are some photos of my project
    i have both PSCU working i mean i have a red power led and a green data led seem to blink as if the code run though the PSCU
    The battery's used are two 7.2v/2000mAH Ni-Cd on the PSCU's

    the last photo is a small bot in the works but i'm hopeing that the stingray controller well be sold on it's on wonder what the max motor allowed the motors on the stingray are on the small side.
    3264 x 2448 - 2M
    3264 x 2448 - 1M
    3264 x 2448 - 1M
    3264 x 2448 - 2M
    3264 x 2448 - 2M
  • vanmunchvanmunch Posts: 568
    edited 2009-10-07 00:31
    Hey al-spider-

    Sweet robot(s)! Yes, I've gotten mine walking, but you might have to mess-around with the "Pw" values for the different servos since your's is a different shape. Your other robot looks really cool too.

    I think that I see your problem with getting your servos working. Looking at the first picture I see that you are using a BS 2p 24 microcontroler that runs at 12,000 instructions/sec. When I wrote the above code I was still just using a BASIC stamp 2 that runs at 5,000 instructions/sec. That's why the code reads, " baud CON 396." I then switched to a BS2sx that runs at 10,000 instructions/sec or 2.5 times faster. I found that my servos didn't work until I multiplied 396 by 2.5 = 990 I think that you need to change the baud number from 396 to 950.4 (396 x 2.4) but I can't guarantee that it will work. 950 might be close enough.

    One other thing that you have to do with the two propeller servo controllers is make sure to program one as the number "2" so that it knows it's suppose to respond to servos 16-31. The instructions are at http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/28830-PropServoControllerUSB-v1.0.pdf Make sure that you don't accidentally program both of the servo controls as number "2." I did that and had to change one back, but the instructions they give will help you avoid that mistake.

    Anyhow, download the code to your BS2p24 and let me know if that Baud thing fixes it, otherwise you might try using a BS2 with a baud rate of 396 just to make sure everything works. Have fun!

    Dave


    PS I re-read your post and one other thing is that you'll have to change the "Leg", "Knee" and "Foot" constants to match the way you have it connected on the propeller servo controllers

    example:
    LFhip CON 5 'Left Front hip --->LFhip CON "your value here from the propeller servo controllers"
    LFknee CON 6 --->LFknee CON "your value here propeller servo controllers"
    LFfoot CON 7 --->LFfoot CON "your value here propeller servo controllers"

    ect....

    I think you already did this, but just in case. [noparse]:)[/noparse]
  • vanmunchvanmunch Posts: 568
    edited 2009-10-08 22:23
    I have some videos uploaded to YouTube now at:







    enjoy!
  • al-spideral-spider Posts: 42
    edited 2009-10-09 00:45
    · hello all

    updateing my last post the photo with BSp24 is the old configeration with the g-pic install photo 4 shows the Bs2 installed.

    I had gotten ahead of myself a little had to go back and setup the pscu #1

    first checked ver.# 1.0,·set SBR mode o, set PSS mode 0,enable ch 0-15 .now i have the first three(3) leg working somewhat still need tuning a little but i can't getn the second pscu #2 working yet i've set the SBR mode o,set PSS mode 1 (15-30). iget the green led blinking but no sevro movement. ?what i'm i missing. well· am off to check out your you tube·video.



    set
  • photomankcphotomankc Posts: 943
    edited 2009-10-10 07:16
    So have you written your own gait then? I have been looking at the Lynxmotion Phoenix and part of the reason is the smooth, natural gaits as well as other positions and crab-walking I have seen it do. I want a walker since I'm in a carpeted home which presents issues to wheeled bots and walkers tend not to go into hyperdrive and smash into stuff but I'm very hesitant to stray from the already programmed controllers that have the gaits setup. I really just want to mount my propeller board and have it do the higher brain work with sensors and just tell the thing to move forward, or turn left, ect. Have you found much good documentation on the Lynx electronics? They don't seem to provide much detail which is another reason.... aside from cost... I have not gone that route yet.
  • Brandon C.Brandon C. Posts: 106
    edited 2009-10-10 15:35
    Here are all the electronics guides - www.lynxmotion.com/ViewPage.aspx?ContentCode=electronics&CategoryID=70

    Programming the BasicAtom (the MCU that the Phoenix comes with) is relatively easy. All the programs are there for you to get started.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • vanmunchvanmunch Posts: 568
    edited 2009-10-11 21:59
    Hey photomankc,

    Yes, I've programed a couple of different gaints. I haven't had a lot of time to refine them because I want to start mixing some sensors into the pot. I posted three videos of my hexipod (above). One, using the "standard" Lynxmotion electronics and code generated by their PowerPod. That was pretty simple,... after I found a computer with a serial com port. However, I didn't really feel satisfied with the amount of control that I had over the whole process so I replaced the electronics with a BS2 and 2 of the new propeller servo controllers. So.... that's what the other two videos show. The code that was running on the BS2 in the videos is posted above. I know it's really rough and it would be great if someone could help refine it. Right now it just walks forward... fearlessly into whatever. [noparse]:)[/noparse]

    Hey a-spider,

    That's puzzling, I would try working backwards to fine the problem like swapping the batteries to make sure power is going to both PSCs, trying a servo connected to the second PSC and connecting it the the 1st one, checking to make sure the code matches the pins the servos are connected to, make sure your connector between the two PSC is connected correctly, lot of time just messing with it [noparse]:)[/noparse] ...... maybe post another picture of your set-up? When I first connected everything, I spent an evening trying to get the silly servos to move. I tried everything, then around 10:30 I realized that I had only been moving the three point switch on the BS board to the first position, not the second one! Opps! Oh, well that's what keeps us humble. [noparse]:)[/noparse] Keep us informed on how it goes.

    Dave
Sign In or Register to comment.