Tuesday, June 28, 2022

Differential Forward Kinematics Part 2: Manipulator Jacobian, Analytical vs Geometric Jacobian

Hello everyone in this video we are going to talk about the notion of jacobian okay in the previous video we talked about angular velocity why did we talk about it because if you look at the end effector in general it can have six.

Degrees of freedom right it can and those degrees of freedom coming from in general the rest of the joints of the robot and those joints can give this end effector its x y and z motion as well as theta x tata y and theta the absolute angle of.

The end effector frame with respect to the inertial frame if you call those absolute angles theta x theta y theta z okay so not euler angles absolute angles and then if we have these six uh basically values for end effector and if you look at the time derivative of these six.

Values the derivatives of x y and z will form the linear velocity of the end effector so as you can see here also the linear velocity of the and the vector v n with respect to the base is what is the position vector of it o which is uh you take a time derivative so it's o dot or d dot and also the.

Angular velocity of the end effector with respect to base is defined as r dot r transpose the skew symmetric matrix of that is defined as r dot r transpose so if you go here and go and look back you see that the skew symmetric of omega of end effector with respect to i.

Written in i here we instead of e and i we call them n and zero but that's the same thing is r dot r transpose correct so here this equation describes based on the rotation matrix of the end effector with respect to base this describes the angular velocity of the end effector.

And then the derivative of the origin of the nth frame with respect to the base frame the time derivative of that which is time derivative of x y and z that will define what the linear velocity of the end effector so now this is the goal here this is the goal the goal is this.

Can i write the linear velocity of the end effector as some matrix multiplied by the vector of joint variables and can i also write the angular velocity of the end effector also as another matrix times the vector of.

Joint vest so this q dot here is a vector okay when you say here q dot this q dot that you see here is a vector what is that this vector q dot is the vector of all joint variables so let's say if your robot has six joints and you call this joint.

Variables q1 to q6 where q could be a theta or a d right so theta one is the same as q one theta two is q do d3 is q3 and so on so instead of calling them theta and d if you just call all of them q and let's say for example you have four or six or whatever joints.

Then something like this q one dot q two dot q three dot and so on all the way to q n dot where q n dot is the last joint time derivative okay this is that vector q dot for example for scala it's gonna be theta one dot theta two dot d three dot.

Theta 4 dots right and so on and so forth so this is the vector of the joint velocities right this is the vector of joint velocities then if i can write the linear and the angular velocity of the end effector as some matrix multiplied by this i can combine these two velocities.

Linear and angular into one single vector or call it zeta as you can see where the first three components of it are read the next three components of it are omega so you know we is a three by one it has x dot y that z dot omega is theta extra theta y dot and theta.

Z dot so you stack this three by one and three by one on the top of each other you get the vector of six by one what is this vector zeta it has all of the velocities of the end effector the three linear ones and the three angular ones this zeta and if you can combine those two matrices.

Jv and what j omega if you can combine them together then you can form a matrix here and call the whole matrix j so what you can do is you can write those two relations as one single relation and say that j the vector of end effector velocities is equal to what is equal to this matrix.

J times the vector of uh joint velocities right so let me again write it for you this is the vector oven these are the end effector velocities and i mean all of it linear and angular and this q dot here is what these are the joint velocities theta one dot theta two dot and so on and so forth.

If i can relate these guys together by a simple matrix product in other words in by a linear relationship this relation first of all this equation is what we call differential forward kinematics so this is differential forward.

Kinematics equations okay these are called differential forward kinematics equations and this matrix that relates these two important joint vectors together and the end effector speeds together velocities together this matrix j is what we call the jacobian of the end.

Effector okay so here we learn about some terminologies correct now the importance of this is this relation is way simpler than the forward kinematics equations because in forward kinematics equations for example if.

I have a what i have let's say the two degree of freedom planar r okay here the end effector only has really x and y so you have some if end effector moves like this you have some x of the end effector dot and some y of the end effect or dot these are the.

Components of the velocity of the end effector in base and these angles as you know this is theta one correct and this is theta two and uh so if you remember and also here we can call them x of n the vector and y append the vector.

When we wanted to go from the joint space which is theta one and theta two to what to the worker space which is x e and y e the relations if you remember they were not um here maybe i call it n instead of end effector or because i'm mixing here so it's better.

To call it end effector in i because we either go e and i or go n and zero right so it's better to stay consistent so here we go these guys if you remember i could not write them as some matrix two by two times what times tata one and theta 2 which are my joint variables so if.

This was my vector q and this was my end effector position whatever you want to call it i could not write them as a linear combination of these right because for example if i call this guy j 1 1 j 1 2 j 2 1 and j 2 2 you clearly see this leads.

To two linear relation that x sub n the vector in inertial is some number times theta 1 plus another number times theta 2. you know it wasn't the case correct there was no linear relation like this if you remember your forward kinematics equations were what.

Were all non-linear so i could never write them in a matrix format you can only do when everything is a linear relation and they were not so i could never do such a thing if you remember your x was basically if you call these a1 and a2 the length of the members it was a1 what.

Cosine of theta 1 and then plus a2 times cosine of theta 1 plus theta 2. and you had the similar thing for y so there was no way you could write this relations as something linear even if you called sine and cosine of tata's some other variable still.

You could not do it okay because here those signs and cosines are multiplied together so these relations were absolutely non-linear and there was no way to reduce it to linear there was no way but now instead i'm saying well i cannot do that.

But what i can do is to write the derivative time derivative relations which is what which is x e in i dot and y e in i dot can i write those as a linear relation so write those as some 2 by 2 matrix and then what.

The joint variables but the velocity of them so here theta one dot and theta two dot cubes can i write the derivatives based on each other as a linear relation the answer is yes you can and i'll show you okay and then this matrix is what relates them together it is very important matrix it tells us.

A lot about the manipulator we'll see it tells us about singularities it tells us about how it converts the joint motion into end effector motion and or the forces and torques to each other and uh it tells us other stuff we call manipulability we're gonna see that.

So this is a fundamental important matrix now does it mean these components are just constant number the answer is no these guys are going to be functions of the joint variables each one of these components are not going to be constant but they are not going to be functions.

Of the velocities they are going to be functions of what the tatas the variables not their time derivatives okay so this j matrix is not going to be a constant matrix you'll see in general this is a function of what in general each component in it can be a function of theta 1 and theta.

2. so from one point to the next when the robot moves the value of this j does change okay so that's the whole idea of the jacobian going from joint to speeds and velocities to end effector velocities good now uh there are several ways to calculate this very important matrix.

One of them is using partial derivatives which i'll show you and the other one is if you use the dh convention i also show you how you get the uh j matrix through the ds convention and then as we go through the future lectures i'll show you the importance of this j matrix okay.

As we go from one topic to the next from inverse velocity problem to differential inverse kinematics to uh static force analysis to let you just name it uh this one is not a circular application what is this for singularities then manipulability in each one of these.

You see the j matrix is there okay so each application an important topic that we talk about the robot the j is there okay other than forward and by inverse kinematics everything else j would show up itself okay so that's such a hugely important matrix now if i uh show you.

Uh let's go back to this example we were working on so the question is in this case how can i write my x and y dot in terms of theta one that and to the two dot as this matrix format so take a look here all i need to do is.

To basically take time derivative that's all it is take time derivative from this equation see what you get you will get x of e in i dot is equal to what what is time derivative of a 1 cosine of theta 1 well it is negative a 1 sine of theta 1.

But since you are taking time derivative not derivative with respect to theta one there will be an extra term which is what theta one dot correct that comes from the chain rule right take a look here i'm taking the derivative of sine of or cosine of in this case.

What's the derivative of cosine of theta 1 with respect to time okay and this is you cannot do it directly why because this is a function this guy here this cosine theta one it is a function of theta one explicitly not function of time.

If it was derivative of that with respect to theta 1 so like this directly from calculus to say well that's negative sine of theta 1 right but here if you look the denominators are different i cannot say these are the same thing unless.

