It can walk :D! It can move forward/backwards and left/right, as well as rotate in place. While it's not the fastest walking gait, I'm pretty happy with how it looks. It took me a couple of iterations, so I'll go through how I arrived at the current gait.
Obviously, before starting on walking, I just needed the robot to stand. Implementing inverse kinematics for the legs was pretty straightforward; since there's only 3 DOF per leg, the angles of each joint can just be solved analytically (law of cosines, haven't used you in a while..). Quick pre-programmed sequence:
Now for walking! I decided to try for the the creep gait, where only one leg is lifted and moved at a time, as opposed to the trot gait, where diagonal legs are both moved together. While the trot gait is generally faster, I don't think the servos I'm using are strong or fast enough.
The first walking gait I tried consisted of 4 basic states:
|The most recently moved leg in each state is highlighted in red|
In each state, all four legs are down, so the robot is stable. In between the states, one leg is lifted and moved in a sinusoidal curve (w.r.t. the vertical axis) to its next position. The body moves linearly to its next position as well; this is equivalent to the other three legs moving backwards by the same amount. During these transitions, the robot isn't stable, since its center of gravity is briefly outside of the triangle formed by the legs on the ground.
In practice, this wasn't actually that bad; it actually looked quite smooth since the main body moved at a constant speed. The problem was that the robot would dip slightly during each step and its body would brush the ground. Honestly, this was hard to notice if the legs were moving at a decent speed, but I wasn't quite satisfied.
Keeping the issue of stability in mind, I added two extra states to the gait:
Now, the body only moves when all 4 legs are on the ground. Thus, during transitions where a leg is lifted, the robot's center remains within a stable tripod with the three grounded legs. Of course, the robot isn't perfect mechanically (lack of servo torque, servo slop), so it still tended to droop a little bit. To help counteract this, I made the bot shift and roll a little left and right depending on the walk stage.
The last issue I had to deal was starting and ending the walk. In the idle state, the robot has its legs out in a square; thus, when it begins moving its first back leg, the tripod is not as stable as in regular walking. A similar problem occurs when the robot stops walking and resumes the idle state. Fixing this involved adding a couple of extra states where the robot first shifts its body before taking the first/last step.
Implementing rotating was similar to walking, but a lot easier; I ended up just using a 4-state cycle. Since the legs don't get as spread out as in walking, stability wasn't a huge issue. While the robot still moves its body a little to help balance, I didn't need to use extra states just for shifting (except for the very start of the turn).
Overall, I'm really happy that it works as well as it does, considering the cheap servos. I did have a couple problems with joints breaking, but that was probably because I didn't use enough superglue. Next, I'd a few simple animations to make the robot feel more alive (like shifting while it's idle, stretching, etc.). I also want to play around with adding on the ultrasonic sensor I have. Right now, I'm controlling the robot through my computer with a simple python program that reads keyboard input and sends the corresponding commands over the serial port; it would be cool to see the robot move around a little on its own!