21.8.13

How To : Rig a Universal Joint in Maya




Universal Joints, often called cardan joints, are a means of transferring rotational energy from one variable axis to another and are used all over the place. They're basically a pair of hinges and you'll these on drive shafts everywhere where you'll need to compensate for movement. 



You'll often see these used in pairs, and there's a very good reason for this. The universal joint's downfall is that doesn't transfer it's energy at a constant rate, it's more of a cyclic wave that resolves every half turn. Greater angles between the two connected axis cause a larger deviation and ulitmatelt failure of teh system. We'll see an example of this deviation later on,

By chaining another universal joint to make a pair (a double cardan shaft), this deviation will (almost) resolve itself and we will get an approximate constant velocity.  It's not a perfect system, even in real life, but it is good enough for drive shafts and the like. For a perfect system, you'll need to look at a CV (constant velocity) joint or a Thompson coupling

So it took me a while and a bit of head scratching to get it, but the solution on how to rig this in Maya is really is simple. Surprisingly, there's not many tutorials about this so here goes.

1. Build the Geometry

 



Typically, a universal joint consists of an input shaft which supplies the initial rotational energy, connected to a yoke which holds the journal cross, which in turn rotates another yoke connected to the output shaft which receives the energy.

Only three meshes are needed to give a good representation as we'll combine the shafts and yokes in one mesh. In fact, you only need to build one shaft as the other is an exact duplicate, albeit flipped and rotated

Build the journal cross and name it journalCross. Build the shafts and name them inputShaft and outputShaft, locate and rotate them as shown in the diagram below and be sure to freeze all transforms making sure all the pivots are at (0,0,0). In this example, align the main rotational axis with the x axis as shown.



Parent the journal cross under the inputShaft. This is a critical step, and is key to setting up the correct behaviour as we'll need to inherit the inputShaft's rotation through the heirarchy.

2. Create the locators

 


We'll need two locators; one locator to tell the rig which way is up relative to it's local rotation and the other as a control to give the journal cross and output shaft something to aim at.

Create one locator, call it upLocator, position it as shown (0,0,1) and parent it under the inputShaft. This way, the rig's up locator will rotate with the input shaft.

Create the other locator, call it aimLocator and position it as shown (5,0,0)



3. Create the Constraints

 


We'll only need two aim constraints, one for the journalCross and one for the outputShaft.

For the journalCross, if you look at it's axis you can see we'll only need to rotate it in the Z axis. It can't rotate in Y and it will inherit it's parent's x rotation so we only need to aim it's Z axis at the aimLocator and as it's rotating, we'll use the upLocator to set it's world up vector to be sure we get the right results.

Select the aimLocator, select the journalCross and select the aimConstraint command with the following options.



For the outputShaft, the driving animation is going to come from the upLocator, and we'll use this as a World Up Object to tranfer the rotational energy from the input shaft,m whilst aiming it at the aimLocator similar to the journalCross.

Select the aimLocator, select the outputShaft and select the aimConstraint command with the following options.


4. Animate and Test the Rig

 

To get it animating, select the inputShaft and enter '=frame * 10' in the object's X Rotation channel in it's attibute editor and hit play on the timeline.


If all went well, you should see a  similar animation to the one below when you hit play on the timeline.



You may have to adjust your timeline range, or instead you may be happy to just scrub the timeline. Now if you move the aimLocator, you can really see how this rig works.



Very simple to setup and very cool, but it did take a while to refine it to these simple steps.

Conclusion

 

I mentioned earlier about cyclic waves and deviations. In the anim below, I've positioned the rig to show what this looks like. Try it for yourself. You can see how the transferred rotational energy is not constant, but accelerates and decelerates in time to catch up with itself after 180 degress rotation. This is not a rig issue, this is a real world issue and is the reason why these universal joints are used carefully with relatively shallow angles between the input and output shafts. You can almost see the mechanical stress this would cause, not to mention the physical limitations of such extreme angles.



This cyclic nature is often overcome by adding a second universal joint in line with it as you can see in the example below. This goes a long way to cancel out the deviation but even in real world scenarios it's not perfect. This arrangement is referred to as a double cardan joint.


Hope this is of use, have fun and and let me know how you go.



8 comments:

  1. This one's crazy...seriously! Thanks for the post. I wanted to know if it was possible to put up a post on how to rig a conveyor belt in maya. thanks.

    ReplyDelete
  2. Thanks, I look into a post about conveyors though I think there's quite a few out there already.

    ReplyDelete
  3. Paul i just discovered your blog and it is mathematical :D. anyway, i was working on a 6-dof robot arm rigging with inverse kinematics almost a year now and wanted to ask if you have any idea. again, great blog.

    ReplyDelete
  4. Hi Sergen, not sure I follow you...For 6 degrees of freedom, do you mean that the arm has all 6 axis available to move in using 3 joints (or a combination of) or do you mean one joint with 6 degrees of freedom?

    To use IK, I would reduce the problem down to a collection of constraints and IK chains. Maybe some top level aim constraints for the main rotation, then a simple IK rig downstream to control the local targeting with pole vectors driven by the parent objects.

    I'm sure there's quite a few solutions to this, and most will be dependent on what type of rig control you're after or need. However, try to keep it as simple as possible. A simple rig that gets you nearly there is probably more productive, quicker to edit and easier to debug than a complex rig that takes time to develop and understand and is easier to break.

    ReplyDelete
  5. Hi Paul,

    Thanks for your awesome video.

    I need to design the same joint in the CATIA for my robotics project and I don't have the appropriate geometry. If it is alright, would you mind sharing the blueprint of the model with me?

    Warm Regards,
    Heris

    ReplyDelete
  6. Wow ! If time is money , then this is time saving.

    ReplyDelete
  7. Awesome! Thanks for sharing with us. If you want to know more about on Rotar Universal Joints so you can visit us.

    ReplyDelete