I multiply this by d of theta 1 with respect to d t now it's kind of like simplifying these two together and getting my original ratio back now the question is what is this well based on what you know from calculus that's negative sine of theta y and what is this one.

That is theta one dot so you see where this extra theta one dot or omega one comes into play okay that's called chain rule or implicit taking derivatives right implicit differentiation so uh this is why as i said again those theta dot terms are showing themselves.

Good so let's go back and continue with the rest of the derivatives so that's the first term now what take time derivative of this so there's going to be negative a2 times sine of theta 1 plus theta 2 and then the time derivative of the whole thing that is inside which is going to be theta 1 dot plus.

Theta 2 dots and then you can do a similar thing here for y so it is going to be a 1 cosine of theta 1 theta 1 dot plus a 2 cosine of theta 1 plus theta 2 times theta 1 dot plus theta 2 dot and if you want you can organize it a.

Little bit better just factor out theta one dot and theta two dot if there is any term so theta one dot times y what's the coefficient of theta one dot it is negative a one sine one so here i use short notation negative a a1 sine one and then what.

If you look it is negative a2 sine of one plus two and then plus theta 2 dot what negative a2 sine of theta 1 2. similarly here it is going to be theta 1 dot times a 1 cosine 1 plus a 2 cosine 1 2.

And then plus theta 2 dot times a 2 cosine 1 2. so i can write it like this and now with that relation that i wrote can i write it as this matrix format this linear relation format the answer is yes i can how well if you look here let me expand this a bit maybe some.

Wrong good so let's look at the coefficients here when i want to write x e dot with respect to i x x dot with respect to theta 1 and theta 2 the coefficient of theta 1 dot is this so that comes here then the coefficient for tata two dot is.

This guy so that comes here the coefficient for theta one dot for y dot is this one so that comes here and the coefficient for theta two dot is this one which comes here done okay.

So as you can see clearly uh this matrix that i got allowed me to write my end effector velocities in terms of the joint velocities as a linear relation second of all this matrix that i call j is not constant it is a function of what there is theta.

1 and theta 2 in each component so in general it is a function of theta 1 or theta 2 or in general with that q notation they say j is a function of what vector q okay so it's not constant it changes from point to point as the robot move theta 1 and theta to.

Change but clearly this relation here the components here do not depend on the velocities okay so that is your jacobian now what's the importance of this matrix i'll tell you as we go through more and more applications in future.

Slides i'll show you the importance of this matrix but for the moment being the simplest application is this i have this robot and now i'm going to rotate my first arm with let's say um for example 20 radians per second counterclockwise and then i'm going to rotate my second link.

With the theta.2 equal to let's say 10 radians per second and i know the size of each link so this is like 0.2 meters and a 2 is like point 15 meters the question is what is x dot what is y dot or what is what this vector of the velocity of the end.

Effector in i okay so for a robot with this geometry and with this speed of the joints how fast the end effector moving right so all i need is to go back here and plug in the numbers right say that hey this data one dot is.

Positive to any the theta 2 dot is negative 10 because it's clockwise and then uh i have a1 and a2 the other thing as you need as you see you need you need what theta 1 and theta 2. so although i have theta one and theta two dot.

Determined and a one and a two the output does depend on how much is your current theta one and how much is your current data two if i change my configuration of the robot with the same inputs velocities of the joint and with the same geometry i will.

Get different numbers so here i gonna look at a separate scenario scenario one let's say theta one here is uh for example 60 degrees and theta two here is uh let's say uh 30 degrees but clearly you see that it is negative right because it is clockwise so i'm.

Going to plug in all these numbers and i'll use matlab here to help me multiply the numbers right so i say my uh j matrix and i can use symbolic if i want and use the eval command or i can use uh anonymous functions so for the moment let's use symbolic functions.

Right so sims of let me write everything in the script if you don't mind so here we go so uh sims of t one and t two i use them instead of theta one and theta two and then i also need t one dot and t two dot and then what i also need a a1 and a.

2. so my j matrix is this the first element as you can see is negative a1 s1 negative a2 s1 2 correct so here negative a1 s1 negative a2 times s1 2. then you simply have negative a2s one two which is this guy that's.

Your two element you go to next row that is a1 cosine of t one plus excuse me a two cosine theta two theta one plus two and then the last element is this guy here correct and if you want you can use three dots and go to the.

Next row so that is my jacobian matrix my joint velocity q dot is what it is t one dot and t two dot theta one dot and theta two dot what i need to calculate is what my v of the end effector which is equal to what j times.

Q dot correct right so here i define everything now here i plug in some numbers for them so i say t1 is 60 degrees right or pi over 6 t2 is negative 30 degrees but remember here i use sine and cosine not sine d cosine d.

So i need to make sure i write it in radians t1 dots was go back here let's see what numbers we used so we had at 20 10 2.15 so we had 20.

10 but negative 10 actually then 0.2 meters and 82 is point 15 meters so i defined the numbers and now you say evaluates my v of the end effector so basically means plugging all of these numbers into those symbolic formulas and evaluate the number here and give me how.

Much so if i run this and i call it whatever you want so i can call it jacobian 2dof planar arm demo right and i change my folder and get the number here then uh give me an error seems like i forgot some asterisk or.

Something somewhere here okay this is the number it says the speed of the end effector is negative 2i plus 4.96 j correct so it says based on what you said your end effector at this moment should.

Move something like this so it should move negative to i and what point um how much was it 4.96 j so it should move in this direction negative i and positive j okay and the main reason it is moving backwards is theta 1 which is dominant.

20 instead of 10. okay so this is the total resulting velocity of the end effector due to both of these motions at the same time okay so you can change any number that you want you can change the configuration that will lead to change in the end effector velocity.

You can change the rotation velocity the angular velocity of the members that will also change the number here right and you can change the geometry but let's say the robot is made so the a1 and a2 are fixed so if i want a specific velocity from the end effector what can i do well i have to look.

At what angle uh basically i am uh positioned right now correct what is my theta one what is my theta two and then based on that i figure out how much theta 1. and how much theta 2 dot i need to make that velocity happen and that problem is.

Our topic of the next slide here here is called inverse velocity problem and we get to that okay but you clearly see that having your um q dots and your j matrix will lead to end effector velocities sometimes you go backwards most of the time you actually go.

Backwards you want a desired end effector velocity you know the angle you are at at the moment what you really need are those q dot values how fast to turn a joint in the robot and you can find that again we call it inverse velocity and for that you need.

The inverse of this jacobian matrix okay so we'll talk about that and about singularities and stuff but just want you to see the importance of this guy to take your speech from joint to space to the worker space good so now if we want to calculate this.

Jacobian matrix in general that was a very simple robot two degrees of freedom took time derivative and no big problem but in general if you want to define this jacobian matrix and how to calculate it as i said i tell you two major ways to calculate this important matrix one is using partial derivatives.

And this is almost the same as what we did right here in this case so here let's assume that the x y z positions of the end effector in base and the absolute angles theta x data y theta z of the end effector frame in the base.

Frame are in general functions of what functions of the joint variables from q1 to q n okay so each one of them is a function of those joint variables if i take time derivative from both sides of this equation.

These guys are gonna be x dot y dot z dot these guys are gonna be omega x omega y and omega z so this whole thing here is what this is that uh zeta vector that you introduced earlier correct the vector of and the vector velocity because the first three components are v.

The next three components are omega so this whole thing here is that zeta is equal to so here these functions f1 f2 all the way to f6 are functions of what functions of q's but i'm taking time derivative from them since they are not function of time explicitly they are function of q's the.

Q's are functions of time so again here i have to do what i have to do yes you are right par the chain rule and so instead i take the derivatives of these functions with respect to their own variables which here i show with partial derivative of f i with respect to q.

J as a matrix and multiplied by q 1 dot q 2 dot q 3 dot all the way to q 6 and again this extra term comes from the application of the chain rule okay so this is clearly your vector q dot that you have up there so you see that your zeta is some matrix times q dot so that matrix has to be what.

