Skip to main content

Joint Objects

By themselves, body objects are not very interesting and do not do much. To define how they move about in space, we need to specify kinematic constraints between them. QuIRK joint objects store and enforce these constraints.

The Joint Constructor

To create a joint between two bodies, use the command

>> J = joint(firstBody, secondBody) 
ans = 
    QuIRK: sphjoint

The default joint is a spherical (ball) joint. QuIRK also provides built-in support for revolute (hinge), prismatic (translational or sliding), cylindrical, fixed, free, and custom joints.

  • Spherical joints constrain bodies from translating with respect to one another, but not from rotating.
  • Revolute joints constrain bodies from translating or rotating, except for rotation about one body-fixed axis.
  • Prismatic joints constrain bodies from rotating with respect to one another, and only allow translation along one body-fixed direction.
  • Cylindrical joints combine the degrees of freedom of revolute and prismatic joints. They allow only rotation about one body-fixed axis and translation in one body-fixed direction.
  • Fixed joints prevent any relative movement of bodies.
  • Free joints do not constraint bodies at all. (Sometimes this joint is useful as a sort of placeholder.)

To specify which type of joint, and where the joint is located with respect to each body, use the property/value syntax.

Back to top

Joint Options

Here is the full list of options to the joint function. Give the constructor properties as strings, or use the shortcut abbreviations shown (they are not case-sensitive).

A N14 Double Constraint matrix for custom joints
Axis 31 Double meters Axis for revolute, prismatic, and cylindrical joints
B N1 Double Constraint matrix for custom joints
Data Any user-defined data
Point1 31 Double meters Location of the joint from the first body's center of mass, in first-body-fixed coordinates
Point2 31 Double meters Location of the joint from the second body's center of mass, in second-body-fixed coordinates
Type String 'sphere'
Type of kinematic constraint this joint represents

When creating a joint, make sure that the sum of the first body's position and point1 gives the same vector as the sum of the second body's position and point2. QuIRK will return a warning if this is not the case. Specify 'point1' and 'point2' in body coordinates.

You can obtain a list of all the get-able or set-able joint properties by entering the commands get(joint) or set(joint).

Back to top

Fixed and Grounded Joints

The fixed and grounded joints deserve some special consideration, because they are important in setting up multibody dynamics problems.

Fixed joints are good for creating composite bodies out of the cube, ellipsoid, and cylinder primitives. Of course, one simple way to do this is to override the inertia matrix of a body with a user-defined matrix corresponding to the shape you want, but the graphic representation of the body is still limited to a cube, ellipsoid, or cylinder. Binding bodies together with fixed joints also saves some effort carrying out inertia computations, if an inertia matrix is not readily available.

Fixed joints can also be created between one body and "ground," the inertial frame of reference. Do this by replacing the second body in the joint constructor with the string 'grounded', 'ground', or just 'gnd':

>> J = joint(firstBody, 'ground')
J = 
    QuIRK: gndjoint

This joint will then represent a constraint fixing the first body to inertial space. You can then create other joints between the grounded body and other bodies.

Back to top

Custom Joints

For other joint types, specify a custom A and b matrix. A and b must be function handles that accept the arguments (ri, rj, qi, qj, ri_dot, rj_dot, qi_dot, qj_dot, cij, cji). The constraint should match the expression A * d2/dt2(x) = b, in which the state vector x consists of [ri; qi; rj; qj].

Back to top



  • Joseph Shoer

Download QuIRK

Requires MATLAB 2009 or later