Let's Make Robots!

My first biped 2.0

Sorta walks

This is my first attempt into making a biped walker.  I have no such background in either electronics or robotics.  Nor do i have any experience with tools or crafting. 

My first robot was the start here bot kit that i got from solarbotics.  I had a blast putting it together. While i learned a lot from that kit it made me hungry for more. So for Christmas I got a new Picaxe 28 board and 8 servos and went to work trying to do something else. After a while and many failed attempts to produce something worthwhile i shelved it. I was digging around on youtube and i saw a Lynxmotion robot biped walker. It sparked and interest in me making a walker of my own and i thought i would give it a shot. The above videos are what I came up with after about 3ish hours of work.

The frame is built from 1/8 inch PVC sheets that I cut using a jigsaw and held together with hotglue and screws.  I am currently using zip ties to hold the battery and picaxe board on as I haven't figured out a more permanent solution (I am thinking Velcro.)  As seen in the video above i am using one servo to push a foot up and change the center of balance so when the second foot servo moves it balances the weight over that foot (if that makes any sense)  Then i use the hip servos to move the other leg forward.  Then both leg servos center and then the hips center.  Then it repeats the process over and over. 

This is still very much a work in progress and i am looking for any feed back, comments, or criticism.  Realize that I have little grasp of complicated concepts and have never worked with anything but what is in the start here kit.

 

Update 2/13/12

Just uploaded a video of my newest changes.  I increased the servo move speed to max thanks to a suggestion from merser.  I also added some rubber bands for traction and reduced the hip motion to help with stability.  I am going to look for a permanent solution since I do not like the look or feel on the rubber bands.

 

Update 2/20/12

I took a suggestion from Ro-Bot-X and tried moving the legs in closer to the center of the "waist" and it worked like a charm.  It is now really easy to change the center of balance and it makes walking much smoother.  I also slowed down the walking to Pause 500 in picaxe and that helped stop most of the sliding i was having (some is still there and it still slides hard to the right (as seen in the new video it was going to walk off my desk.))  My next step is to work on left and right turning and some fine tuning of walking straight.  After that i am planning on adding a sensor for object avoidance.  I was thinking ultrasound but i am not sure.  If anyone has any suggestions or feedback i would love to get some.  Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Did you try my code? It is attached to my robot's page, in the zip file. You can play with the Speed value to get it to move faster (lower value) or slower (higher value).

Sorry, I didn't notice you're using Picaxe...

In this case, open the files in a text editor to see how I defined every move. A Forward Step is defined as a suite of tilts and swings. Same for a turning step. Then each tilt or swing is defined as a for loop. It starts from the curent servo position and increases (or decreases) it by 5 degrees at each pass through the loop until it gets to the destination position. You can step less degrees, say 2 at a time for more smoothness. The Speed variable is used to delay the next servo pulse. If we wait just a little, the servo will gp faster to the desired position, if we wait more, it will go there slowly. In the Picaxe program you will need to use global variables because you can't pass speed and angle arguments to subroutines (as far as I know...) so I hope you can manage to do it. I'm sorry I can't help you out more with this, I do not know Picaxe programming.

I got the jist of what you are saying here and I just tried it out (I did Download and check out your code but it looked greek to me in my noobish ways).  I am now moving the servos at 2 pluse intervals and it moves slower and 5 puls intervals and it moves faster but both methods have far more traction.  It looks like this (I havent cleaned the code up yet)

Right:
Servo 3, 130
servo 1, 150
pause 300
Servo 7, 145
pause 30
Servo 7, 140
pause 30
Servo 7, 135
pause 30
Servo 7, 130
pause 30


servo 1, 170
Servo 3, 150
pause 300




Servo 7, 130
pause 30
Servo 7, 135
pause 30
Servo 7, 140
pause 30
Servo 7, 145
pause 30

servo 7, 150
pause 30

goto Right

 

AND

Right:
Servo 3, 130
servo 1, 150
pause 300
Servo 7, 148
pause 30
Servo 7, 146
pause 30
Servo 7, 144
pause 30
Servo 7, 142
pause 30
Servo 7, 140
pause 30
Servo 7, 138
pause 30
Servo 7, 136
pause 30
Servo 7, 134
pause 30
Servo 7, 132
pause 30
Servo 7, 130
pause 30


servo 1, 170
Servo 3, 150
pause 300




