Sir ,how can I solve pulley constraints?

Sir ,how can I solve pulley constraints?


1 Answers

askIITians Faculty 747 Points
7 years ago
The next equality constraint we will derive is the pulley constraint. A pulley constraint can be used to join two bodies at a fixed distance. In addition, the constraint can be used to simulate a block-and-tackle.

Let’s review the process:

Create a position constraint equation.
Perform the derivative with respect to time to obtain the velocity constraint.
Isolate the velocity.

Using these steps we can ensure that we get the correct velocity constraint. After isolating the velocity we inspect the equation to find J, the Jacobian.

Most constraint solvers today solve on the velocity level. Earlier work solved on the acceleration level.


Once the Jacobian is found we use that to compute the K matrix. The K matrix is the A in the Ax = b general form equation.

Position Constraint
So the first step is to write out an equation that describes the constraint. A Distance Joint should allow the two bodies to move and rotate freely, but should keep them at a certain distance from one another. For a Pulley Joint its similar except that the bodes distance is constrained to two axes. In the middle we will allow the option of a block-and-tackle. Examining the image to the right, we see that there are two bodies: Ba, Bb who have distance constraints that are along axes: Ua, Ub which were formed from the Ground and Body anchor points: GAa, GAb, BAa, BAb.

Given this definition we can see that the direction of Ua and Ub can change if the bodies swing left or right for example.

Unlike the Distance Joint, a Pulley Joint allows the distances from the ground anchors to the body anchors to increase and decrease (the magnitude of Ua and Ub can also change). However, thetotaldistance along the two axes must be equal to the initial distance when the joint was created (this is what we are trying to constrain). If we apply some scalar factor (or ratio) to the distances we can simulate a block-and-tackle.

We can represent this constraint by the following equation:

[pulley (1)]


[pulley (19)]
[pulley (2)]
[pulley (7)]

Where [pulley (3)] are the length of Ua, body a’s body anchor point, body a’s ground anchor point, and the vector Ua respectively.

Likewise [pulley (4)] are the length of Ub, body b’s body anchor point, body b’s ground anchor point, and the vector Ub respectively.

[c-sub-i] is computed once when the joint is created to obtain the targettotallength of the pulley.

Finally [r] is a scalar ratio value that will allow us to simulate a block-and-tackle.

To review, our position constraint calculates the current lengths of the two axes (applying the ratio to one) and subtracts it from the initial to find how much the constraint is violated.

The Derivative
The next step after defining the position constraint is to perform the derivative with respect to time. This will yield us the velocity constraint.

The velocity constraint can be found/identified directly, however its encouraged that a position constraint be created first and a derivative be performed to ensure that the velocity constraint is correct.

Another reason to write out the position constraint is because it can be useful during whats called the position correction step; the step to correct position errors (drift).

Taking the derivative of our position constraint we get:

[pulley (5)]

Then just to clean up a bit:

[pulley (6)]

Now we need to perform the derivative on [l] . If we remember [l] was defined as:

[pulley (2)]
[pulley (7)]

So let’s side step for a minute and perform the derivative of [l] :

[pulley (8)]

We needed to use the chain rule in order to fully compute the derivative where the derivative of u:

[pulley (9)]

The derivative of a fixed length vector under a rotation frame is the cross product of the angular velocity with that fixed length vector.

Note here that the g vector (ground anchor) is constant and therefore becomes the zero vector.

In the last few steps I replaced a portion of the equation with:


In addition, I replaced the dot product with a matrix multiplication by:


Now if we substitute back into the original equation we get:

[pulley (16)]

Isolate The Velocities
The next step involves isolating the velocities and identifying the Jacobian. This may be confusing at first because there are two velocity variables. In fact, there are actually four, the linear and angular velocities of both bodies. To isolate the velocities we will need to employ some identities and matrix math.

The linear velocities are already isolated so we can ignore those for now. The angular velocities on the other hand have a pesky cross product. In 3D, we can use the identity that a cross product of two vectors is the same as the multiplication by a skew symmetric matrix and the other vector; seehere. For 2D, we can do something similar by examining the cross product itself:

[dc (10)]

Remember that the angular velocity in 2D is a scalar.

Removing the cross products using the process above yields:

[pulley (17)]

Now, just to clean up some, if we inspect:


Now replacing what we found above into the original equation (and some clean up):

[pulley (10)]

Now if we employ some matrix multiplication we can separate the velocities from the known coefficients:

[pulley (11)]

Now, by inspection, we obtain the Jacobian:

[pulley (12)]

Compute The K Matrix
Lastly, to solve the constraint we need to compute the values for A (I use the name K) and b:

See the “Equality Constraints” post for the derivation of the A matrix and b vector.

[ptpc (1)]

The b vector is fairly straight forward to compute. Therefore I’ll skip that and compute the K matrix symbolically:

[pulley (13)]

Multiplying left to right the first two matrices we obtain:

[pulley (14)]

Multiplying left to right again:

[pulley (15)]

If we simplify using:


Remember the inertia tensor in 2D is a scalar, therefore we can pull it out to the front of the multiplications.

[pulley (18)]

Plug the values of the K matrix and b vector into your linear equation solver and you will get the impulse required to satisfy the constraint.

Note here that if you are using an iterative solver that the K matrix does not change over iterations and as such can be computed once each time step.

Another interesting thing to note is that the K matrix will always be a square matrix with a size equal to the number of degrees of freedom (DOF) removed. This is a good way to check that the derivation was performed correctly.

Think You Can Provide A Better Answer ?

Provide a better Answer & Earn Cool Goodies See our forum point policy


Get your questions answered by the expert for free