3 Mechanical Models I

3.4 Joint components

ArtiSynth supplies a number of basic joints and connectors in the package artisynth.core.mechmodels, the most common of which are described here.

Many of the descriptions are associated with a demonstration model, named XXXJointDemo, where XXX is the joint type. These demos are located in the package artisynth.demos.mech, and can be loaded by selecting All demos > mech > XXXJointDemo from the Models menu. When run, they can be interactively controlled, using either the pull tool (see the section “Pull Manipulation” in the ArtiSynth User Interface Guide), or the interactive control panel. The control panel allows the adjustment of coordinate values and ranges (if supported), some of the render properties, and the different compliance and damping properties (Section 3.3.8). One can inspect the source code for each demo in its .java file located in the folder <ARTISYNTH_HOME>/src/artisynth/demos/mech.

3.4.1 Hinge joint

Figure 3.13: Coordinate frames (left) and demo model (right) for the hinge joint.

The HingeJoint (Figure 3.13) is a 1 DOF joint that constrains motion between frames C and D to a simple rotation about the z axis of D. It implements six constraints and one coordinate \theta (Table 3.1), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}\cos(\theta)&-\sin(\theta)&0&0\\
\sin(\theta)&\cos(\theta)&0&0\\
0&0&1&0\\
0&0&0&1\end{matrix}\right).

The value and ranges for \theta are exported by the properties theta and thetaRange, and the \theta coordinate index is defined by the constant THETA_IDX. For rendering, the properties shaftLength and shaftRadius control the size of a shaft drawn about the rotation axis, using the faceColor rendering property. A demo is provided by
artisynth.demos.mech.HingeJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  HingeJoint (bodyA, bodyB, originD, zaxis)

creates a hinge joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts translation along z
3 bilateral restricts rotation about x
4 bilateral restricts rotation about y
5 unilataral enforces limits on \theta
0 \theta counter-clockwise rotation of C about the z axis
Table 3.1: Constraints (top) and coordinates (bottom) for the hinge joint.

3.4.2 Slider joint

Figure 3.14: Coordinate frames (left) and demo model (right) for the slider joint.

The SliderJoint (Figure 3.14) is a 1 DOF joint that constrains motion between frames C and D to a simple translation along the z axis of D. It implements six constraints and one coordinate z (Table 3.2), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}1&0&0&0\\
0&1&0&0\\
0&0&1&z\\
0&0&0&1\end{matrix}\right).

The value and ranges for z are exported by the properties z and zRange, and the z coordinate index is defined by the constant Z_IDX. For rendering, the properties shaftLength and shaftRadius control the size of a shaft drawn about the sliding axis, using the faceColor rendering property. A demo is provided by artisynth.demos.mech.SliderJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  SliderJoint (bodyA, bodyB, originD, zaxis)

creates a slider joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts rotation about x
3 bilateral restricts rotation about y
4 bilateral restricts rotation about z
5 unilataral enforces limits on the z coordinate
0 z translation of C along the z axis
Table 3.2: Constraints (top) and coordinates (bottom) for the slider joint.

3.4.3 Cylindrical joint

Figure 3.15: Coordinate frames (left) and demo model (right) for the cylindrical joint.

The CylindricalJoint (Figure 3.15) is a 2 DOF joint that constrains motion between frames C and D to translation and rotation along and about the z axis of D. It implements six constraints and two coordinates z and \theta (Table 3.3), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}\cos(\theta)&-\sin(\theta)&0&0\\
\sin(\theta)&\cos(\theta)&0&0\\
0&0&1&z\\
0&0&0&1\end{matrix}\right).

The value and ranges for z and \theta are exported by the properties z, theta, zRange and thetaRange, and the coordinate indices are defined by the constants Z_IDX and THETA_IDX. For rendering, the properties shaftLength and shaftRadius control the size of a shaft drawn about the sliding/rotation axis, using the faceColor rendering property. A demo is provided by artisynth.demos.mech.CylindricalJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  CylindricalJoint (bodyA, bodyB, originD, zaxis)

creates a cylindrical joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts rotation about x
3 bilateral restricts rotation about y
4 unilataral enforces limits on the z coordinate
5 unilataral enforces limits on the \theta coordinate
0 z translation of C along the z axis
1 \theta rotation of C about the z axis
Table 3.3: Constraints (top) and coordinates (bottom) for the cylindrical joint.

