Now that you've got your biped all up and running, you can start developing interesting ways to make it move. In this chapter, you'll learn
Before you begin, however, it will be best if you create a harness for your biped. Your robot is going to be inherently unstable with only two legs, and, as you experiment, you're going to make some mistakes. With only two legs, these mistakes can, and probably will, result in your robot toppling over, which can damage the robot.
If you have an electronics board vise, or an "Extra Hands" device, they can be useful for this purpose. Here is a picture of how to use this device to create a harness:
If you don't, you can easily create this sort of overhead support using a PVC pipe or wood. Really, just something to keep your biped from crashing over during your experimentation.
Now that your biped is built and you know how to program the servos using Python, you can experiment with some basic poses. You'll first create a program that allows you to set individual servos so that you can experiment. Here is the program:
This code includes the Python setAngle
function from Chapter 2, Building the Biped. The specifics were taken from the www.pololu.com website, but it simply allows you to set a specific servo to a specific angle.
The next part of the code sets all of the servos to their center location. The final piece of the code, the while 1:
code set, simply asks the user for a servo and an angle, and then sends the command to the servo controller.
Once the program is run, you should see your biped standing straight up. If not, you may need to center your servos by adjusting the position of the horns. This is a useful pose, but there are others that are more stable. As an excellent first example, you can change the pose to be more like a Tyrannosaurus Rex pose, with knees pointing back. Here are the basic servo positions:
Servo |
Angle |
---|---|
1 |
60 |
2 |
60 |
3 |
60 |
6 |
120 |
7 |
120 |
8 |
120 |
The robot pose should look like this:
You can use these angles to achieve this pose. However, this will leave you with some limited movement, as your servos will be toward the end of their ability to move in one direction. As this is going to be the starting pose for your robot, to achieve maximum flexibility, you'll want to center the servos at this position. To do this, run the default, robot.py
, to set the legs to the center position. Now, adjust the servo horns to achieve this pose while the values of the servos are at a 90 degree angle.
It should look like this:
Now that you have a stable base to work from, you can start programming a simple walking motion.
18.221.129.19