Inverse Kinematics for Walking Robots, an Introduction

by Jun 14, 2016Robotics

From the Wikipedia page on Inverse Kinematics,

Inverse kinematics refers to the use of the kinematics equations of a robot to determine the joint parameters that provide a desired position of the end-effector. Specification of the movement of a robot so that its end-effector achieves a desired task is known as motion planning. Inverse kinematics transforms the motion plan into joint actuator trajectories for the robot.

What is that in English?

Inverse Kinematics (IK) is basically a mathematical method to make robots move in a particular way. Building robots that move around on legs is quite complex. Legged robots can have as many as eight legs (or more in theory, although I have never found an example of a hobby robot with more than eight legs), each of which typically has at least three servos. This mechanical complexity means that the math, the inverse kinematics, of legged robots is quite complex.

So, for now, let’s consider a much simpler robot, a simple robot arm (like the uArm).

This is the uArm, a relatively simple robotic arm.

This is the uArm, a relatively simple robotic arm.

Robotic arms have three servos that control the position of the end of the arm, called the end effector. Legged robots have legs that are a bit like a bunch of upside-down robot arms. By changing the angle of each  joint of the arm, we can change the position of the end effector.

I think it is easiest to understand inverse kinematics by first understanding forward kinematics. Forward kinematics is the mathematical process of determining the position of the end effector based on the angles of each joint. A typical forward kinematics problem might look like this:

A robotic arm has three servos, A, B, and C, with A being the servo closest to the base of the robotic arm. Servo A is at coordinates (0, 0, 0). Member AB is .1m long and has an angle of 45o, member BC is .25m long, and the distance from servo C to the end effector is .1m. If servo A is at an angle of 00, servo B is at an angle of 1800, and servo C is at an angle of 900, what is the position of the robotic arm’s end effector?

forward kinematics problem

This is an example of a typical forward kinematics problem.

This is certainly not a trivial math problem, but using geometry and trigonometry, we can figure out the position of the end effector without undue difficulty.

So that is forward kinematics. Inverse kinematics is the opposite of forward kinematics. Instead of starting with servo angles and calculating the position of the end effector, we start with the position of the end effector and we must calculate the servo angles necessary to achieve that position.

So getting back to the robot arm, in a more realistic scenario, we would not know from the start the angles we need each joint to take in order to put the end effector at a particular location in space. Instead, we know where we want the end effector to be. For example, we might be trying to pick up a block on a table with the robotic arm. We know that we want the robot arm’s end effector to be on top of the block, but we don’t know how to set the angles of each joint in order to make the end effector be there.

This is where inverse kinematics comes in. Inverse kinematics, in the context of legged robots, is a mathematical process of determining the angles of each servo needed to put the robot in a particular position.

 

Solving inverse kinematics problems

Inverse kinematics, as you can probably imagine, is quite a lot more difficult than forward kinematics. For starters, even with a simple robot arm, we have three unknowns instead of one. As you know from basic algebra, in order to solve for three unknowns, we require three equations. So where do these three equations come from?

Well, the first equation comes from the geometry of the robot and is basically the same equation we used to solve the forward kinematics problem above.

The other two equations are a bit trickier. We need to come up with some constrains based on the physical nature of the problem. For example, we might know that our servos can only take angles between +45o and -45o. Or we might know, for example, that the end effector will always have a z-coordinate of zero (for example if the end effector is a foot it will always be on the ground at the end of a movement). Some of the constrains we set artificially. For example, we might want the robot’s body to be 5cm above the ground. This sets one of our z-coordinates.

Now, I don’t really want this post to be a math lesson any more than it is already turning out to be. I think by this point you probably understand the nature of inverse kinematics problems and the reasons why they are a lot more difficult than forward kinematics problems. If you want to learn more about inverse kinematics, there are tons of resources around the internet. For now, let’s just quick talk about how inverse kinematics will be useful for us for building walking robots.

Inverse Kinematics for Walking Robots

In the course of building and programming legged robots, we need to do a whole bunch of inverse kinematics. For robots, the inverse kinematics problem we are trying to solve looks something like this:

I know where I want the body of the robot to be, like, I want it to be 10cm above the ground, pitched backward by 15 degrees and have a yaw angle of 10 degrees. What angles should all the servos on my robot take in order to achieve this position?

This is a hard math problem. It will require a complex, multi-step solution and it will account for the bulk of the work involved in building legged robots. But if you are feeling intellectually brave, you will certainly be able to get through the math just fine. At least we don’t have to do any calculus. The other thing to keep in mind is that the robot controller (like an Arduino board) will be doing all the hard work of actually solving the inverse kinematics problems, all we have to do is program the equations and the overall process.

In future posts, I go into much more depth about the inverse kinematics of the most popular type of legged robot, the hexapod, but I think this is a subject deserving of its own post.

Share This