3.4.4 Slotted hinge joint

Figure 3.16: Coordinate frames (left) and demo model (right) for the slotted hinge joint.

The SlottedHingeJoint (Figure 3.16) is a 2 DOF joint that constrains motion between frames C and D to translation along the x axis and rotation about the z axis of D. It implements six constraints and two coordinates x and \theta (Table 3.4), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}\cos(\theta)&-\sin(\theta)&0&x\\
\sin(\theta)&\cos(\theta)&0&0\\
0&0&1&0\\
0&0&0&1\end{matrix}\right). (3.25)

The value and ranges for x and \theta are exported by the properties x, theta, xRange and thetaRange, and the coordinate indices are defined by the constants X_IDX and THETA_IDX. For rendering, the properties shaftLength and shaftRadius control the size of a shaft drawn about the rotation axis, while slotWidth and slotDepth control the width and depth of a slot drawn along the sliding (x) axis; both are drawn using the faceColor rendering property. When rendering the slot, its bounds along the x axis are set to xRange by default. However, this may be too large, particularly if xRange is unbounded. As an alternate, the property slotRange will be used instead if its range (i.e., the upper bound minus the lower bound) exceeds 0. A demo of SlottedHingeJoint is provided by artisynth.demos.mech.SlottedHingeJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  SlottedHingeJoint (bodyA, bodyB, originD, zaxis)

creates a slotted hinge joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

Index type/name description
0 bilateral restricts translation along y
1 bilateral restricts translation along z
2 bilateral restricts rotation about x
3 bilateral restricts rotation about y
4 unilataral enforces limits on the x coordinate
5 unilataral enforces limits on the \theta coordinate
0 x translation of C along the x axis
1 \theta rotation of C about the z axis
Table 3.4: Constraints (top) and coordinates (bottom) for the slotted hinge joint.

3.4.5 Universal joint

Figure 3.17: Coordinate frames (left) and demo model (right) for the universal joint.
Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts translation along z
3 bilateral restricts rotation about the final x axis of C
4 unilataral enforces limits on the roll coordinate
5 unilataral enforces limits on the pitch coordinate
0 \theta (roll) first rotation of C about the z axis of D
1 \phi (pitch) second rotation of C about the rotated y^{\prime} axis
Table 3.5: Constraints (top) and coordinates (bottom) for the universal joint.

The UniversalJoint (Figure 3.17) is a 2 DOF joint that allows C two rotational degrees of freedom with respect to D: a roll rotation \theta about D’s z axis, followed by a pitch rotation \phi about the rotated y^{\prime} axis. It implements six constraints and the two coordinates \theta and \phi (Table 3.5), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}c_{\theta}c_{\phi}&-s_{\theta}&c_{\theta}s_{%
\phi}&0\\
s_{\theta}c_{\phi}&c_{\theta}&s_{\theta}s_{\phi}&0\\
-s_{\phi}&0&c_{\phi}&0\\
0&0&0&1\end{matrix}\right),

where

c_{\theta}\equiv\cos(\theta),\;s_{\theta}\equiv\sin(\theta),\;c_{\phi}\equiv%
\cos(\phi),\;s_{\phi}\equiv\sin(\phi).

The value and ranges for \theta and \phi are exported by the properties roll, pitch, rollRange and pitchRange, and the coordinate indices are defined by the constants ROLL_IDX and PITCH_IDX. For rendering, the properties shaftLength and shaftRadius control the size of shafts drawn about the roll and pitch axes, while jointRadius specifies the radius of a ball drawn around the origin of D; both are drawn using the faceColor rendering property. A demo is provided by artisynth.demos.mech.UniversalJointDemo.

3.4.6 Skewed universal joint

The SkewedUniversalJoint (Figure 3.18) is a version of the universal joint in which the pitch axis is skewed relative to its nominal direction by an angle \alpha. More precisely, let x^{\prime} and y^{\prime} be the x and y axes of C after the initial roll rotation. For a regular universal joint, the pitch axis is y^{\prime}, whereas for a skewed universal joint it is y^{\prime} rotated by \alpha clockwise about x^{\prime}. The joint still has 2 DOF, but the space of allowed rotations is reduced.

Figure 3.18: Left: diagram for a skewed universal joint, showing the pitch axis (dotted line) skewed by an angle \alpha relative to its nominal direction along the y^{\prime} axis. Right: demo model with skew angle of 30^{\circ}.