Servo 7, 130
pause 30
Servo 7, 132
pause 30
Servo 7, 134
pause 30
Servo 7, 136
pause 30
Servo 7, 138
pause 30
Servo 7, 140
pause 30
Servo 7, 142
pause 30
Servo 7, 144
pause 30

Servo 7, 146
pause 30
Servo 7, 148
pause 30


servo 7, 150
pause 30

goto Right

Ok, why don't you use a for loop? Instead of writing a long list of servo 7, position you can write the for loop like this:

for i = 145 to 130 step -5
       servo 7, i
       pause 20
next i

for i = 130 to 145 step 5
       servo 7, i
       pause 20
next i

 

Now say in the first for loop the robot is tilting right about 15 degrees. You can write a subroutine called Tilt_right_15:

Tilt_right_15:

for i = 145 to 130 step -5
       servo 7, i
       pause 20
next i
return 

 

then another subroutine called Tilt_right_center:

Tilt_right_center:
for i = 130 to 145 step 5
       servo 7, i
       pause 20
next i 

Similar, you can write subroutines for swinging forward. Another thing, it is better to move both feet servos at the same time and both shoulder servos at the same time. For example, if Servo 7 is the right foot and Servo 6 is the left foot, withe the Tilt_right_15 like this:


Tilt_right_15:
for i = 145 to 130 step -5
       servo 7, i
       servo 6, i
       pause 20
next i
return 

 

Then you can wite a subroutine Forward_step:

Forward_step:
       gosub Tilt_right_15
       gosub  Swing_forward_left_40
       gosub  Tilt_right_center
       gosub  Tilt_left_15
       gosub  Swing_forward_right_40
       gosub  Tilt_left_center
       gosub  Tilt_right_15
       gosub  Swing_forward_left_20
       gosub  Tilt_right_center
return

This is similar with the code I wrote for Arduino. Take a look again and play around a bit.

Cheers!

I was wondering if you could pass variables to PICAXE basic subroutines. I forgot that all variables in PICAXE basic are global. You could write a subroutine that tilted right and before calling it set the necessary variables.

SYMBOL tilt = b12
;These SYMBOLs are set just incase 150 isn't exactly center for your servos
SYMBOL leftFootCenter = 147
SYMBOL leftHipCenter = 151
SYMBOL rightFootCenter = 154
SYMBOL rightHipCenter = 149

Forward_step:
   tilt = 15
   gosub Tilt_right
   tilt = 40
   gosub Swing_forward_left
   ...
return

Tilt_right:
   for i = tilt to 0 step -5
   servo 7, leftFootCenter - i
   servo 6, rightFootCenter - i
   pause 20
   next i
return

You may kindly disregard my comment if it seems Greek.

Hehe, that's exactly what I did in my code. I use the center value for each servo and I substract or add the necessary angle for the feet/hips to be in the correct position. But I tried to simplify the code a bit for him to understand it. Not sure I made it simply enough though. Usually, when you talk to people you kind of see what is their level of knowledge and start explaining accordingly. You get immediate feedback and you can adjust the level of your explanation until your message is understood. In a forum is a bit hard to determine that, so I took a shot and hoped for the best. I figure that if I find other people's code too advanced for my level of understanding, other people will find themselves in my shoes when looking at my code.

Thank you for thaking the next step, as it was hard for me to find how to properly write the code in basic. Funny, a few years ago I was programming in basic, seems that I forgot the sintax and what works and what doesn't. 

Thanks for all the help and good conversation from you and birdmun.  I am picking up a little here and there but i think it is time for me to buckle down and study some basic for picaxe.  Most of everything you guys said was really fuzzy and thats on me not you guys.  I have only programmed the Start Here bot I bought and I learned a little from that project but it seems like it was a drop in the bucket.  So if you will indulge me on question what is the purpose of the "for i =' in the code.  What does it tell the program to do. 

They allow a programmer to complete a block of instructions a finite number of times. If you wanted to print Hello World 5 times, you could:

print "Hello World"
print "Hello World"
print "Hello World"
print "Hello World"
print "Hello World"

OR you could:

for i = 1 to 5
   print "Hello World"
next i

i is being used as a counter variable in this case. i will start at 1 and print Hello World. next i will increment i by 1, in this case, and then the loop will print Hello World again. The for i = 1 to 5 part of the loop does the actual comparison and will check to see that i is less than or equal to 5. When next i is called and i gets incremented to 6 the loop will be finished and the program will continue with the instruction that follows the next i statement.

In Ro-Bot-X's example:

