Arduino Quadruped Walking Robot

UPDATE 24.April 2011: New video! :) I implemented automatic resetting of the legs positions before changing from forward/backward walking to left/right walking. This is to ensure proper leg offsets. Previously I had to press the Z button on the nunchuk to reset, now it happens automatically, so one step closer to becoming autonomous. In this video the gait is the same for walking and turning (trot gait) only the duty factor is higher for turning (beta = 0.75) which means the leg stays on the ground for three quarters of the leg walk cycle time and only one quarter in the air. 

I'm not sure if I'll go with this sort of automatic position resetting (right now all the hips and knees just move to their center positions (because that is a suitable start position for both walking and turning with the trot gait) but I'm thinking it would probably be better to step the legs to center if they are further away from center than some threshold. So if the leg1's hip is at 51%  and knee at 40% let's say it will just move the hip for 1% and knee for 10% down, while if the leg2's hip is at 90% and knee at 100% let's say (that means the leg is extended to the front and is touching the ground) it would probably be better to step to 50% - like so: lift knee to 0% and then move hip to 50% and then put knee down to 50%, so it won't move the body when it starts to move leg2. I don't know maybe it's not such a good idea, I guess I'll see when I try it :)  

I'll probably use the trot gait for faster walking, while the crawl gait is more suited for slower walking (better stability). Very soon I will start with adding sensors and working on the autonomous mode.

-----------

UPDATE 23.April 2011: New video that shows robot walking with crawl gait (creeping) and turning with a 2/2 gait (trot gait but with the same duty factor as for the crawl gait (bigger duty factor for turning than in the previous trot example (the one with the wireless nunchuk and forward/backward motion only) for increased stability -> beta = 0.75, this means that 3 quarters of the leg cycle are 'spent' on the floor, while only one quarter in the air, check attached .zip file for more details on the theory)). However I have some problems. First problem is that I have real stability issues. When turning it trips over very easily (especially when going slow or really fast) and it turns much better to the right than to the left (stability wise) and I think this is mainly due to the fact that my legs are all handcut, glued together and screwed on the body so there's a lot of little mistakes that add up :) I think the problem is mainly with one leg being a bit too big and being a bit angled so the length of the leg changes with the hip move... I have to fix that, but I think maybe it's better to make a 3d model with the prototype's dimensions in Sketchup or something and then have it machined somewhere so the legs are really the same. Also I'm thinking of maybe building a new leg design, just to try out how it performs... I was thinking of something like this: http://www.youtube.com/watch?v=NAHo8eEbJCE&feature=related , I see here http://www.youtube.com/watch?v=msaWXY3OuQQ they're all using a very similar design just that it's 3dof. I think they wouldn't look as cool on a quadruped :) but maybe it is a better leg design, I don't know. I will have to throw something together to test someday (when I'll feel like making 4 new legs :)). Also the weight distribution is not ok and I think this amplifies the balance/trip-over issues. Tomorrow I'll buy some 2-battery holders and try to distribute it more evenly along the body's length. The second problem is that (as you'll see in the video) I have to reset the legs positions before I go into turn. That is to ensure the right offsets between legs positions and set the phases of the legs (I decided to split (mentally and in code) the leg walk cycle into 2 phases: step phase (when the leg is in the air) and pull phase (when the leg is on the ground)). This mandatory resetting is not optimal at all, because that means I will have to program the same behaviour in the autonomous mode, which by itself (implementing the auto-position-reset) is not really difficult, just that it's not pretty and natural, organic if you will :) There has to be a more elegant solution, probably mathematically more complex (I hope not too complex for arduino or for me ;)), but I am afraid I will have to rewrite most of the code (which wouldn't be such a tragedy, I don't have that much anyway and still full of bugs :), if only I had a good solution to the problem).  I'm searching for some cool ideas/solutions for this problem, if anybody has any. Is the IK (inverse kinematics) only option here, what do you think? Also I was thinking how it could walk on curved paths, like arc or something, and came to the conclusion I would have to implement the system like in servo controllers (eg. ssc-32), so I could specify the time in which to arrive to the destination, because now I am solely relying on all the legs being identical (as in all having the same servo travel, so all hips have let's say travel of 100 degrees, while knees have travel of 50). So to keep the gait regular and symmetric while turning I would have to adjust the speed for the timing to match up, so if the hips' travel on the left side of the robot let's say (if walking and turning left at the same time) should be shorter than on the right side.

Tomorrow I'll hopefully test, shoot and upload the video of trot gait for walking and turning (but with different duty factors maybe?) and try some other stuff to solve the gait transitioning problem and also check if I can improve the balance and weight distribution.

----------

Hello everyone, I am new to this site (at least as a member), but I've been lurking around for a while looking for some cool ideas and I must say the site is really awesome.
I have to say this is my first robot and it was inspired by KatteJuice's SC-QR-1 robot, big up to him for showing what can be done with some hot glue and 8 cheap servos! I definitely wouldn't try and make a four legged robot as my first robot otherwise, mainly because you always see all those high grade servos and brackets and special controllers and whatnot when looking for hexapods and quadrupeds. Don't get me wrong, I would immediately fork out for dynamixels and aluminium brackets if I had the dough :). I see that when you actually try to build something like this, you find that in the long run you would probably be better off (quality and durability wise), but I learned alot and that's why it's better to start with nothing and build upon experience I think. Also I'm not much of a handyman, never been, so I neither have the tools nor the patience to make anything complicated (or anything where precision is key, like 4 identical legs) and so construction was the most difficult part for me. I am slowly getting into it though.

I started with the leg prototype, very similar to kattejuice's leg design, because I saw how well it works. The first material I used for the legs was plastic from cd casings, because I knew that I wanted at least prove the concept and have some sort of walking gait working without legs having to actually support anything, before I go and make all 4 legs. I searched google for info on walking gaits and robots. I found some book that had a preview chapter on google books, and it was just what I needed. Not too deep, only the basics, just enough to get me started. I can't remember the title, but I made screenshots :), and I can attach the files, if anyone is interested. The first tests went very well, so I made 4 of them and tried to walk, (just for fun, I knew they're too weak). Then I made legs v2, that were more solid, because I bent them 90deg to make them stronger. The plastic was still the same. Not good enough! :) So I went and made legs out of 3mm thick plastic 90 deg angled piece (dimensions: 30 mm x 30mm x 3mm x 1200mm). I chose an angled piece only because with my previous prototypes I had to do quite a lot of heat bending the plastic to make it more rigid, so I decided it's easier, better looking and stronger if I start with a piece of plastic that already has an angle and use it to my advantage.  

Leg (last version)

Also the last version has knee servo horn directly screwed and glued to one of the connecting pieces (upper), instead of transfering the force via the lever (?? not sure if this is clear?) like in the previous prototypes, it gives much less play, the movement is more immediate.

 

3 cm width wasn't enough to make hip brackets, so I had to improvise and hot glued 2 L pieces together to form a U piece that was 4cm or so high. Not so optimal solution but it works. I'll have to try and find some wider plastic and preferebly U-shaped for the hip brackets.

.  

But I still needed better support for the hip joints (so the legs wouldn't splay that much in the hip), I had to make some sort of pivot shaft at the bottom of the servo. I made a hole in the bottom side of the hip bracket and screwed in a screw through the bottom part of the knee bracket and it worked out nicely. (It looks like it's screwed in, but the hole is big enough so it can rotate freely.)

 

quadruped robot without cover

For now I am powering everything from 5 NiMh AA rechargables, but I am strongly thinking of going to 2s LiPo battery instead. Mainly because it would probably make for a lighter robot, and also I guess the weight distribution should be better if I choose a low profile flat battery that fits in the body better. Question: Does anybody know of a BEC capable of supplying around 6A give or take (8 x 750mA for hxt900)? Or will I have to have 2-4 of them? Or do I just put some diodes to lower the voltage to 6V for servos? If so, how do I make sure not to overdrain the LiPo then? Any suggestions?

Currently I am using a wii nunchuk (wired and wireless) as an input device, mainly because it's convenient to be able to control the movement or the speed of movement - it's easier to figure out stuff if you can slow down things let's say, and it's also so cool :) Wired nunchuk works like a charm, but sadly the wireless version has some issues. The first problem was figuring out how to sync the controller to the receiver :) I tried holding down sync button on the controller, and the FC button(??) on the receiver. To no avail. Then I remembered I have a Wiimote from a couple years ago (used it for WiimoteWhiteboard with my homemade IR pen and for drumming (sample triggering with Wiinstrument) and for snes arcade emulator control :) ) So I connected it to the wiimote, then bound the wiimote to the computer, and guess what, the controller paired almost instantly, no holding down the sync button necessary, just a touch :) So back to Arduino. I noticed that the LED on the controller was brighter when connected to the wiimote than when I had it connected to 3.3V on Arduino. So I thought maybe the voltage is not high enough. I plugged it in 5V and it was brighter and it worked, but only after I removed all the resistors from the Data and Clock lines. So I figured it out, hooray! But here's another problem. Now that everything works, I see the bloody thing only outputs a series of 9 equal values ?? WTF!? After googling around I see others have the same issue. Great! I thought maybe if I decrease the polling delay (it was 100 ms) I can live with 10 times lower sampling frequency. Well I thought wrong! You can't go faster than 80 ms or so, maybe 50, but then the errors increase as well. So I am stuck with lame sampling frequency that makes controlling anything really laggy and not enjoyable. Also it loses sync every couple of minutes, you can see it at the end of the video. At the time of writing I can't even sync them together again. I will try to fix the issues, but in the worst case scenario I will just use wired nunchuk for developing and programming, while the crude wireless chuck will be used for basic control if anything goes wrong with the autonomous code (non-existing yet :) ).