The constraints and the coordinates are the same as for the universal joint, although the relationship between {\bf T}_{CD} is now more complicated. With c_{\theta}, s_{\theta}, c_{\phi}, and s_{\phi} defined as for the universal joint, {\bf T}_{CD} is given by

{\bf T}_{CD}=\left(\begin{matrix}c_{\theta}c_{\phi}-s_{\theta}s_{\alpha}s_{%
\phi}&-s_{\theta}\beta-s_{\alpha}c_{\theta}s_{\phi}&c_{\alpha}(c_{\theta}s_{%
\phi}-s_{\alpha}s_{\theta}v_{\phi})&0\\
s_{\theta}c_{\phi}+c_{\theta}s_{\alpha}s_{\phi}&c_{\theta}\beta-s_{\alpha}s_{%
\theta}s_{\phi}&c_{\alpha}(s_{\theta}s_{\phi}+s_{\alpha}c_{\theta}v_{\phi})&0%
\\
-c_{\alpha}s_{\phi}&c_{\alpha}s_{\alpha}v_{\phi}&s_{\alpha}^{2}+c_{\alpha}^{2}%
c_{\phi}&0\\
0&0&0&1\end{matrix}\right),

where

c_{\alpha}\equiv\cos(\alpha),\quad s_{\alpha}\equiv\sin(\alpha),\quad v_{\phi}%
\equiv 1-c_{\phi},\quad\beta\equiv c_{\alpha}^{2}+s_{\alpha}^{2}c_{\phi}.

Rendering is controlled using the properties shaftLength, shaftRadius and jointRadius in the same way as for the UniversalJoint. A demo is provided by calling artisynth.demos.mech.UniversalJointDemo with the model arguments -skew <angDeg>, where <angDeg> is the desired skew angle in degrees.

Constructors for skewed universal joints take the standard forms described in Section 3.3.3, with an additional argument at the end indicating the skew angle:

  SkewedUniveralJoint (bodyA, TCA, bodyB, TCB, skewAngle)
  SkewedUniveralJoint (bodyA, bodyB, TDW, skewAngle)
  SkewedUniveralJoint (bodyA, bodyB, TCW, TDW, skewAngle)

In addition, the constructor

  SkewedUniveralJoint (bodyA, bodyB, originD, rollAxis, pitchAxis)

creates a skewed universal joint specifying the origin of frame D together with the directions of the roll and pitch axes (in world coordinates). Frames C and D are coincident and the skew angle is inferred from the angle between the axes.

3.4.7 Gimbal joint

Figure 3.19: Coordinate frames (left; rotation angles not shown) and demo model (right) for the gimbal joint.

The GimbalJoint (Figure 3.19) is a 3 DOF spherical joint that anchors the origins of C and D together but otherwise allows C complete rotational freedom. The rotational degrees of freedom are parameterized by three roll-pitch-yaw angles, denoted by \theta,\phi,\psi, which define a rotation \theta about D’s z axis, followed by a second rotation \phi about the rotated y^{\prime} axis, followed by a third rotation \psi about the final x^{\prime\prime} axis. It implements six constraints and the three coordinates \theta,\phi,\psi (Table 3.6), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}c_{\theta}c_{\phi}&c_{\theta}s_{\phi}s_{\psi}%
-s_{\theta}c_{\psi}&c_{\theta}s_{\phi}c_{\psi}+s_{\theta}s_{\psi}&0\\
s_{\theta}c_{\phi}&s_{\theta}s_{\phi}s_{\psi}+c_{\theta}c_{\psi}&s_{\theta}s_{%
\phi}c_{\psi}-c_{\theta}s_{\psi}&0\\
-s_{\phi}&c_{\phi}s_{\psi}&c_{\phi}c_{\psi}&0\\
0&0&0&1\end{matrix}\right),

where

c_{\theta}\equiv\cos(\theta),\;s_{\theta}\equiv\sin(\theta),\;c_{\phi}\equiv%
\cos(\phi),\;s_{\phi}\equiv\sin(\phi),\;c_{\psi}\equiv\cos(\psi),\;s_{\psi}%
\equiv\sin(\psi).

The value and ranges for \theta,\phi,\psi are exported by the properties roll, pitch, yaw, rollRange, pitchRange, and yawRange, and the coordinate indices are defined by the constants ROLL_IDX, PITCH_IDX, and YAW_IDX. For rendering, the property jointRadius specifies the radius of a ball drawn around the origin of D, using the faceColor rendering property. A demo is provided by artisynth.demos.mech.GimbalJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  GimbalJoint (bodyA, bodyB, originD)