Your j matrix so clearly the jacobian is what the partial derivative of each one of these functions with respect to what one of the variables okay so let's say if we go back to the case of that um uh.

2dof plan or arm if you see here this x is a function of the two angles so i can call this f one of theta one and theta two and the next uh variable of the end effector y is also another function of theta 1 and theta 2 okay so when i say partial of f i with respect to q j what does it mean.

In this case means in each row you keep your f constants and you change your variable so it is like partial of f1 with respect to q1 partial of f2 with respect to partial of sorry f1 with respect to q2 you go to next row you change f and again you take the.

Derivative with respect to all cubes and so on and so forth right and that's what you learn in calculus right the jacobian matrix partial derivative of multivariable functions with respect to all of those variables correct it's called the jacobian matrix and that's the exact.

Same thing here and so your q one and q two here you call them what theta one and theta two so if you want you can get rid of these q's and replace them with what with tata so we can call it with respect to theta one and theta two and here again the same thing theta one.

And theta two and that as i said what we call a jacobian matrix now what is it in this case so what is this first component partial of f1 with respect to theta 1 what's the partial of this function with respect to theta 1 here you don't need to take.

Time derivative just theta 1 derivative so when you take derivative with respect to theta one means everything else has to be considered or treated as a constant so in genes theta two you can treat it as a constant derivative of this is negative a one sine theta one derivative of that is.

What negative a2 sine of what of course the derivative of uh negative sorry negative a2 sine of this whole thing theta one plus theta two which if you look at it it's exactly this guy so this one for that f1.

Is gonna lead to what to this yes then what is partial of f one for theta two well the first term has no theta two in it the second term is simply negative a two sine of theta one plus 2 which you see is exactly this one right and what is the partial of.

F 2 which is this function with respect to theta 1 when it is going to be a 1 cosine theta 1 plus a 2 cosine of 1 plus 2 which is exactly this and finally if you take derivative of that with respect to theta 2 that is going to be what a 2 cosine.

Theta 1 plus 2 which is exactly this one so you see i could get this matrix by taking these partial derivatives of each one of those functions f1 f2 and so on with respect to what theta 1 theta 2. so in each row as i said the function is constant.

In each column the variable is constant as you can see and this is called the jacobian matrix right so one way to do what to do uh jacobian is using these partial derivatives so here we have done this planar 2dof arm so maybe.

We try something different let's work about three degree of freedom plan our arm right let's let's do something a little bit different so the three degree of freedom planner arm is something like this and i can call these members a1 a2 and a.

3 and then i can provide three angles so this one is your theta one this one here is your theta two and this one here is your theta three okay and if i use x and y x is here this point has and call it the end.

Effector this point has x of e and y of e and it also has an angle if we call this angle here this angle psi or you might call it theta z for example if i want to write that theta z and x and y as a function of the three joint variables what do i.

Have your x of end effector in inertial is going to be a 1 cosine of 1 plus a 2 cosine of 1 2 plus a 3 cosine of 1 plus 2 plus 3 so i can write it like this your y of the end effector in inertial is a 1 sine 1 plus.

A 2 sine 1 2 plus a3 sine 1 2 3 and finally your theta z angle is simply sum of the three angles right that's what you have here there is no theta x no theta y and there is no z because it's all planar and you have.

These uh three things that you can determine for the end effector so now if i say what is the velocity of the end effector which is in this case is x dot and y dot and theta dot which you can call what omega z right want you can call it theta dot for now if i say what are these.

So if you want you can call the first two components to be vector v the linear velocity of the end effector and this single component call it what omega of the end effector but you know omega is only omega z correct that's all it is.

But you can also call it a vector but in this case that's just a scalar it's not really a vector so what is this you can write it as a matrix times the joint variables their time derivatives which are theta one dot theta two dot and theta three that and this guy as i said you.

Call it vector q dot and this guy here we call it vector zeta so this connecting matrix you can call it the j matrix now what is that per definition that we mentioned if you call this whole thing f1 call this whole thing f 2 and if you call this whole thing f 3 that matrix is partial of f 1.

With respect to theta 1 then the same function for theta two then the same function for theta three then you change your function you go now to f two and repeat all of these partial derivatives and then you go to f3 and again repeat right so once you do that.

And you're ready to just calculate those derivatives so what is j going to be so based on those definitions this j is going to be what take partial of f1 with respect to theta 1 theta 1 is in all of the terms so it's going to be negative a1 sine one negative a2 sine one two.

Negative a3 sine one two three theta two it's only in the second and third term so it's going to be simply negative a2 sine one two negative a3 sine one two three and the three is only in the last term so you only get negative a3 sine one two three.

Then you take partial derivative of the y with respect to the same three variables for f for theta one again all three terms are there so you will get a one c one plus a two c two c one two plus a three c one two three this is going to be a2 c12.

Plus a3 c123 this is going to be simply a3 c123 and partial of the last function which is sum of them with respect to each one is simply one so this is your jacobian matrix so now at any angle this j which clearly you can see this is a function of all three joint variables.

At any angle since i know the geometry which is a1 a2 and a3 if i know the angles i can determine this whole matrix if now somebody gives me the joint velocities i can determine what the end effector velocities okay or if somebody give me the end.

Effector velocities i can invert this multiply from left side and determine y the required joint velocities which again we call it the inverse velocity problem okay so taking partial derivative here we did it for the planar 3do f so the.

Important thing is you have these functions if you have these functions uh then it is not so hard it's just partial derivative the question is where do you get these functions where do you get these functions and the answer is from what.

Forward kinematics these equations are your forward kinematics equations with one twist of course what is the twist the twist is this when you calculate the forward kinematics it gives you something like this this homogeneous transformation matrix it gives you a rotation matrix and it gives you o.

The origin of the and the vector in base this o here will give you what will give you x y and z that you were after so these three things that you wanted the first three functions they come directly from the elements what uh one and four two and four and three and.

Four of the uh homogeneous matrix of the end effector the problem is with the last three the problem with the last three is this when you look at the last three these are the absolute angles of the end effector frame with respect to the base frame.

As a function of the joint variables and the problem is these guys are not explicitly given to me they are implicit into this what into this rotation matrix and the matter of fact most of the time this rotation matrix is written in terms of what in terms of intrinsic rotations which are rotations.

With respect to what right with respect to current frame these thetas are absolutes they are with respect to the fixed frame they are with respect to what they are with respect to the base frame so these are the angles of one frame with respect to another and absolute angles.

Okay so the question is how do i get these angles right how do i get these angles because if i have basically my first frame is i here so this is x i this is y i this is z i i do a rotation about let's say x and theta x.

X sub i of course it gives me some new frame okay then i'm not going to rotate this new frame about the current y i'm going to repo vary to the sorry rotated about the old y the absolute y so everything here has to rotate.

About what about the absolute y for an angle of theta y okay so this is going to be the rotation about y i and theta y and then what whatever that you get now that is completely distorted like this now you are going to again rotate it not about the current z of this axis you're.

Going to rotate it about what z of i for an angle theta z okay so you get some let's say final frame like this and this rotation matrix r and 0 describes this whatever is for example let's say this is as x of n defector this is y right you have to keep track of them but.

Uh this is actually x in the figure this is z of n defector and this is y of n so um you have to keep track of that and see with these three angles theta x data y theta z about absolute x y z when i give you a rotation matrix of e with respect to i how do you get those.

Three angles theta x y z back and if you remember for that you have to do what you have to do the inverse problem so your rotation matrix r of n zero here or e in i that i give it to you as a function this has to be what it has to be rotation x y.

Z theta x data y theta z and if you remember when i do several of these after each other i have to multiply the rotation matrixes but since they are extrinsic the re the order is reversed so instead of first multiplying r of x and theta x i'd first do r of z and theta z.

Multiplied by r of y and theta y multiplied by r of x and theta x okay so that is going to be a big jumble of theta x theta y and tata z functions you set it equivalent to this rotation matrix that you have and each one of them is just a function of something.