As for the programming part goes, I wrote some classes so I can reuse stuff easily. So for example I have a Hip and Knee classes (I will extract them to Joint class, because they're basically the same, only the naming is different (eg. knee.up() vs. hip.forth()), which together make a Leg object. Four legs then form a Quadruped class that has functions like forward(), backwards() etc., so you can have very simple loop function like { if (speed > 0) quad.forward(speed); })  I'm not sure how I will implement smooth transitioning between gaits, e.g. I want to have a trotting gait (I think it's called that way) for forward/back motion let's say, but have wave gait (crawl/creeping) for turning maybe... They have different leg timings and positions and when controlled with a nunchuk you have to be able to convert from one to another at any point in time. Definitely I will have to rewrite some code to make it better (it's very buggy and crude), because at the moment I have nothing that would recalibrate legs at specific points (if this is even the way it's done??) in time or position so they eventually go out of optimal timing, even more so if I change directions of walking and walk very fast). If anyone has experience in programming walking gaits and has any valuable knowledge to share on how to go about programming such thing, I would be very grateful!


When I'm done with implemeting the walking, turning etc. I will add some sensors to it  (oh yeah and a piezo speaker for sound fx! I have one ready waiting to be mounted) and make it (more) autonomous. I'm thinking a PIR sensor for starters, only because I already have one, and have never used one. Probably I will use it as a motion detector, to put a robot to "sleep" when there's no activity in the room.

Built with:
8x hextronik hxt900 (9g) servos (actually 7, one was replaced by tower pro sg90, because the gears broke, I think it was my fault :) ),
Arduino Uno,
selfmade arduino servo breakout shield,
wii wireless nunchuk (Sweex brand),
5x 1.2V rechargable AA batteries,
1 project box,
homemade servo brackets (3mm plastic),
couple of screws, nails and some hot glue