creates a gimbal joint with a specified origin for frame D (in world coordinates), and frames C and D coincident and world aligned.

The constraints implementing GimbalJoint are designed so that it is immune to gimbal lock, in which a degree of freedom is lost when \phi=\pm\pi/2. However, the coordinate values themselves are not immune to this singularity, and neither are the unilateral constraints which enforce limits on their values. Therefore, if coordinate limits are implemented, the joint should be deployed so as try and avoid pitch values near \pm\pi/2.

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts translation along z
3 unilataral enforces limits on the roll coordinate
4 unilataral enforces limits on the pitch coordinate
5 unilataral enforces limits on the yaw coordinate
0 \theta (roll) first rotation of C about the z axis of D
1 \phi (pitch) second rotation of C about the rotated y^{\prime} axis
2 \psi (yaw) third rotation of C about the final x^{\prime\prime} axis
Table 3.6: Constraints (top) and coordinates (bottom) for the gimbal joint.

3.4.8 Spherical joint

Figure 3.20: Left: coordinate frames of the spherical joint, showing the tilt angle \phi between the z axes of C and D. Right: demo model for the spherical joint.

The SphericalJoint (Figure 3.20) is a 3 DOF spherical joint that, like GimbalJoint, anchors the origins of C and D together but otherwise allows C complete rotational freedom. SphericalJoint does not implement any coordinates, and so is conceptually more like a ball joint. However, it does provide two choices for limiting its rotation:

  • A limit on the tilt angle \phi between the z axes of D and C, such that

    \phi\leq\phi_{\text{max}}. (3.26)

    This is intended to emulate the limit imposed by a ball joint socket.

  • A limit on the total rotation, defined as follows: Let ({\bf u},\theta) be the axis-angle representation of the rotation matrix of {\bf T}_{CD}, normalized such that \theta\geq 0 and \|u\|=1, and let {\bf r}_{\text{max}} be a three-vector giving maximum rotation angles with x, y, and z components. Then \theta is constrained by

    \theta\leq\|{\bf r}_{\text{max}}\circ{\bf u}\|, (3.27)

    where \circ denotes the element-wise product. If the components of {\bf r}_{\text{max}} are set to a uniform value \theta_{\text{max}}, this simplifies to \theta\leq\theta_{\text{max}}.

These limits can be enabled by setting the joint’s properties isTiltLimited and isRotationLimited, respectively, where enabling one disables the other. The limit values \phi_{\text{max}} and {\bf r}_{\text{max}} are managed using the properties maxTilt and maxRotation, and setting either automatically enables tilt or rotation limiting, as appropriate. Finally, the tilt angle \phi can be queried using the (read-only) tilt property. For rendering, the property jointRadius specifies the radius of a ball drawn around the origin of D, using the faceColor rendering property. A demo of the SphericalJoint is provided by artisynth.demos.mech.SphericalJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  SphericalJoint (bodyA, bodyB, originD)

creates a spherical joint with a specified origin for frame D (in world coordinates), and frames C and D coincident and world aligned.

One should use the rotation limit with some caution, as the orientations which it prohibits can be somewhat hard to predict, particularly when {\bf r}_{\text{max}} has non-uniform values.

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts translation along z
3 unilataral enforces either the “tilt” or “rotation” limits
Table 3.7: Constraints for the spherical joint.

3.4.9 Planar joint

Figure 3.21: Coordinate frames (left) and demo model (right) for the planar joint.

The PlanarJoint (Figure 3.21) is a 3 DOF joint that constrains C to translation in the x-y plane and rotation about the z axis of D. It implements six constraints and three coordinates x, y and \theta (Table 3.8), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}\cos(\theta)&-\sin(\theta)&0&x\\
\sin(\theta)&\cos(\theta)&0&y\\
0&0&1&0\\
0&0&0&1\end{matrix}\right).

The value and ranges for x, y and \theta are exported by the properties x, y, theta, xRange, yRange and thetaRange, and the coordinate indices are defined by the constants X_IDX, Y_IDX and THETA_IDX. A planar joint can be rendered as a square centered on the origin of D, using face rendering properties and with a size given by the planeSize property. For example,

  PlanarJoint joint;
  ...
  joint.setPlaneSize (5.0);
  RenderProps.setFaceColor (joint, Color.LIGHT_GRAY);