Correct right and then each one of these as you can see is going to be a function of these three angles theta x theta y theta z and then you have to do inverse orientation problem and then find these three angles based on the entries in that matrix and now that hopefully will give you.

These functions that you need so that's the problem we have is the problem we have is this the orientation of the end effector in base is rarely determined or defined by its absolute angles that's the problem okay that's the orientation of the end.

Effector in base is rarely defined in terms of its absolute angles most of the time it is described in terms of what its what we call intrinsic rotations like what like euler angles for example in that case finding these.

Three equations is a little bit harder okay and for that we need to discuss something called analytic jacobian so this jacobian that we are discussing here the name of it is called this jacobian that we discuss here the name of it is called um geometric jacobian.

It again it works with the derivatives of x y z and absolute angles theta x y z if instead of these absolute angles i use the euler angles psi theta and phi then the form of this matrix is going to be changed a little bit and describe them.

In terms of psi dot what theta dot and or nose actually the cues are different things so uh if i want to do that then this matrix j is going to be a little bit different that's what you see right now we call it analytic jacobian and i.

Assume where is that i have it here in slide number eight of mine and i'm gonna talk about it okay in a few minutes but um just want you to know that uh depending on how you represent the orientation of the end effect or what format.

You use the form of your jacobian will be different from what you see in here and finding these functions is not always trivial plus you have to make sure that these partial derivatives that you are taking here you don't make any mistakes in them of course you can avoid mistakes if you pay attention enough and if you use.

Matlab symbolic to take time derivatives for you just to confirm your calculations i don't mean you rely on math lab for doing your calculations for you you have to do it yourself but it's good to check and see whether you made a mistake or not so you can probably avoid mistakes if.

You know basic calculus and you can use the software to confirm it but finding these three functions is not always trivial okay and we'll talk about it again as i said in a few minutes but i want to show you another approach to find the jacobian matrix and that is using.

The dh method so if you remember in the dh method dh convention it also gave us when we used it for forward kinematics it gave us this guy here correct if you remember the edge was also giving us this t how did it do it if you remember we formed a bunch of.

A matrices a1 a2 each one of them was the function of one of the joint variables and multiplied all the way to a n again each one of them was function of one variable and each one of them came from one row in the dh table we form each one of these a's and multiply them together.

That gave me my t and so that gave me my rotation matrix and o now that i have this general homogeneous transformation matrix between and the vector and base can i find the j matrix based on the result of this t and the answer is yes and actually it is.

Quite easy job to do that and that's where the dh method can outperform the vector addition method that we had in terms of the jacobian so in terms of forward kinematics if you remember the jacobian was not as easy as the vector addition method and doing.

Pure uh algebra but here the the dh method shows its power i'll show you in a second and you'll see finding the jacobian matrix when you do the dh convention for forward kinematics is actually very easy so now the question is how do you do that.

Let's talk about it okay so let's look at this j matrix and by the way before we go and focus on the j matrix what's the dimension let's talk very fast about the dimension of this j matrix the matter of fact is this j matrix is not always a square matrix.

It depends here that when we define this zeta how we define it in general if we want to look at everything in 3d then this zeta is always six by one okay it is what six by one so it's not like if i don't like the 3d problems and i solve a 2d problem where some of these guys are simply 0.

I can just resize j okay so if we look at this problem we just solved this 3dof thing or was it see if i can find it here the matter of fact is here i have eliminated three of the components of zeta if those guys were there then.

What happened to zeta you would get what you will get x dot y dot z dot and what omega x and omega y and omega z good so the thing is you don't have here any function for z you don't have any function for theta x.

And theta y so instead of them you have to write what you have to write zero so what you need is something like this you have to expand this bring this tata z down and then say well z of the end effector.

In i is simply zero the same thing for theta x and the same thing for theta y and then what happens to the end of vector these three rows will not be a function of any of this theta one dot theta two dot theta three dot so what happens to j.

Your j will be basically something like this three rows of zero added the last row will be one one one okay so if you really treat the end effector velocity vector 3d then this matrix j in general is not squared the dimension of it in general is six by n.

Because zeta the end effector velocities are always six components but your joints are not always six sometimes your robot has what less than six joints sometimes has exactly six joints sometimes more for example the two or three the of planner are mascara they have less than six.

Joints some of the robots we have seen like the stanford arm or the 60of articulated robot they have exactly six joints and there are some robots that are redundant they have more than six joints so in those cases your j matrix is in general a rectangular matrix 6 by n because your.

Q dot your joined vector is n n here is the number of joints so your j in general is what 6 pi n where n is the number of joints okay so that is your j matrix just keep in mind it's not always a square matrix unless your robot has six joints of course.

So now this is how we go about the um jacobian determination based on the dh method this j matrix that we have we consider it to be n columns remember the dimension of this guy was what it was six pi n which means.

There are n columns each one of the columns is what a six by one so each one of these js that you see here each one of these j's is a six by one vector okay so here you consider your j matrix to be made of n columns.

And you call these columns what j 1 to j n good now when you multiply the j matrix by q dot by vector q dot which has all of the q's in it all of the q dots in it from q one dot to q n dot correct by the way this has to be um let me fix this q n dot and in general.

It's not six so what i can do here is uh just get rid of some of these and just put a dot instead and now just keep it also see there we go so you have n joints and of these um columns if you multiply.

Your end effector velocity is going to be summation of j i times q i dot correct what's the meaning of this it has a good physical meaning it means what because these q dots are all single numbers right they are just a scalar if you consider them like 2 3 5 6.

Whatever it means your zeta is what like 2 times j 1 plus 3 times j 2 plus 5 times j 3 and so on all the way to let's say 10 times j n so what does it mean when you write something like that when you say for example let's say you only have four joints if.

You have four joints like scara your zeta is going to be what q1 dot let's just come up with some numbers for this vector let's say just 1 2 3 4 just to make it simple it is going to be 1 times j 1 plus 2 times j 2 plus 3 times j 3 plus 4 times j4 for example.

Right what's the meaning of this it means this vector zeta is a linear combination of the columns of the j matrix correct that's called a linear combination so if i combine the columns of the j matrix in a linear fashion the result of that is what the end effector velocity now what are.

The weights of that linear combination those are what the joint velocities and another meaning is this which column of the j is closer to what to the zeta or it plays a bigger role a bigger contribution to zeta which column of j has a bigger contribution to zeta the.

One that has what the corresponding bigger q n dot correct the joint that rotates faster or moves linearly faster it also the j com the j column for that uh joint plays what a bigger role a bigger contribution to zeta okay so you clearly see the physical meaning of columns of j and.

Zeta good so based on this relation here you can simply say that if i take the partial derivative of this zeta with respect to any of this joint velocities the result is what the result is that column of the j matrix correct so partial derivative with respect to q.

2 dot here right take partial derivative here of zeta with respect to q2 dot what's the result of course the coefficient of it which is j2 correct and again here it clearly tells you the meaning the change in zeta per change in what the joint velocity that's the meaning of.

Each column in j correct in other words for example if i go back to my robot and look at some robot let's look at some picture this is my robot okay from the base several members going to some specific joint going all the way to end effector what's the meaning of column two.

Column two means what of the jacobian means if i change my tata to dot from some number to another number what's the effect of that on what on the end effector velocity correct yes for example if the relation is linear means if i rotate joint two two times faster.

The end effector velocity each component of it is going to be two times bigger right or if this is non-linear then you can define it separately but clearly see the change in end effect or velocity per change in each joint velocity that's the meaning of each column in.

The uh j matrix right so the meaning of it is very clear now that we know the meaning of these js can i easily calculate them from the dh convention and the answer is yes so what you do is only here you divide your joints into two categories you say.

Either my joint is revolute which is rotary or my joint is what prismatic which means they are only linearly going forward and backward okay so if that is the case then how can i determine the contribution of each joint or each joint's velocity in the end.