Tilt_right_15:

for i = 145 to 130 step -5
       servo 7, i
       pause 20
next i

return

The for loop counts backwards from 145 to 130 in 5 step decrements. Everything between the for and next commands will be executed as many times as is allowed by the loop, in this case 4 times. Because, i will start at 145 and the loop will execute. next i will be called and i will then be decremented by 5 (step -5) and will be 140 everything inside the loop will occur. i - 5 = 135 and the loop will run again. next i, i - 5 = 130 and the loop happens once again. next i, i - 5 = 125 which is less than 130, the loop exits and the next command is return.

I hope this helps.

Ok i used what you put here and i have it almost the way i have envisioned it.  The only problem i am having is the shifting of the weight from on foot to the other.  I cant figure out how to loop so both feet move at the same time for a smoother planting and thus less sliding.  Here is what i am using.

 

Tilt_right1:
for b0= 150 to 170 step 2
servo lfoot, b0
pause 30
next b0
for b1= 130 to 155 step 2
servo rfoot, b1
next b1
return

Tilt_left2:
for b0= 170 to 150 step -2
servo lfoot, b0
pause 30
next b0
for b1= 155 to 125 step -2
servo rfoot, b1
next b1

 

(Note:  I treied to use "for i="  but it kept saying i is an invalid syntax when I would run the syntax check in picaxe.  So i used b0 and b1 instead and hoped it wouldnt make a diffrence.) 

In my "overboard" response you may notice that I used leftFootCenter and rightFootCenter in the loops.

Tilt_right:
   for i = tilt to 0 step -5
   servo 7, leftFootCenter - i
   servo 6, rightFootCenter - i
   pause 20
   next i
return

If you set the variable tilt before you call Tilt_right, you will be able to make a common routine. Your Tilt_Right routine uses very hard coded numbers, aka magic numbers (bad word :P ).

Tilt_right1:
   for b0= 150 to 170 step 2
   servo lfoot, b0
   pause 30
   next b0
   for b1= 130 to 155 step 2
   servo rfoot, b1
   next b1
return

If you were to use my routine and just call it Tilt, you could pass it positive or negative numbers depending on whether you tilt left or right. You would also need to declare a variable that was LEFT = 1 and one that was RIGHT = -1. Now you set tilt to a whole number * LEFT or RIGHT before you call the Tilt subroutine.

SYMBOL LEFT = 1
SYMBOL RIGHT = -1
SYMBOL direction = b10 'Holds the value of the direction of tilt/swing 1 or -1
SYMBOL stepResolution = b9 'Controls how far the servo will move for each run through the loop

main:
   stepResolution = 2
   direction = LEFT
   tilt = 20 * direction * -1 ' We need the inverse to get the tilt in the correct direction
   gosub Tilt
end 

Tilt:
   for b6 = tilt to 0 step stepResolution * direction 
   servo 7, leftFootCenter - i 'This line and the next may need the + and - swapped
   servo 6, rightFootCenter + i
   pause 20
   next b6
return

My explanation does not, however, make the adjustment that you show in your code for the right foot. In your tilt right routine you have 130 to 155 and in your tilt left you have 155 to 125.

Another comment, in your Tilt code you use b0 for the left foot and b1 for the right foot. Your loops are not nested in your code.
Example:

'These loops are not nested. They do not reside one inside the other.
for b0 = 1 to 5
   print "hi"
next b0
'This is a waste of a variable.
for b1 = 5 to 1
   print "bye"
next b1

OUTPUT:
hi
hi
hi
hi
hi
bye
bye
bye
bye
bye 

'These loops are nested. They will require the use of two individual variables.
for b0 = 1 to 5
   for b1 = 5 to 1
      print "buy low"
   next b1
   print "sell high"
next b0

OUTPUT:
buy low
buy low 
buy low 
buy low 
buy low 
sell high 
buy low
buy low 
buy low 
buy low 
buy low 
sell high
... 3 more times

Clear as mud? :)

I would also suggest that you try to avoid using the first byte variable, b0, as it is the only one available for use as bit variables. Hence the reason I changed my Tilt routine to use b6 in the for loop.

Hmm, now it's time for me to take some notes... You gave me the idea how to shrink my code and eliminate all those similar functions I have, by using a few more variables. I'll look over my code and see how to implement this method. Changing the resolution will change the speed of the movement, which is good and it doesn't require the heavy floating point math that the interpolating method does. Thanks!