will cause joint to be drawn as a light gray square with size 5.0. The default value of planeSize is 0, so drawing the plane is disabled by default. Also, the default faceStyle rendering property for PlanarConnector is set to FRONT_AND_BACK, so that the plane (when drawn) can be seen from both sides. A shaft about the rotation axis can also be drawn, as controlled by the properties shaftLength and shaftRadius and using the faceColor rendering property. A demo is provided by artisynth.demos.mech.PlanarJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  PlanarJoint (bodyA, bodyB, originD, zaxis)

creates a planar joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

Index type/name description
0 bilateral restricts translation along z
1 bilateral restricts rotation about x
2 bilateral restricts rotation about y
3 unilataral enforces limits on the x coordinate
3 unilataral enforces limits on the y coordinate
5 unilataral enforces limits on the \theta coordinate
0 x translation of C along the x axis of D
1 y translation of C along the y axis of D
2 \theta rotation of C about the z axis of D
Table 3.8: Constraints (top) and coordinates (bottom) for the planar joint.

3.4.10 Planar translation joint

Figure 3.22: Coordinate frames (left) and demo model (right) for the planar translation joint.
Index type/name description
0 bilateral restricts translation along z
1 bilateral restricts rotation about x
2 bilateral restricts rotation about y
3 bilateral restricts rotation about z
4 unilataral enforces limits on the x coordinate
5 unilataral enforces limits on the y coordinate
0 x translation of C along the x axis of D
1 y translation of C along the y axis of D
Table 3.9: Constraints (top) and coordinates (bottom) for the planar translation joint.

The PlanarTranslationJoint (Figure 3.22) is a 2 DOF joint that is the same as the planar joint without rotation: C is restricted to translation in the x-y plane of D. It implements six constraints and two coordinates x and y (Table 3.9), to which the joint transform {\bf T}_{CD} is related by

{\bf T}_{CD}=\left(\begin{matrix}1&0&0&x\\
0&1&0&y\\
0&0&1&0\\
0&0&0&1\end{matrix}\right).

The value and ranges for x and y are exported by the properties x, y, xRange and yRange, and the coordinate indices are defined by the constants X_IDX and Y_IDX. A planar translation joint can be rendered as a square centered on the origin of D, using face rendering properties and with a size given by the planeSize property, in the same way as described for PlanarJoint. A demo is provided by artisynth.demos.mech.PlanarJointDemo.

In addition to the standard constructors described in Section 3.3.3,

  PlanarTranslationJoint (bodyA, bodyB, originD, zaxis)

creates a planar translation joint with a specified origin and z axis direction for frame D (in world coordinates), and frames C and D coincident.

3.4.11 Ellipsoid joint

The EllipsoidJoint is a 4 DOF joint that provides similar functionality to the ellipsoidal and scapulothoracic joints available in OpenSim. It allows the origin of C to slide around on the surface of an ellipsoid centered on the origin of D, together with two additional rotational degrees of freedom.

Figure 3.23: Ellipsoidal joint. Left: frame relationships between D and S (blue). Middle: frame relationships between S and C (blue). Right: the demo model EllipsoidJointDemo, with \psi, \gamma, \theta and \phi set to 45^{\circ}, 30^{\circ}, -40^{\circ}, and 20^{\circ}.

The joint kinematics is easiest to describe in terms of an intermediate frame S whose origin lies on the ellipsoid surface, with its position controlled by two coordinates: a longitude angle \psi, and a latitude angle \gamma (Figure 3.23, left). Frame C has the same origin as S, with two additional coordinates, \theta and \phi which allow it to rotate about S (Figure 3.23, middle). If the transform {\bf T}_{SD} from S to D and the (rotational-only) transform {\bf T}_{CS} from C to S are given by

{\bf T}_{SD}=\left(\begin{matrix}{\bf R}_{SD}&{\bf p}_{SD}\\
0&1\end{matrix}\right)\quad\text{and}\quad{\bf T}_{CS}=\left(\begin{matrix}{%
\bf R}_{CS}&0\\
0&1\end{matrix}\right),

then {\bf T}_{CD} is given by

{\bf T}_{CD}={\bf T}_{SD}{\bf T}_{CS}=\left(\begin{matrix}{\bf R}_{SD}{\bf R}_%
{CS}&{\bf p}_{SD}\\
0&1\end{matrix}\right).