Effector velocity how can i determine that and it's not so hard why let's look at the prismatic because it's simpler it says hey if the joint is prismatic and i move a prismatic joint what is the contribution of that to the vector zeta and if you remember.

Vector zeta had two parts if you remember this zeta had two parts it has v of the end effector and it has what omega of the end effector correct this was the meaning of zeta so basically i want to know if i change.

The velocity of joint number i how does it affect each one of these v and omega and then the partial derivative of that i call it what or the contribution of that i call it j i the ith column so let's take a look here if one of these joints is prismatic.

When i move it what's the effect of that velocity on the velocity of the defector what's the effect of that on angular velocity of the defector linear and angular so let's forget about this complicated robot let's look at the simple robot so let's say here i have a 2dof planar arm the first.

Link is prismatic so it or let's say let's make it three degree of freedom to make it a little bit more complicated so the first one is rotary right so let's let me show you in 3d the first link is rotary right the second link.

Is prismatic and the uh third link is um also a rotary good so if i move this prismatic joint up and down.

How does it affect the velocity of the end effector how does it affect the linear and angular velocity of the end effector first and when i say when i move the second joint it means you do not change the angle or the values of any other joint in.

Other words lock these other joints in other words make this q one dot equal to what 0 and make q 3 dot also 0 right that's the meaning of partial derivative remember when you take partial derivative what would you do.

For one variable you assume all other variables are constant remember what we did here when we did this method correct when we take partial of f1 with respect to theta 1 i treat theta 2 and 3 as what constant the same thing here when i'm taking partial of zeta with respect to.

Q2 dots i'm assuming that my theta one dot and theta three dot or q one that then q three dot are what zero i consider them as zero right or their angles i consider their angles as constants their angles are not changing okay so if you lock those in other words.

Correct make q3 constant and q1 constant just move this prismatic up and down what's the effect of that on the angular velocity of the end effector and you would say nothing if here i like this two rotary joint just go up and down is the end effector.

Going to rotate do i gain any angular velocity by just going up and down of course not so the contribution of that omega with respect to this q2 is simply what zero there is no contribution now if this omega has three components which it does then this.

Zero is going to be at zero that has three components because it doesn't give you omega x it doesn't give you omega y it doesn't give you omega z so it is going to be a vector of three zeros right so a linear motion of one joint will never create angular velocity for the end.

Effector therefore you can see here i have what i have a vector zero so this zero that you see here is a vector it's three by one okay the same thing for everything else everything else here is a vector it's a three by one vector good so that is clear now what's about.

The linear velocity of the end effector what's the contribution of q2 dots on v what about that is that gonna affect v of course if i like everything up when this guy goes up and down this end effector also goes what up and down with the same value as q2 dots correct so this q2 dot.

Will be added to the current velocity of the end effector or if there is no other component v is simply going to be the same as q 2 dot because now your whole robot is like a rigid body one single rigid body once you move one point every other point will move the same way so.

What is going to be the partial derivative of v here with respect to q dot well you might be tempted to say one because v is going to be the same as q dot you might tempt it to say the yeah it's one or maybe three ones or something like that.

The answer is not exactly why why is that because allowing which direction this q 2 dot is happening what's the direction of this q 2 dots align which axis it is happening well this is joint number two joint number two what's the actuation axis of joint number two if.

You remember from the h method right if you remember from the edge method the actuation axis for joint number i is x is what z i minus one so the direction for this vector is what vector z i minus one which is in this case is z one so this q dot is happening along.

What z one so v the magnitude of it is q dot right but the direction of it is what z one so i should write v as what q two dot dot times what z 1 any vector can be written as its magnitude times its unit vector now when i take partial of v with.

Respect to what q 2 dot the answer is what vector z one the actuation axis of joint number two or z one right correct and of course z1 written in what written in the inertial frame correct so vector z1 written in the inertial frame because this is v of the.

End effector in what in the inertial frame and this is omega of the end effector in the inertial frame so that is now equal to j 2. so j2 is going to be z one or j i is z i minus one which you can see here.

Right so if joint is prismatic the contribution of the motion of that joint toward linear velocity of the end effector is zi minus one toward angular motion of the uh and the factor there is no contribution so it's zero so here and clearly as i said each one of these is a three by one vector.

So when you stack them on the top of each other the result is going to be what a six by one vector which as we said that's the dimension for one of the columns so for a prismatic joint getting j i just requires you to find z i minus one.

And i'll tell you how to find it it's very easy what about when the joint is revolute if joint is revolute then what then again this revolute joint will contribute to what to the end effector linear velocity and angular velocity how let's take a look.

So what i do here is i rotate what one of these rotary joints and lock the other ones so let's say here i rotate joints number one and i want to look at the effect of the rpm of joint one on the end effector velocity so what i will do here is i'm going to.

Rotate this guy with theta one dot this q2 dot i set it equal to zero which means q2 is constant so this link this uh prismatic joint here is not gonna go up and down it's going to stay in the same position that joint is not going to rotate it's going to stay at the same angle this is the end effector linear velocity.

And this is the end effector angular velocity so what's the effect of this theta one dot on each one of those if i lock every other joint well first what's the effect of theta one dot on omega dot if i like every if i like everything else then the whole robot will rotate like a rigid body.

About the axis of what this uh the axis that this theta one dot is happening and it is gonna be what a pure rotation about the fixed axis that's all it does correct it is a pure rotation about the fixed axis so if i say okay what is omega.

Well you say omega is the same as theta one dot except theta one that is just the magnitude it also needs a direction and i ask you what's this axis what's the axis for joint one for theta one dot what's the axis for it or joint one.

What is this axis and you say the actuation axis for joint one we call it what z i minus one which in this case is called what z 0 so i can write it as theta 1 dot times what z 0 of course z 0 in i so now if i ask you what is the partial derivative of that omega.

With respect to theta one dot what would you say take a partial derivative clearly the answer is what z zero in i done correct so the angular contribution of theta 1 dot is the axis of actuation for it.

So if it's theta i it's going to be z i minus 1 which again you can see here the contribution of a revolute joint on the omega it's zi minus 1 again this guy is a 3 by 1 right now the kind of you can say most complicated part is.

When the joint is revolute and you want to see the effect of that on linear velocity of the end effector what is that one so here this time i'm going to what rotate this joint only nothing else and see what kind of velocity the end effector will get due to this.

Pure rotation theta one dot well what is it what do you think to do that to show that a little bit clearly maybe we can focus on this other picture this can tell me a little bit better so take a look here instead of theta one dot here i use a middle joint so here is my base.

This tata eye is a middle joint so it's not the joint right at the base and it's not the last one is somewhere in the middle of the robot i want to see the effect of theta i dot on the velocity of the end effector what is that if i lock the rest of the robot only.

Rotate that joint what kind of velocity does this end effect or linear velocity does it get and the answer is if you remember from rigid body dynamics if this is a point here and this is the center of correct and if the point of interest is here.

Yes if this vector is r and it is rotating with angular velocity omega in general v here the velocity if you remember from rigid bodies it was what it was omega cross r correct where omega was the angular velocity and r.

Was the distance from the point of interest to the center of rotation if i cross these two that was the v due to rotation correct now we're going to use the exact same thing here with the difference that here my end effector is not rotating about the base.

It is rotating about what joint i minus joint i i'm sorry joint i that's joint i this is joint i so my end effector is rotating about joint i that is the center of rotation good so if i have this vector r that you can see.

This r this guy from here to here if i have this r and that omega omega cross r will give me the velocity the question is what is this r this r is from end effect is from joint i to the end effector which i do not have directly in the dh method.

But what i have in the edge method is the position vector of joint i in the base frame and the position of the end effector in the base frame in other words the edge method will give me both of these vectors in red and i'll show you why and how in dh i can easily get both of.

These vectors in red now how can i get this vector in blue well it's clear i will subtract this vector from this one this is the origin of frame i in base this is the origin of the end effector in base if i subtract that's r and that's exactly what you see here.

