The first question someone would ask when they see a hexapod – especially a 3-servo one – is “how does it walk?” Today with Youtube, the answer may be a little simpler as you can actually see how they move, but really understanding it takes some thought. A picture is worth a thousand words, so I’ve created this animated GIF that should give you some insight:
What this illustrates is the principle behind Pegleg’s motion. One side is lifted up by the middle legs; the driving legs on the lifted side then go forward to prepare for the next step while the driving legs that are on the ground move backwards to propel the robot forward. The process is then reversed for the other side. Backwards motion is done in a similar method except the driving leg motion is opposite. Turning motion is done by rocking back and forth with the middle legs while the driving legs on each side act like one side is propelling the ‘bot forward, while one is propelling the ‘bot backwards.
Putting the legs in motion is accomplished in slightly different ways for the driving and the middle legs. The driving leg pictured here is driven by one of the side servos. As this servo rotates, it’s linkage is pushed or pulled in sinusoidal motion similar to the wheel of a train.* The other driving leg is linked to the first by the longer linkage not directly attached to the servo’s arm. This drives both driving legs on the same side in unison. The other set of driving legs is free to do whatever the opposite servo tells it to.
The middle set of legs is different in that the two legs move in opposite directions. One goes down while the other goes up. Near the bottom of the “foot” screw head, the linkage is attached and held down with a nut. When the servo rotates away from this “foot”, the motion is restricted in a way that forces it to go in the downward direction. When it rotates towards it, that leg goes up. This is a pretty good example of a four-bar-linkage, except the motion is in more than just one plane.
Kinematic Analysis and Optimization:
When you build a hexapod or at least think about building one, you might ask how far the middle legs could travel or what is the best position for each servo? Initially, I didn’t really do any analysis on it, but as it would later be under some actual academic scrutiny (a southeast regional ASME meeting) I thought this might be a good thing to do.
There is certainly a more complicated and more theoretical way to do this, and I would hope that, at some point in my education, I could have done it, but in analyzing the driving legs, simply drawing it on AutoCAD in the different positions gave some very good optimization results. Show below are these drawings for the driving legs, the first with the servo and linkage at the middle position, the second shows the original range of motion, and the third shows the optimized range of motion:
As can be seen here, with a straight up/down 180 degree rotation, the original range was 29 degrees and 1.69 inches, where after optimization the travel was increased to 32 degrees and 1.85 inches. That doesn’t seem like a lot at first glance, but it’s around a 10% improvement, not bad for a programming change. Drawing this on AutoCAD, the inner circle represents all possible positions that the linkage can end on at the leg. The blue circle inside the servo represents all possible positions for the linkage connection on the servo arm.
The best way I found to optimize this is to draw a line representing the linkage and connect it to the servo arms effective diameter (where the linkage actually connects). Rotate it and see where the end intersects the inner leg circle. By experimenting with this (move it a few degrees at a time) you can find the point where the leg gains the best travel. Repeat this for the bottom and you have your best servo position.
For the middle leg, there was really no reason to optimize as the 90 degree servo position was the obvious mechanical limit. But, if one were to want to analyze how high the leg could go up or down it could be looked at as the four-bar-linkage shown below:
Although there is always a mathematical way to express this sort of thing, AutoCAD works pretty well too. A realistic picture is drawn in the first image where the second resolves this into a more technical drawing. As shown, the only variable is the distance in the X direction between where the linkage connects to the servo and the pivot.
If you draw a circle around the starting point of the intersection of “b” and “c”, then draw a circle around the pivot representing “d” as shown, the intersection will give you the middle “foot” point. Move the larger circle .50 to the left and right and the intersection will give you the top and bottom “foot” points. Measure the distance between the two and there you have it, your “lift leg” travel.
The other solution of course would be to simply experiment until you get it just right or leave the rotation at 180 degrees up and down and forget about it. However, if you’re the kind of person that will spend the time to build a hexapod like this, you probably want to make sure it’s running as well as possible. This is actually a pretty good lead in to our next post about programming and servo control. Even though this optimization definitely helped, changing how I controlled the servos increased the speed of this ‘bot more dramatically than anything else I tried.
*This has a neat effect of while the servo’s motion is steady in an angular velocity, the linkage’s linear motion actually slows down towards the beginning and end of it’s cycle.. I’ve actually seen this used in an industrial environment with a rotary air cylinder. This is definitely old-school technology, but very effective if you want to slow something down toward the end of a stroke. I’m not going to explain it exactly, but the math behind it is that the difference between sine 0 degrees and 5 degrees is much larger than the difference between the sine of 85 and 90 degrees.