The six constraints and four coordinates of the ellipsoidal joint are described in table 3.10.

Index type/name description
0 bilateral restricts C to the ellipsoid surface and limits rotation
1 bilateral restricts C to the ellipsoid surface and limits rotation
2 unilateral enforces limits on the \psi coordinate
3 unilateral enforces limits on the \gamma coordinate
4 unilataral enforces limits on the \theta coordinate
5 unilataral enforces limits on the \phi coordinate
0 \psi longitude angle for origin of S (and C) on the ellipsoid
1 \gamma latitude angle for origin of S (and C) on the ellipsoid
2 \theta first rotation of C about the z axis of S
3 \phi second rotation of C about rotated x (or x^{\prime} if \alpha\neq 0)
Table 3.10: Constraints (top) and coordinates (bottom) for the ellipsoidal joint.

For frame S, if A, B and C are the ellipsoid semi-axis lengths for the x, y, and z axes, and c_{\psi}, s_{\psi}, c_{\gamma}, and s_{\gamma} are the cosines and sines of \psi and \gamma, we can show that

{\bf p}_{SD}=\left(\begin{matrix}A\,s_{\gamma}\\
-B\,s_{\psi}c_{\gamma}\\
C\,c_{\psi}c_{\gamma}\end{matrix}\right).

For the orientation of S, the z axis of S is parallel to the surface normal and the x axis is parallel to the tangent direction imparted by the latitudinal velocity \dot{\gamma}. That means x and z axes are parallel to the direction vectors {\bf d}_{x} and {\bf d}_{z} given by

{\bf d}_{x}=\left(\begin{matrix}A\,c_{\gamma}\\
B\,s_{\psi}s_{\gamma}\\
-C\,c_{\psi}s_{\gamma}\end{matrix}\right)\quad\text{and}\quad{\bf d}_{z}=\left%
(\begin{matrix}p_{x}/A^{2}\\
p_{y}/B^{2}\\
p_{z}/C^{2}\end{matrix}\right). (3.28)

The columns of {\bf R}_{SD} are then given by the normalized values of {\bf d}_{x}, {\bf d}_{z}\times{\bf d}_{x}, and {\bf d}_{z}, respectively.

The rotation {\bf R}_{CS} is formed by a rotation \theta about the z axis, followed by a rotation of \phi about the new x axis. Letting c_{\theta}, s_{\theta}, c_{\phi}, and s_{\phi} be the cosines and sines of \theta and \phi, we then have

{\bf R}_{CS}=\left(\begin{matrix}c_{\theta}&-s_{\theta}c_{\phi}&s_{\theta}s_{%
\phi}\\
s_{\theta}&c_{\theta}c_{\phi}&-c_{\theta}s_{\phi}\\
0&s_{\phi}&c_{\phi}\end{matrix}\right).

If desired, the \phi rotation can instead be performed about a modified axis x^{\prime} that makes an angle \alpha with respect to x in the x-y plane. \alpha is controlled by the joint’s alpha property (default value 0) and corresponds to the “winging” angle of the OpenSim scapulothoracic joint. If \alpha\neq 0, {\bf R}_{CS} takes the more complex form

{\bf R}_{CS}=\left(\begin{matrix}c_{0}c_{\alpha}+s_{0}c_{\phi}s_{\alpha}&c_{0}%
s_{\alpha}-s_{0}c_{\phi}c_{\alpha}&s_{0}s_{\phi}\\
s_{0}c_{\alpha}-c_{0}c_{\phi}s_{\alpha}&s_{0}s_{\alpha}+c_{0}c_{\phi}c_{\alpha%
}&-c_{0}s_{\phi}\\
-s_{\phi}s_{\alpha}&s_{\phi}c_{\alpha}&c_{\phi}\end{matrix}\right)

where c_{0}, s_{0}, c_{\alpha}, and s_{\alpha} are the cosines and sines of \theta+\alpha and \alpha, respectively.

Within an EllipsoidJoint, the values and ranges for \psi, \gamma, \theta and \phi are exported by the properties longitude, latitude, theta, phi, longitudeRange, latitudeRange, thetaRange, and phiRange, and the coordinate indices are defined by the constants LONGITUDE_IDX, LATITUDE_IDX, THETA_IDX, and PHI_IDX. For rendering, the property drawEllipsoid specifies whether the ellipsoid surface should be drawn; if true, it will be drawn using the joint’s face rendering properties. A demo is provided by artisynth.demos.mech.EllipsoidJointDemo.