This guy this is that r vector okay that you're seeing over there now why is it cross multiplied by z i minus 1 well because this omega that you have it has what in it it has theta i dot that's the magnitude of the rotation and the direction for it is what remember.

Actuation axis the unit vector the actuation axis for joint i is what z i minus 1 so this is the omega vector and that r as you saw is the origin of the end effector in base minus the origin of frame i in base okay this is going to be that resulting v of the end effector.

In base or here we have to say n in zero now question what is the partial derivative of this v n zero with respect to theta i dot well clearly it's the rest of it which is zi minus 1 cross o n minus what o i which you can see here and again this r is a three by one.

Vector z is a three by one vector so when you cross product it it's also a three by one vector and again three by one three by one you stack it you're gonna get a six by one so if you want there is proof behind it also but the proof is exactly what i just said here whereby.

It's nothing more than that okay so i can write everything i said in a nice more neatly format but that's all it is okay i try to make it very simple for you so if the joint is revolute i know how to calculate the eighth column of the jacobian if.

It's prismatic i know how to calculate the column of the jacobian for that joint and once i have all these joints i calculate the column for them i put them side by side and that will give me what my j matrix now uh.

The question is how do i get these entities how do i get z i minus 1 that i need how do i get o n how do i get o i minus 1 and they're all with respect to frame 0 here or i how do i get these what does it these have to do with the dh method.

Well let's go and look so um if you remember we just were talking about it this t of n with respect to zero gives you rotation matrix and origin of end effector in frame zero but that's not the only t you can get from the edge method you can also get t of any other joint.

Or any other frame in frame 0 okay it's not just the end effector for example i can get t of frame i minus 1 also in the base and if you remember it will be the rotation matrix of this frame in the base.

As well as the origin of this frame in the base and a bunch of zeros and one now the question is what does disease that are quite common in this formula what do they have to do and also that o they are all i minus one what do they have to do with this t.

Matrix okay first of all how did we get this t matrix if you remember this was a one of q one times a2 of q2 all the way to a i minus 1 of qi minus 1. well this one was from the beginning all the way to the end.

Correct so depending on where we stop multiplying them we will get the t for that frame with respect to the base okay so and i have all of these a's from the dh method and dh table so i can multiply as many as i want now the question is what is z what is o well first of all you clearly see here the.

Uh fourth column of this matrix is clearly what o i minus one which is exactly this so all i need is to look into the fourth column of ti minus one and look at the first three numbers not just this one forget about that one that one is always there the first three numbers of that matrix.

So if this t matrix in general if this guy here this t matrix is like what it is like t one one t one two t one three t 1 4 then we go t 2 1 all the way to t 2 4 and then we go t 3 1 all the way to t.

3 4 and then we go with zero and one the question is which part is oh that i need is these three numbers in the last column interest t14 t24 and t34 these guys are oi minus one that i need in that formula if it's a revolute joint.

What about z i minus 1 well if you remember these three these nine numbers or these three columns are this rotation matrix and what was the definition of the rotation matrix if you remember if you remember the definition of the rotation matrix what's the meaning of this.

It is x of frame i minus 1 dot x of 0 and then the same x dot y y of 0 and what z of 0 correct that's the definition that's the first column and then you get what you get two more columns like that where one of them is for why one of them is for z.

Correct so let's see here there's another one and here that's another one good so let me just modify it very fast so these guys are y these guys are z and now if i ask you what is this third column giving you.

This is giving you the vector z i minus 1 as written align the axis of frame 0. so i can write this as what z i minus 1 written in 0 as a vector and guess what that's exactly what you want here so what and this is the third column of.

R which is this guy here this one this one is your z i minus 1 which you were looking for so if i have t of i minus 1 the third column of that and the fourth column of that are going to give me what z i minus 1 and o i minus 1 just like that.

And what is that o n well that's a similar thing but instead of is the last column that's o n but instead of for frame i minus one it is for frame what and for the last one so it's exactly this guy here the fourth column the first three numbers in the fourth column of t.

Zero and that is exactly what comes here and done so you see once you have the t matrices in the dh method all you need is to look into the third and the fourth column of the t matrix that will give you everything you need here to calculate the columns of the j matrix and then put them side by side and it's.

Over okay and it's very systematic approach you don't need to find these uh explicit functions and then take partial derivative of them because as i said the x y z are not too bad but these guys are not always trivial okay but here it doesn't care as long as.

You form your t matrices so now to make this a little bit cleaner for you and more obvious let's go and look at a couple of examples here so we can digest this material a lot better so we want to go and look at the um planar arm example again.

2dof for which we have the jacobian from our previous examples correct and see what we get well if you remember from the dh method and the two degree of freedom plan or arm we had two a matrices we had a one and a two that's all we had because it has only two degrees of.

Freedom and i don't know if you remember these a's and and not so they are four by four matrices let me make them a little bit bigger if we go back and look at our lectures this is zero zero zero one this was a rotation z with angle theta so it should be like zero.

Zero 1 0 0 this is c 1 negative s 1 s 1 and c 1 and this is the location of origin of frame 1 in frame 0 which was a1 c1 a1 s1 and 0 this is the a1 that we got from the dh method and getting these a's is not hard because the a's if you remember it has a.

General formula based on the three parameters alpha i d i theta i and a i correct you remember each row in that table has all of these four numbers and then a in general was based on these four parameters the components of it the last row is.

Always zero zero zero one so it's only these twelve components that are formulated based on these guys and if you remember in general a i was a rotation of z and theta i times a translation of z and d i times a translation.

X and a i hopefully this one go away so i can continue followed by a rotation of x and alpha i so it was each component in it was a function of one or a few of these variables and if we read the.

Four numbers from each row and plugged in it will give us one of these a's correct and when you multiply several of these a's you will get an appropriate t so just go back and look at the two lectures we had on the forward kinematics using the dh convention okay so plug and play okay it's not.

Really hard to digest and understand so that was a1 and then again a2 if you remember is a similar correct except one becomes two and this is two in one so you will get um a2 c2 a2 s2.

And then t1 is simply a1 so t1 and a1 are the same that's it and t2 was a1 times a2 so you have to multiply these guys together and if you go back and look at the dh method again i guess it was uh c12 negative s12 where one two means some of.

Them s12 c12001 zero zero zero zero zero 1 and then what this one was a 1 c 1 plus a 2 c 1 2 this one was a a1 s1 plus a2 s12 and this was zero.

Okay so these were the only two t's that i need because for this robot n was two okay that's all it is so clearly my j in general if i consider the end effector to have six uh linear velocities this is gonna be a what a six by two in general so the question is what is this well.

Clearly here we consider it to be column one and column two where each column is clearly a six by one now how do i get these columns well we go and use the formulas that we have here now both of the joints for this robot are revolute so for both of them i have.

To use this formula the top one so clearly clearly your j1 the first column is what the top three components of it are z i minus one o n minus o i minus one now i here is one so z i minus one means z naught cross o n which is.

O two here minus what oh uh this should be low two o zero both of them in zero correct and this is of course z of zero and zero everything here is with respect to zero and then here is simply z of zero and zero or if you want you can get rid of all of.

These extra zeros because we know the reference here for everything is the base so it is going to be like that based on what we have okay what is it now what is z 0 z 0 what is z of 0 in 0 what what would you say.

Because if you remember if we want to find z i minus 1 and o i minus 1 i have to go and look into t i minus 1 and since i minus one here is zero means i have to look into t zero but there is no t zero here we only have t one and t.

Two t zero is anything in itself it's the base frame with respect to itself which clearly has what it has no if you ever want t 0 0 you don't have to but if you want t 0 0 let me get rid of this if you want t 0 0 it's the first frame written in itself.

Well what do you think the answer is that's right the rotation matrix is identity because there is no rotation and the origin of 0 and 0 is all zeros so t 0 if you ever wanted it is the identity matrix for rotation and a bunch of zeros for the origin and the last row is always constant.

So this is o of zero and zero and this is what z of zero which of course it's the z-axis zero zero one so z zero is simply what zero zero one no big deal what is o zero of course that's the origin of the base that's o zero here that's not a big deal.

