Your robot is poised to walk, however, you first have to get a leg off the ground. Of course, that is easy enough; if you simply lift the leg by changing the angle of the knee joint, your leg can get off the ground. You may also want to change the angle of the front to back ankle; this will allow you to lift the leg without raising it quite as high.
However, you'll have a problem if you change just these two servos; as you lift the leg, your robot will fall over. This is due to a simple principle called the center of gravity. When your robot is at rest, your center of gravity looks like this:
It is clear that if you lift a leg, the robot will fall over in the direction of the leg that has been lifted. What you need to do is to shift the center of gravity over the leg that will be left on the ground using the ankle servo that can tilt the robot left and right, so that it ends up like this:
You'll then want to set your servos to lift the left leg. Here is a side view of these servo settings:
Now, it's time for some Python code to make this happen. You'll start with your robot.py
code and will add the following lines to a function called liftLeftLeg
:
This will tip the robot onto its right leg, and then lift the left leg, like this:
Now, it is fairly easy to step forward. Just move the hip joint on the left leg forward, and then move the ankle joint on the right leg to tip the entire robot forward. Here is the diagram and servo settings:
Here is a picture of the robot:
This is the first stage of a walking gait. So, let's detail all the motions you'll need in order to walk your robot forward. Here are the side view diagrams of the different states:
These are the pictures of the robot in each of the different states:
Here is the Python code for each of the functions for the different states:
You'll notice that each function has a number of different servo control statements; these must be performed in this order to get the desired result.
Here is the Python code to sequence the functions for two steps: one with the left leg, and the other with the right leg:
This is a very simple gait; it's not particularly elegant. You can see that each state is made up of many individual servo moves. You can certainly add more servo moves to make it smoother and more refined. Your exact servo angle settings will certainly vary from these; you'll need to do some experimentation to get your biped's legs positioned correctly.
Now that you can walk, you will also need to teach your robot how to turn.
18.227.161.132