Jacobian matrices are a super useful tool, and heavily used throughout robotics and control theory. Basically, a Jacobian defines the dynamic relationship between two different representations of a system. For example, if we have a 2-link robotic arm, there are two obvious ways to describe its current position: 1) the end-effector position and orientation (which we will denote ), and 2) as the set of joint angles (which we will denote ). The Jacobian for this system relates how movement of the elements of causes movement of the elements of . You can think of a Jacobian as a transform matrix for velocity.
Formally, a Jacobian is a set of partial differential equations: .
With a bit of manipulation we can get a neat result:
, where and represent the time derivatives of and .
This tells us that the end-effector velocity is equal to the Jacobian, , multiplied by the joint angle velocity.
Why is this important? Well, this goes back to our desire to control in operational (or task) space. We’re interested in planning a trajectory in a different space than the one that we can control directly. Iin our robot arm, control is effected through a set of motors that apply torque to the joint angles, BUT what we’d like is to plan our trajectory in terms of end-effector position (and possibly orientation), generating control signals in terms of forces to apply in space. Jacobians allow us a direct way to calculate what the control signal is in the space that we control (torques), given a control signal in one we don’t (end-effector forces). The above equivalence is a first step along the path to operational space control. As just mentioned, though, what we’re really interested in isn’t relating velocities, but forces. How can we do this?
Energy equivalence and Jacobians
Energy equivalence is a wonderful property of our universe where the amount of energy expended is the same no matter how the system in question is being represented. This is important to us if we have, say, two different ways to characterize the state of the system.
Let’s go back to our robot arm. Say the arm operates on the horizontal plane, and we characterize the system state in two ways, through joint angle positions, , and end-effector position (in terms of ), . Our arm looks like this:
Work is the application of force over a distance, i.e. . Power is the rate at which work is performed, . In our system, the rate of work at a given moment by applying a force to the end-effector is . Because of energy equivalence, we know that work is being applied at the same rate regardless of the characterization of the system, so: . By setting the two equations equal to each other and plugging in the Jacobian equation above (this one: ) we can get a neat result:
(set them equal)
(sub in for )
(drop out )
(rewrite using transform identities)
So not only does our Jacobian relate velocity from one characterization to the other, it also can be use to tell us given a desired set of forces in end-effector space, , what the corresponding torques, are in joint angle space! Daaang.
To recap: Jacobians are not only instantaneous transform matrices for velocity (), but also for force ()! Well then, if Jacobians are so great, we should probably take a closer look at how to go about deriving them.
Building the Jacobian
First, we need to define the relationship between the position of the end-effector and the robot’s joint angles, . However will we do it? Well, we know the distances from the shoulder to the elbow, and elbow to the wrist, as well as the joint angles, and we’re interested in finding out where the end-effector is relative to a base coordinate frame…OH MAYBE we should use those forward transformation matrices from the previous post. Let’s do it!
The forward transformation matrix
As you recall, transformation matrices allow us to determine where a given point is in a desired coordinate set when it’s defined in a different frame of reference. In this case, we know the position of the end-effector relative to the second joint of the robot arm, but we’re interested in where it is relative to the the base reference frame, which is the first joint reference frame in this case. This means that we just need one transformation matrix, from the reference frame attached to the second joint back to the base.
The rotation part of this matrix is easy, just the same as in the previous post:
The translation part of our transformation matrices is a little different than before though, because now reference frame 1 is changing as a function of the angle of the previous joints angles. So, from trig, we know that if we have a vector of length and an angle , then the position of the end point is and the position is . As a reminder, our arm is operating in the plane, so the position will always be 0. This means that the translation part of our transformation matrix is going to look like:
Giving us the forward transformation matrix:
Which transforms a point from reference frame 1 (elbow joint) to reference frame 0 (shoulder joint / base). The point of interest here is the end-effector, which, similar to the position of reference frame 1, is defined as a function of joint angle and the length of this link of the arm:
To find the position of our end-effector in terms of our origin reference frame we multiply our point by the transformation , giving us:
where by pulling out the term and using the trig identities
we get the position of our end-effector to be
Super! We have defined the position of the end-effector in terms of joint angles. But as I mentioned right at the beginning, we’re interested in both the position of the end-effector and its orientation, so we need to also define how it’s rotated relative to the base frame.
Accounting for orientation
Luckily, this is super straightforward, especially when there isn’t anything complicated like spherical joints involved and it’s just revolute and prismatic joints that we’re dealing with. With prismatic joints, identifying the rotation caused is easy, it’s 0. They’re linear, moving in a single plane, so no rotation.
With revolute joints, the rotation of the end-effector in each axis is simply a sum of rotations of each joint in their respective axes of rotation. In our case, the joints are rotating around the axis, so the rotation part of our end-effector state . Easy! If the first joint had been rotating in a different plane, say in the plane around the axis instead, then we would have .
We are well on our way to finding the Jacobian for this system. What we need to do now is take the partial differential of the above vectors of equations for the system position and orientation with respect to the elements of . We’ll break up the Jacobian into two parts to keep things simpler, and , for the linear and angular velocity, respectively, of the end-effector.
The linear velocity part of our Jacobian looks like:
The angular velocity part of our Jacobian looks like:
To get our full Jacobian, we simply stack our two parts:
And that’s that, Jacobian built!
Analyzing the Jacobian
Now that we have our Jacobian, we should take a moment to look at it and see what it’s telling us about the relationship between and .
For example, you may have noticed that there is a large chunk of zeros in the middle of the Jacobian we just defined above, along the row corresponding to linear velocity along the axis, and the rows corresponding to the angular velocity around the and axes. What this means that our position, and our rotations and are not controllable. Why is that you say? It goes back to our first Jacobian equation:
No matter what joint angle velocities are occurring, it’s impossible to affect those elements through , because the Jacobian nullifies them. Because of this, these rows of the Jacobian are referred to as its null space.
What this means for our system is that because we can’t control these variables, we won’t even worry about specifying them in our end-effector force vector. We’ll drop these rows from both and .
Looking back at the variables we can affect, we notice given any two of we can calculate the third, because the robot only has 2 degrees of freedom (the shoulder and elbow joints). This means that we can actually only control two of the end-effector variables. For our purposes here it’s more useful to control the coordinates, so we’ll drop from our force vector and the Jacobian as well.
So now, our force vector representing the controllable end-effector forces is:
and a Jacobian that looks like:
Note that we could have chosen to specify , in which case (assuming we also chose to control force along the axis) we would have:
But we’ll stick with control of the and forces instead, as it’s a little more straightforward.
Using the Jacobian
With our Jacobian, we can find out what different joint angle velocities will cause in terms of the end-effector linear and angular velocities, and we can also transform desired forces into torques. Let’s do a couple of examples. Note that in the former case we’ll be using the full Jacobian, while in the latter case we can use the simplified Jacobian specified just above.
Let’s say that we know the joint angle velocities of the arm, and we want to make sure that the resulting velocity is less than a threshold level. The arm configuration is , the joint angle velocities are , and the arm lengths (for simplicity) are each .
To calculate the resulting velocities, we simply plug in all the values at the current time (all the positions and velocities) and then multiply through!
This tells us that the end-effector’s linear velocity is , and its angular velocity is . The result of these joint angle velocities in the current system state is that translation of the end-effector along the axis to the left, and just a slight bit of movement downwards on the axis, and a rotation around the axis. We could then check to make sure that this is acceptable and adjust accordingly.
This example is the more likely case, and indeed what we’re going to be using Jacobians for as we carry forward and implement operational space control. Imagine that we have the same system configuration as above, and there is a trajectory that we’ve planned in space. From this trajectory we calculate the desired force to apple to the end-effector. As mentioned above we decided to only control the forces along the and axes, and so we can use our simplified Jacobian. Let , so we’d like to apply one Newton in both directions in space. To calculate what this is going to translate into in terms of joint torques:
Calculating this out we find that from our current configuration, to realize the specified end-effector force we need to apply a torque of .
And now we are able to transform end-effector forces into torques, and joint angle velocities into end-effector velocities! What a wonderful, wonderful tool to have at our disposal! Hurrah for Jacobians!
In this post I’ve gone through how to use Jacobians to relate the movement of joint angle and end-effector system state characterizations, but Jacobians can be used to relate any two characterizations. All you need to do is define one in terms of the other and do some partial differentiation. The above example scenarios were of course very simple, and didn’t worry about compensating for anything like gravity. But don’t worry, that’s exactly what we’re going to look at in our exciting next chapter!
Something that I found interesting to consider is the need for the orientation of the end-effector and finding the angular velocities. Often in simpler robot arms, we’re only interested in the position of the end-effector, so it’s easy to write off orientation. But if we had a situation where there was a gripper attached to the end-effector, then suddenly the orientation becomes very important, often determining whether or not an object can be picked up or not.
And finally, if you’re interested in reading more about all this, I recommend checking out this book chapter available online, it’s a great resource.