LESSON

# Summary of inverse kinematics

#### Share

#### Transcript

Let's recap some of the big things that we've learned in this lecture. In the previous lecture we discussed the forward kinematic function; that's the function K. Its argument is Q and that's the vector of joint angles, its vector of length N, where N is the number of joints that the robot has. The result of the forward kinematic function is the pose of the robots end effector, which I call here ksiN. Forward kinematics takes the joint angles and gives us the robot end effector pose.

In this lecture we've discussed the inverse kinematic function that's shown here as K to the minus one. It operates on the robot end effector pose and tells us the joint angles required to achieve that pose. The inverse is not unique. For a particular robot end effector pose, there can be multiple sets of joint angles which will achieve that particular pose, for our little two link robot, there are two possible configurations shown here. For our six link Puma robot, which operates in three dimensional space, there are in fact six possible solutions.

There are several approaches to solving the inverse kinematic problem for a particular robot. For a simple robot like the two link example, we use a geometric solution and that requires some intuition and some insight, it involves defining particular triangles, introducing new angles and applying a number of simple trigonometric relationships in order to solve for the joint angles we're interested in, in this case Q1 and Q2 as a function of the end effector pose XY and the robot's constant link lengths A1 and A2. We right down the forward kinematic equations, which here give us the end effector pose X and Y in terms of the joint angles and then with a large amount of manipulation and again with some insight and intuition, we can write down equations which give us the robot joint angles.

The steps involved in the analytic solution for robot inverse kinematics involves the following steps; firstly we need a model of the robot, we need to know the position and orientation of the joints with respect to the links. We need to know the lengths of the links and so on. From that we extract a number of equations and we attempt to solve for the unknown joint variables. As I said before, it requires some human insight, although it can be automated using computer algebra techniques for particular robots or particular classes of robots.

The great advantages of the analytic solution is it explicitly shows you the multiple configurations of the robot and lets you choose the joint angles that will give you the configuration that you want. For the Puma 560 robot it allows you to explicitly choose a left handed configuration or a right handed configuration or the elbow up or the elbow down. Another advantage is that the solutions are very compact and fast to execute. You can take the resulting equations and you can code them up in your favorite programming language and they will execute very, very quickly. However the analytic approach is increasingly difficult as the number of joints increases and takes quite a lot of work to do it for a six link robot. Fortunately a lot of smart people have looked at this problem over many, many decades and solutions for almost all robots have been derived and are published somewhere in the literature.

An alternative to the analytic solution is the numerical solution and that's applicable when the analytic solution doesn't exist or the analytic solution is just too hard to figure out. It relies on the fact that we can always determine the forward kinematics of the robot, that’s relatively straightforward to do and we talked about that in the previous lecture.

We know the pose that we want the robot end effector to achieve which is called ksi*, but all we need to do is adjust the joint angles Q until ksi matches ksi* and we can pose this mathematically as an optimization problem written very formally here. And we showed how we can use MATLAB and the robotics toolbox to determine the numerical solution for a two link robot and for a six link robot.

There are some disadvantages with the numerical solution. You need to be careful about choosing the initial set of joint angles that you use for your optimizer. You can't guarantee that the optimizer will find the particular robot configuration that you're interested in. If you wanted a left handed configuration, you can't guarantee the optimizer will find that particular configuration, it depends on your choice of initial joint angles. It can also be computationally expensive. It's an iterative algorithm and the number of iterations depends on how good your initial set of joint angles is and that computational expense maybe inappropriate in a hard, real time system where you need to compute inverse kinematics within a small and finite amount of time. We talked about how to create smooth paths for the robot end effector moving from one pose to another and we introduced two approaches to doing this. The first is what's called a "Joint Interpolated Path." We take the initial pose and final pose and we use inverse kinematics to determine the initial and final sets of joint angles, then we smoothly interpolate between those two sets of joint angles and that's relatively straightforward to do.

The disadvantage of this is we can't guarantee that the robot will follow a straight line path in three dimensional space. We also can't guarantee that the end effector orientation will be our desired value at every point along that path; however joint interpolated paths are relatively cheap to compute because we're only interpolating joint angle vectors at ever time step. An alternative is to compute a Cartesian interpolated path and what we do here is for every point along the trajectory we interpolate between the initial and final end effector pose. For each interpolated pose we then compute the inverse kinematics to find the joint angles that are appropriate at that particular time step.

The advantage of this technique is that it allows for straight line paths in three dimensional space. It also ensures that the end effector has got the desired orientation at every point along the trajectory.

The disadvantage is that computationally it's much more expensive. We need to interpolate poses and that involves interpolating the translational component and the rotational component and that might in fact involve converting from rotation matrix to a quaternion interpolating the quaternion and then transforming that back to a rotation matrix, then we have to perform the inverse kinematics at every single time step. So much more computation involved, upside is that we can guarantee straight line paths in three dimensional space.

We revisit the important points from this masterclass.

### Skill level

Undergraduate mathematics

This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.