Ellipsoid joints can be created with the following constructors:

  EllipsoidJoint (A, B, C, alpha, openSimCompatible)
  EllipsoidJoint (rbodyA, TCA, rbodyB, TDB, A, B, C, alpha, openSimCompatible)
  EllipsoidJoint (cbodyA, cbodyB, TCW, TDW, A, B, C)

The first of these creates a joint that is not attached to any bodies; attachment can be done later using one of the setBodies() methods. Its semi-axis lengths are given by A, B, and C, its \alpha angle is given by alpha, and the argument openSimCompatible, if true, makes the joint kinematics compatible with OpenSim (Section 3.4.11.1). The second constructor creates a joint and then attaches it to rigid bodies rbodyA and rbodyB, with the specified {\bf T}_{CA} and {\bf T}_{DB} transformations. The third constructor creates a joint and attaches it to connectable bodies cbodyA and cbodyB, with the locations of the C and D frames specified in world coordinates by TCW and TDW.

Unlike in many joints, {\bf T}_{CD} is not the identity when the joint coordinates are all 0. That is because the origin of C must lie on the ellipsoid surface, and since D is at the center of the ellipsoid, {\bf T}_{CD} can never be the identity. In particular, when all coordinate values are 0, {\bf R}_{CD}={\bf I} but {\bf p}_{CD}={\bf p}_{SD}=(0,0,C)^{T}.

3.4.11.1 OpenSim compatibility

The openSimCompatible argument in some of the joint’s constructors makes the kinematics compatible with the ellipsoidal joint used by OpenSim. This means that {\bf R}_{SD} is computed differently: in OpenSim, instead of using (3.28), the z and x axis directions of {\bf R}_{SD} are computed using

{\bf d}_{x}=\left(\begin{matrix}c_{\gamma}\\
s_{\psi}s_{\gamma}\\
-c_{\psi}s_{\gamma}\end{matrix}\right)\quad\text{and}\quad{\bf d}_{z}=\left(%
\begin{matrix}p_{x}/A\\
p_{y}/B\\
p_{z}/C\end{matrix}\right). (3.29)

In particular, this means that the z axis is only approximately parallel to the ellipsoid surface normal.

In OpenSim, the axes of the C frame of both the ellipsoid and scapulothoracic joints are oriented differently that those of the ArtiSynth joint: they are rotated by -\pi/2 about z, so that the x and y axes correspond to the -y and x axes of the ArtiSynth joint.

3.4.12 Solid joint

The SolidJoint is a 0 DOF joint that rigidly constrains C to D. It implements six constraints and no coordinates (Table 3.11) and the resulting {\bf T}_{CD} is the identity.

There aren’t normally many uses for solid joints. If one wishes to create a complex rigid body by joining together a variety of shapes, this can be done more efficiently by making these shapes mesh components of a single rigid body (Section 3.2.9).

Index type/name description
0 bilateral restricts translation along x
1 bilateral restricts translation along y
2 bilateral restricts translation along z
3 bilateral restricts rotation about x
4 bilateral restricts rotation about y
5 bilateral restricts rotation about z
Table 3.11: Constraints for the solid joint.

3.4.13 Planar Connector

Figure 3.24: Demo model for the planar connector, in which a corner point of a box is constrained to the x-y plane of D.
Index type/name description
0 bilateral or unilateral restricts translation along z
Table 3.12: Constraints for the planar connector.

The PlanarConnector (Figure 3.24) is a 5 DOF connector that attaches the origin of C to the x-y plane of D. C is completely free to rotate, and to translate within the x-y plane. Only motion in the z direction is restricted. PlanarConnector implements one constraint and has no coordinates (Table 3.12).

A PlanarConnector constrains a point on body A (located at the origin of C) to move within a plane on body B. Several planar connectors can be employed to constrain body motions in more complicated ways, although one must be careful to avoid overconstraining the system. The connector can also be configured to function unilaterally, via its unilateral property, in which case the point is constrained to lie in the half-space defined by z\geq 0 with respect to D. Several unilateral PlanarConnectors can therefore be used to implement a cheap and approximate collision mechanism with fixed collision points.

When set to function unilaterally, overconstraining the system is not an issue because of the way in which ArtiSynth solves unilateral constraints.

