Help building Jacobian using partial derivative
Posted: Thu Jan 30, 2014 9:03 pm
I'm trying to get my mathematical ducks in a row and finally tackle building Jacobians for a constraint using partial derivatives. In the past I've sort of messed around with what I want the constraint to do in velocity space and built up the Jacobian that way. But this time I'd like to tackle doing it from first principles from the position-space constraint equation.
As a medium-difficulty problem, I'm tackling a revolute joint pinning a point on a rigid body to a fixed point in space in 2D. Can someone take a look at what I have and help me correct any misunderstandings? I'm not being super formal below with the notation, as many of the matrices below are actually block matrices, but hopefully it makes sense. Also, apologies in advance for this massive wall of text
...
Let [θ] be the 2D rotation matrix for an angle θ. That is:
Let [θ, p] be the 2D affine transformation matrix for orientation θ and translation p. That is:
Then for my revolute joint I want:
[θ,p] * r = { c.x; c.y; 1 }, where r is the position of the pivot in the body's local space, and [θ,p] is the local-to-world transformation matrix for the body, and c is the position we're pinning the body to in world space.
Let X = { θ; p.x; p.y } be the 3x1 column vector of the degrees of freedom of the system. ie: X is the position and orientation of the body.
We can write the above as f(X) = { c.x ; c.y ; 1 }. Then take the derivative. Using the chain rule, this becomes:
f'(X) * X' = {0;0;0}
f'(X) is the Jacobian, and X' is the change in the degrees of freedom over time, ie: the body's linear and angular velocity.
So now we want to take the Jacobian of the affine transformation matrix.
First:
So then:
where [#] is a 2x2 matrix which takes a vector and maps it to its perpindicular. ie:
So now we take [θ,p] and find the partial derivatives of it with respect to x, y, and θ. First, we subdivide the matrix in terms of sub functions:
And then we take the partial derivative:
And of course, being all 0s, the last row can just be dropped in practice. That gives a 2x3 matrix, which makes sense: two degrees of freedom have been removed from the system.
...
But now my question: I have a w term (the angular velocity) in my Jacobian, which I don't think is right! I feel like the above is almost what I expect, but I can't figure out how to get rid of that w term.
As a medium-difficulty problem, I'm tackling a revolute joint pinning a point on a rigid body to a fixed point in space in 2D. Can someone take a look at what I have and help me correct any misunderstandings? I'm not being super formal below with the notation, as many of the matrices below are actually block matrices, but hopefully it makes sense. Also, apologies in advance for this massive wall of text
...
Let [θ] be the 2D rotation matrix for an angle θ. That is:
Code: Select all
| cos θ -sin θ | = [θ]
| sin θ cos θ |
Code: Select all
| cos θ -sin θ p.x | = | [θ] p | = [θ, p]
| sin θ cos θ p.y | | 0 0 1 |
| 0 0 1 |
[θ,p] * r = { c.x; c.y; 1 }, where r is the position of the pivot in the body's local space, and [θ,p] is the local-to-world transformation matrix for the body, and c is the position we're pinning the body to in world space.
Let X = { θ; p.x; p.y } be the 3x1 column vector of the degrees of freedom of the system. ie: X is the position and orientation of the body.
We can write the above as f(X) = { c.x ; c.y ; 1 }. Then take the derivative. Using the chain rule, this becomes:
f'(X) * X' = {0;0;0}
f'(X) is the Jacobian, and X' is the change in the degrees of freedom over time, ie: the body's linear and angular velocity.
So now we want to take the Jacobian of the affine transformation matrix.
First:
Code: Select all
cos' θ = -θ' * sin θ = -w * sin θ
sin' θ = θ' * cos θ = w * cos θ
w = θ' = angular velocity
Code: Select all
[θ]' = | cos' θ -sin' θ | = w * | -sin θ -cos θ | = w [θ] [#]
| cos' θ sin' θ | | -sin θ cos θ |
Code: Select all
[#] = | 0 -1 |
| 1 0 |
Code: Select all
F1 = { cos θ, -sin θ } dot r + p.x
F2 = { sin θ, cos θ } dot r + p.y
F3 = 1
Code: Select all
J = | I, w [θ] [#] r |
| 0, 0, 0 |
...
But now my question: I have a w term (the angular velocity) in my Jacobian, which I don't think is right! I feel like the above is almost what I expect, but I can't figure out how to get rid of that w term.