Cost to build: Around 100 € (for now)

I'm sorry for the low quality video, it was recorded on a phone, then compressed when emailed to myself and compressed again on youtube. I have a bunch of the older ones (first prototypes, the wired control etc.), I can upload some more if you want. I will upload some photos of details as well.
Sorry for the long essay without head and tail. I hope somebody got through all that mess. :)

walks on four legs

  • Actuators / output devices: 8x hextronik hxt900 9g servos (one dead, so now 7x hxt900 + 1x tower pro sg90 :) )
  • Control method: wii wireless nunchuk (not autonomous yet)
  • CPU: arduino uno
  • Power source: 5x 1.2V rechargable AA batteries
  • Programming language: Arduino
  • Sensors / input devices: wii wireless nunchuk
  • Target environment: indoors mainly

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/arduino-quadruped-walking-robot

Holy! That’s a big font!

Love the gait. I’ve spent a lot of time recently thinking about a quadruped and this really turns me on. It’s got a good stomp factor to it. Have you got it turning or sidestepping yet?

Oops, fixed that…

Thanks! Actually, the way I have it coded right now, it is very simple to change from forward to turning motion for example (forward would be: { leg1.moveForward(speed); leg2.moveForward(speed); leg3.moveBackward(speed); leg4.moveBackward(speed); } and turnLeft would be: leg1.walkForward(speed); leg2.walkBackward(speed); leg3.walkBackward(speed); leg4.walkForward(speed); }), the problem is that for turning with the setup I have right now there is no dynamic stability (meaning 2 leg support at the time is not enough for turning while it can be enough if you have the right speed and duty factor if I understand this correctly). While I could change it to always have 3 legs stability, it would be quite easy and I already had that, I kinda like this gait for forward motion because it is quite fast. For turning I would like to have 3 legs always on the ground, but mixing the two gaits is not that easy, at least the way I have it set up right now. I will refactor the code soon, I just have to experiment some more before I get to it.

Sidestepping I don’t even know if it’s feasible to tackle, because these 2DOF legs can’t move really far in that direction, so it would take ages to get somewhere… but yeah, maybe for minor adjustments in y axis… :slight_smile:

Very nice robot