A planar connector can be rendered as a square centered on the origin of D, using face rendering properties and with a size given by the planeSize property. The point attached to A can also be rendered using point rendering properties. For example,

  PlanarConnector connector;
  ...
  connector.setPlaneSize (5.0);
  RenderProps.setFaceColor (connector, Color.LIGHT_GRAY);
  RenderProps.setSphericalPoints (connector, 0.1, Color.BLUE);

will cause connector to be drawn as a light gray square with size 5, and for the point on body A to be drawn as a blue sphere with radius 0.1. The default value of planeSize is 0, so drawing the plane is disabled by default. Also, the default faceStyle rendering property for PlanarConnector is set to FRONT_AND_BACK, so that the plane (when drawn) can be seen from both sides.

Constructors for the PlanarConnector include

  PlanarConnector (bodyA, pCA, bodyB, TDB)
  PlanarConnector (bodyA, pCA, TDW)
  PlanarConnector (bodyA, bodyA, TDW)

where pCA gives the connection point of body A with respect to frame A, TDB gives the transform from frame D to frame B, and TDW gives the transform from frame D to world.

3.4.14 Segmented Planar Connector

Figure 3.25: Left: cross-section in the x-z plane of frame D showing the segments of a segmented planar connector, with the points defining the segments shown as black dots. Right: demo model for the segmented planar connector.
Index type/name description
0 bilateral or unilateral restricts translation normal to the surface
Table 3.13: Constraints for the segmented planar connector.

The SegmentedPlanarConnector (Figure 3.25) is a 5 DOF connector that generalizes PlanarConnector to a piecewise linear surface, to which the origin of C is constrained while C is otherwise completely free to rotate. The surface is specified by a sequence of 2D points defining a piecewise linear curve in the x-z plane of D (Figure 3.25, left). This curve does not need to be a function; the segment nearest to C is the one used to enforce the constraint at any given time. The surface has infinite extent and is extrapolated beyond the first and last segments. It implements one constraint and has no coordinates (Table 3.13).

By appropriate choice of segments, a SegmentedPlanarConnector can approximate any surface defined by a curve in the x-z plane. As with PlanarConnector, it can also be configured as unilateral, constraining the origin of C to lie on the side of the surface defined by the normal vectors {\bf n}_{k} of each segment k. If {\bf p}_{k-1} and {\bf p}_{k} are the points in the x-z plane defining the k-th segment, and \hat{\bf y} is the y axis unit vector, then {\bf n}_{k} is given by

{\bf n}_{k}=\frac{{\bf u}\times\hat{\bf y}}{\|{\bf u}\times\hat{\bf y}\|},%
\quad{\bf u}\equiv{\bf p}_{k}-{\bf p}_{k-1}. (3.30)

The properties controlling the rendering of a segmented planar connector are the same as for a planar connector, with each of the individual plane segments drawn as a rectangle whose length along the y axis is controlled by planeSize.

Constructors for a SegmentedPlanarConnector are analogous to those used for PlanarConnector,

  SegmentedPlanarConnector (bodyA, pCA, bodyB, TDB, segs)
  SegmentedPlanarConnector (bodyA, pCA, TDW, segs)
  SegmentedPlanarConnector (bodyA, bodyA, TDW, segs)

where segs is an additional argument of type double[] giving the 2D coordinates defining the segments in the x-z plane.

3.4.15 Legacy Joints

ArtiSynth maintains three legacy joint for compatibility with earlier software:

  • RevoluteJoint is identical to the HingeJoint, except that its coordinate \theta is oriented clockwise about the z axis instead of counter-clockwise. Rendering is also done differently, with shafts about the rotation axis drawn using line rendering properties.

  • RollPitchJoint is identical to the UniversalJoint, except that its roll-pitch coordinates \theta,\phi are computed with respect to the rotation {\bf R}_{DC} from frame D to C, instead of the rotation {\bf R}_{CD} from frame C to D. Rendering is also done differently, with shafts along the roll and pitch axes drawn using line rendering properties, and the ball around the origin of D drawn using point rendering properties.

  • SphericalRpyJoint is identical to the GimbalJoint, except that its roll-pitch-yaw coordinates \theta,\phi,\psi are computed with respect to the rotation {\bf R}_{DC} from frame D to C, instead of the rotation {\bf R}_{CD} from frame C to D. Rendering is also done differently, with the ball around the origin of D drawn using point rendering properties.