And what is o2 now well o2 comes from t2 and t2 is this guy so this is o 2. so just subtract o0 from o2 which is going to be the same as o2 and cross multiply it with this so basically cross multiply this by that z naught cross o2 right.

So it is going to be this vector cross that vector and this is just gonna be zero zero one and if you calculated what's going to happen the bottom part is clear what's going to be the top part okay if you do it it's only k.

Right k cross i is negative k cross i is j k cross j is negative i k cross k is 0 and there is no k so it's going to be negative of this guy as the first component positive of the second one for the second component and then there is no z so.

So this is the top portion of it and then the bottom portion of it is clearly zero zero and one so this is your first column of the jacobian what's the second column similar second column is instead of zeros you have to plug in one because uh the index here.

Here and here is always one less than that so it's going to be z1 cross o2 minus one and z1 and what is that where do i get those well o2 i already have it i know it what is o1 what is z1 for that i need to go to t1.

This last column here is one the column before that is what z one or z one a vector that's okay it's a unit vector so it's better to use hats that's it let's plug in again this is just 0 0 1 and this is 0 0 1 across now you have to subtract those two when you subtract these two.

The first element in o2 would go away you see z this o1 and o2 when you subtract o2 minus 01 this first element would be canceled so all you will get is a 2 c 1 2 a 2 s 1 2 and 0. and when you carry out this.

One you will get something similar again it's negative a2 s12 negative or positive a2 c12 and zero for the first three and then for the next three again zero zero one and now put them side by side j is j one and j two.

So all you need is to just bring these guys and put them side by side done this is my j which is a six by two clearly is that the same thing that we got when we did those partial derivatives absolutely let's go back and look at it let's see.

If i have it somewhere here similar to this i don't know if i have it somewhere but hopefully i do yeah you see these are um no seems like i cleaned it but that's okay you clearly see.

Here when i ignore theta x theta y and everything else these guys are exactly here because this robot does not have a theta x in this case your theta x is simply zero it has no role no contribution from theta one dot or theta two dot so both of these are zero.

When theta y in general is zero or theta y dot is zero you can say both of them it means these guys are zero and since the z of the end effector is zero uh well i guess the order has to change the top one is z z zero the first one is zero because.

Theta x is zero the second one is zero because theta y is zero the third ones are zero and what about theta z well in this case clearly theta z is theta one plus theta two so if you take partial derivative you will get this so you see the derivative of omega z with respect to theta one dot.

Is one with respect to theta two dot is also what one so this is the two degree of freedom planar arm the jacobian of it if you consider everything okay in general if you consider that zeta vector to be six by two as it is in real life then jacobian is.

Gonna be six by two and this is that jacobi okay so hopefully getting this is not as bad now um if i want to show you another example of this we can look at for example ascera so for scara.

We had the dh table and everything and for that we can get the t matrices now let me show you the t matrixes for it so the t matrices for scara are these guys that we have calculated or i have calculated that was the robot the frames from zero all the way to.

Frame four the specs for it it had theta one theta two d3 and theta four there is also this constant d4 here the offset these are the t matrices from t1 to t4 and now i can use the third and fourth column of these matrices to calculate j1 to j for the four.

Columns of the jacobian matrix so if i want j one well the first joint is rotary so it is going to be z naught cross o four minus o zero and then z zero okay where do i get z zero and o zero all of it from t.

Zero again there is no t zero and you know whenever you're down to this very first one your z is always the uh z that we always have in our xyz chord the net zero zero one and um.

Your o zero is simply all zeros okay so this first one is no big deal o four is this guy here so if i plug that in do a um cross product since this o zero has all zeros you basically exactly get that o4 cross multiplied by this always you know k cross i is j so that.

Component comes to the second column positive the j goes to negative i and then k cross k is zero regardless okay so uh you're not going to get anything out of k cross k so you will get as i said um negative a1 s1.

Negative a2 s12 a1 c1 plus a2 c12 and 0 that is for the top part and the bottom part is simply 0 0 1 so that is the first column of your jacobian move to the second column second column again second join is rotary so it is going to be z one this time cross o four.

Minus o one then uh here is gonna be z one where do i get z1 and o1 because o4 is the same thing i go to t1 this time look at t1 this is your z number one and uh sorry o number one and this is your z number now pay attention that these.

Calculations might look a little bit too much and intimidating sometimes but for a computer if you program them very nicely they are nothing okay for a pro for a computer that can carry out all these matrix products and read your dh table so all you need to really give to your code is the ds.

Table then it plugs in finds all of the a's and it keeps multiplying the a's to get all of the t's and then reads the columns three and four of the t's plug them here and you just need to need to tell it which joint is what whether it's rotary or prismatic so it.

Uses the appropriate formula calculate the columns put them next to each other so for a computer if you program it well since they are very good like matlab especially for multiplying matrices and reading a column of a matrix or anything like that writing this and allowing it to calculate the.

Complicated jacobian matrix for robots with high degrees of freedom with this way it is going to be quite easier than actually going and calculating those functions for the angle that are not always trivial but anyways the calculation of jacobian is not something that is super super super easy okay you have.

To work a little bit on that so z1 is uh but once you do it one time you can use it forever so that's your z1 that's given then here you have to subtract o4 minus o1 so this a1c1 and a1 s1 gonna go away and your z is still 0 0 one so again you will get something similar except for the first component gone because you.

Subtracted one from that and one has both of those so you will get a two s one two uh a two c one two and zero and again zero zero one that's the second column of the jacobian and we go to three column three there.

Are four columns in general because there are four variables now for three the third joint is prismatic right the third joint is prismatic so we have to use the prismatic formula which if you remember it's even simpler it says simply zi minus one and a bunch of zeros so prismatics are really easy so all you need here is.

Z number two and a vector of three zeros that's all it is it's very easy and where do i get z2 well all i need is to go to t number two this guy here that is z2 just zero zero negative one so here we go it's gonna be zero zero negative one for.

The top one and the bottom one is all zeros done you see this column is not even a function of any variable the first two columns are functions of data one and two but this one is clearly not it's just a constant column and then j4 again that's rotary so you need z3.

Cross o4 minus o3 um and z3 and again you go and look c3 and o3 you go to t3 and this is your o3 and this guy is your z3 okay so z3 is clear when you subtract o4 and o3 from each other all you will get.

Is so the first two elements are zero this is going to be just a negative d4 remaining correct um yes so you have to cross multiply 0 0 and negative 1 by really 0 0 and negative d4 correct as far as i can tell because that's o3 that's o4 you subtract that is what you get and these are both.

K vectors k cross k is not going to be anything it's going to be p over 0. i just wanted to make sure when i subtract o4 from o0 and cross multiply that k by those yes k only that does have crossed with inj that's good here z1 was similar.

So no worries here z2 this one was so clear here z3 yes that's this one that's the subtraction again this is going to be pure zeros so this is going to be all zeros and z3 was just two zeros and a negative one you see the fourth column is also a.

Constant column so once you put all of these together your jacobian is going to be see if i can get this portion and and the rest of it is not that bad zero zero negative one three zeros and then zero zero zero zero zero negative.

One so this is more jacobian done okay so that's the jacobian of the scara and you can get jacobian of anything else okay and if you look the first two column of it are exactly like the 2dof planar arm because scara is something.

Like that really okay the last thing i want to talk about although the video is getting long but i think it's relevant that we talk about it right here is analytic jacobian versus geometric jacobian and i told you the difference is.

Really all depends on how you define this omega okay this omega is time derivative of what what angles when we defined this geometric jacobian this j that we calculated so far this omega or the components of this omega were what the time derivatives of theta.

X theta y and theta z where they were the absolute angles of the end effector frame in the base frame absolute angles extrinsic rotations but most of the time these angles are not how we measure the orientation.

Of the end effector and so when we take a derivative of them then the omega they give us is also not this omega it's a little bit different right the question is if we change this omega to be let's say the omega coming from euler angles then how does my jacobian would change and here let's take a look.

So here i assume that i have three euler angles phi theta and psi here the order is reversed so the site theta phi is phytate aside but it does not really matter it's just notation so here the orientation of the end effector frame with respect to the base is shown with three euler angles.

Phi theta and psi if you remember in one of our previous videos i showed you if i know the euler angles how can i get what the angular velocity of the end effector in base or in end effector in inertial if i know my euler angles and their time derivatives phi dot theta dot and.

Side that how can i find my omega of the end effector in inertial frame please go and watch my video on euler angles you'll see how this guy is calculated i calculated it in two different ways one was using rotation matrixes and projecting everything back to the iframe.

One was using geometric uh projections and showing you with geometry really but this is the omega of end effector in base based on those three euler angles so you see it's not as simple as the time derivative of three angles not only the time derivative of the angle.

Theta dot phi dot psi that are involved there are sine and cosine of the angles are also involved because these guys are intrinsic angles they are with respect to the current x's not all of them are absolute angles okay so for that reason your omega is different.

Now this is what i do if here i define my end effector velocity to be what the time derivative of the position of the end effector in base so if d of e with respect to i here is the position of the end effector origin with respect to the base.

If i take time derivative of that this is clearly what that velocity okay which is the same for both of them for both representations whether you use absolute angles or use what euler angles v is not going to change because v is only depending on x y and z it has.

Nothing to do with angles but here zeta was the vector omega which was based on absolute angles here my angular velocity is defined using alpha dot where alpha was the vector of the three angles okay and when i say alpha dot alpha that means what.

It means phi dot theta dot and psi dot the angular velocities of the euler angles the euler angular velocities basically then i cannot say this guy is the same as this one these two are two different things right at least the bottom.

Portion of them are different the top portion of them are the same the bottom portion are different these are the derivative of the absolute angles these are the derivative of what the relative angles but can i relate them to each other the answer is yes so how can i relate them so this is what.

I do this act this zeta that we defined and we calculated so far if you remember it was equal to j times q dot correct and this j that we so far been calculating we call it geometric jacobian.

I can also define a similar jacobian for this new uh angular vela for this new end effector velocity vector this x dot where clearly here x means what when we say cap x this chap x here is what the x of the end effector in i.

The y of the end effector in i this x and this x are different that's a scalar this is the whole vector the z of the end effector in i and then what the three euler angles which are phi theta and psi so this is the position of the end effector time derivative of that is.

Going to be the velocities of the end effector for this one since it's different from zeta if i want to write it as a matrix times the joint velocities q dots this matrix which relates q dot to this different this one i call analytic jacobian and now the question is are these two.

Geometric and analytic which are using different angles and of course different angular velocities uh by different angular velocities i mean theta dot phi dot psi dot can i relate them the answer is yes how so take a look here this matrix this vector that i found the euler angular velocities combined.

With sine and cosine to give you the omega vector vector in base i can write it as a matrix product i can write it as a matrix of theta phi and psi and since theta phi and psi we call it alpha i can call it this matrix what b of alpha or you can say this is a matrix b.

Of what as i said phi and theta and psi because you see all of those parameters are actually it is only theta inside there is no phi in this one so it is actually like this it is uh theta and psi okay but if you consider that this is also a function of phi.

But for the functionality of i is zero so there is nothing in it then you can call this whole thing to be your alpha so you say this is my matrix p of alpha times these um alpha that sometimes is phi dot theta dot inside that which i call what alpha dot so you see here.

Again if the angles were absolute if the angles were absolute the omega of end effector in base would simply be what simply three components theta x dot theta y dot theta z dot done but now that there are euler angles it's not simply equal to these.

Three it's equal to a matrix times those three we call it b so it's b alpha times alpha dot now if you replace that here what happens if you replace it so this is your zeta let's start with zeta zeta is equal to j q and q dots and it's also equal to v and omega v was d dot.

And omega instead of writing it as this i write it as this top relation omega is b alpha times alpha that and then i rewrite this again into a matrix format like that why because i want to pull this out and remember this one was what this is that x big x dot so i'm trying to relate zeta to x dot.

And you see the relation is done via this matrix where a portion of it is b of alpha and since this x dot was itself gen analytic jacobian times q dot now these guys are equal and if you get rid of the q dot you see the relation between analytic jacobian.

And what the geometric jacobian so you need to multiply geometric jacobian by this which is i zero zero and b alpha inverse to get what analytic and if you want to know about the shape of this matrix what's the size of that well it depends of course on the number of joints right but let's say here you have.

Six joints okay so both of these guys are six by six right or if you have arbitrary joints just n then both of them are what what is the dimension for each one remember they are both 6 by n correct.

So what's the dimension of this matrix what would you multiply by six by n to get another six by n of course six by six so this matrix is always six by six so when it says zero it's not just one number zero is a three by three zero vector a matrix this is also a three by.

Three zero matrix this is i three by three and this b alpha inverse is also three by three so if you look at it it looks like this one zero zero zero one zero zero zero 1 that's your i then you have 2 0 matrices all 0 so it looks like this.

And then you have inverse of this matrix inverse of this three by three so you have to invert that matrix and if you want i can do that for you here just as the last practice so what i need is psi and theta i call it cnp if you don't mind.

And my matrix b is going to be what it is going to be cosine sine sine theta cosine sine sine theta times i times sine theta followed by negative sine sine zero the next one is um sine size sine theta.

Sine sine sine theta cosine of psi and zero cosine theta zero one then all i need is to invert me correct there we go here oh i think that's let me see if we can simplify the answer.

Yes it did good job so it is going to be cosine psi divided by sine theta so this part i have to make a little bit bigger see if i can move it a little bit we'll see if we can extend this and get one of the zeros okay let's see if we can squeeze this in.

So cosine psi divided by sine theta cosine psi divided by sine theta is this element then you have sine side divided by sine theta and zero and then you have what negative sine psi cosine psi zero and finally negative cosine psi cosine t.

Over sine t cosine psi cosine t sine t negative cosine sine cosine t over sine t theta actually and negative cosine t over sine t sine psi and one so it's the same as this except.

This sine outside yes so this is going to be that matrix that you have to multiply by whatever jacobian that we had from the previous cases let's say for example with the scara right or with the 60of of course for the scary that you only have one angle you have no problem.

This is really uh the case and the useful thing when you have uh three uh rotary angles at the end so like you have a spherical wrist okay so your robot is deck stressed so you can determine the orientation of it with three angles that's where this guy comes very handy because instead of absolute angles you most of the time use.

Euler angles and then you have to multiply this by whatever jacobian that we calculated so you get what the analytic jacobian and what's the good thing about this analytic jacobian if you multiply this analytic jacobian by x dot y dot z dot and then what.

Phi dot theta dot and psi dot that will give you the what um it will give you the end effector velocity like this or if you wanted zeta if you wanted zeta zeta is what j times q dot correct.

And uh the problem is with this q dot if you have q dot and j here you clearly see if you look at j j is this matrix times j inverse so j is this times j analytic so uh i three by three zero three by three zero three by three and b of alpha 3×3.

So if you have jacobian analytic then you multiply this matrix but that guy will come in to play here correct and you get this one let me just write this one fast too so our notes are good and complete and it was um.

Basically let's see if i can no no i can't cosine sine sine theta negative sine sine zero sine size sine theta cosine sine zero and we have cosine theta zero and y so if you have analytic jacobian you.

Multiply by this metric that will give you geometric jacobian and then you can multiply it by q dot to give you what vector zeta so depend on what your sensors are giving you whether your sensors are giving you the um euler angular velocities or they.

Are giving you the absolute angular velocities you can basically use them align with jacobian geometric or jacobian analytic to get the end effector velocities okay so it all depends on what your sensors are returning to you okay so hopefully this lying lecture.

Was useful to you there are several other topics that we have to cover and we will but this video is already too long so let's uh see you in the next lecture thank you

RELATED ARTICLES

Most Popular