I like the way it moves and the design is simple and efficient. Great work ! I hope to see it turning right and left soon :slight_smile:

Hi RawBot, the bot moves

Hi RawBot, the bot moves well, and looks great too.   how did you make the server brackets?

Ah yes, 2DOF

I swore it had a couple extra servos. No big deal. Still love it :slight_smile:

what would happen if the

what would happen if the right legs went foward and the right went back would it turn nicely? or what?

im thinking about a 4 leg

im thinking about a 4 leg robot but want to use a picaxe that can control at least 12 servos do you know of a chip maybe 40x1 but is there a board that works with the 40x1? 

You may try SD21 servo

You should try the SD21 servo controller. You can control up to 21 servos and also you may use the picaxe 18m2 chip inside of it for your other needs. I have one and I must say it is a blessing: easy as hell to control + adjustable speed. What more could a man ask for? :smiley:

Thanks! Hopefully I’m going

Thanks! Hopefully I’m going to post a video showing that tonight/tomorrow. If I can find the time :) 

Hi!

I uploaded some pictures, I hope now you can better see how the brackets/leg was constructed. On the first prototypes made out of thinner plastic I had to do quite a lot of heat bending to increase rigidness, therefore the logical choice was to pick something that already has the 90 degree angle. :wink: Here’s how the right angled L piece looks like (the picture is upside down):  

IMG_0694.jpg

Yeah that’s how you turn,

Yeah that’s how you turn, but with the timing you see in the first video where there are only two legs supporting the body, it would just trip over… especially with my current weight distribution, where I have one big heavy 6-battery-holder of batteries in the middle of the body. Current gait is good enough for fast walking, but not well suited for turning. If I change the gait to crawl gait (always 3 legs on the ground), it would definitely work.   

sd21 servo controller

sd21 servo controller hmmm…  where can I get it and is it programable with picaxe basic?

is it possible to program

is it possible to program the gait to be the same as in the video but when it goes to turn then the gait could change?

Nice

This thing looks awesome man. Walks really well and seems pretty quick!

good job!

please update video :wink:

please update video :wink:

Thank you!

Yes, I think it is quite fast too, it even walks better (at least more stable) when going fast. I’m uploading a new video with crawl gait for walking that shows a bit of turning at the end.

 

 

Hi robokid

I think it is :). Like I said I’m thinking of different ways how to tackle this problem. At the moment to achieve this I have to reset the legs positions with the Z button on the nunchuk. You’ll see it in the video I’m uploading. I have to come up with something more elegant, I think. I mean I could do it automatically before it decides to turn when programming an autonomous mode, but I feel there has to be some better solution, that would be more natural and universal. In the video I’m uploading you’ll also see that the quad moves forward with the crawl gait this time, but opposite to what I thought, it is turning quite well only on two legs, only the timing of the step has to be different (the same as for the crawl gait at the moment - duty factor of 0.75, so three quarters of the time of one step the leg is on the ground and one quarter in the air). Probably I should post the pages of the book I was talking about, so we can all be on the same page (pun intended :)) with terminology and the gait theory will be 10 times better explained there (with graphs and all ;))

 

i love it! coolest quad yet.

i love it! coolest quad yet. I actualy dont think that the reseting of the legs is that bad kinda looks like it is striking a pose :slight_smile: the walking of the robot rocks so smooth. just a thought try rhe picaxe 28x1 experimenters board (get it here: http://www.solarbotics.com/products/28541/ ) it can control up to 8 servos and I think three analog inputs and 8 digital inputs but it is so easy to control just type in the program editor servo 0,1,2,3,4,5,6,7,or 8, 150 to get it to go to center that easy!  hope you dont mind me asking but how old are you? im twelve?

Yeah it looks kind of

Yeah it looks kind of predatory doesn’t it, like it’s going to attack :wink: For the moment I’m quite happy with the arduino and it’s capabilities (software and hardware), although I’ve heard that picaxe is also great and cheap. Definitely have to grab me one of those sometime, maybe for smaller projects. BTW, KatteJuice’s SC-QR-1 quad was built with picaxe if I’m not mistaken and it worked very nicely. Check out the video http://www.youtube.com/watch?v=H-SIA3eCamc , I think he says in the infobox or in the comments which picaxe he’s using (I think it is 28x1, or is it 18x1, not sure…). Basic is really simple for servo control I’ve heard, but AFAIK you can’t have microseconds accuracy for servo positioning (PWM), which arduino has (although I’m currently not using it with my code yet, it should work smoother when I increase the position resolution from degrees to microseconds). Also I don’t know if I can write my own libraries in basic?

I’m 28.

Thanks for the kind words and support! :slight_smile: