# Joints

## The Joint type

RigidBodyDynamics.JointType
struct Joint{T, JT<:JointType{T}}

A joint represents a kinematic restriction of the relative twist between two rigid bodies to a linear subspace of dimension $k$.

A joint has a direction. The rigid body before the joint is called the joint's predecessor, and the rigid body after the joint is its successor.

The state related to the joint is parameterized by two sets of variables, namely

• a vector $q \in \mathcal{Q}$, parameterizing the relative homogeneous transform.
• a vector $v \in \mathbb{R}^k$, parameterizing the relative twist.

The twist of the successor with respect to the predecessor is a linear function of $v$.

For some joint types (notably those using a redundant representation of relative orientation, such as a unit quaternion), $\dot{q}$, the time derivative of $q$, may not be the same as $v$. However, an invertible linear transformation exists between $\dot{q}$ and $v$.

• Definition 2.9 in Duindam, "Port-Based Modeling and Control for Efficient Bipedal Walking Robots", 2006.
• Section 4.4 of Featherstone, "Rigid Body Dynamics Algorithms", 2008.
source

## Functions

RigidBodyDynamics.bias_accelerationMethod
bias_acceleration(joint, q, v)


Return the acceleration of the joint's successor with respect to its predecessor in configuration $q$ and at velocity $v$, when the joint acceleration $\dot{v}$ is zero.

source
RigidBodyDynamics.configuration_derivative_to_velocity_adjoint!Method
configuration_derivative_to_velocity_adjoint!(fq, joint, q, fv)


Given a linear function

$$$f(v) = \langle f_v, v \rangle$$$

where $v$ is the joint velocity vector, return a vector $f_q$ such that

$$$\langle f_v, v \rangle = \langle f_q, \dot{q}(v) \rangle.$$$

Note: since $v$ is a linear function of $\dot{q}$ (see configuration_derivative_to_velocity!), we can write $v = J_{\dot{q} \rightarrow v} \dot{q}$, so

$$$\langle f_v, v \rangle = \langle f_v, J_{\dot{q} \rightarrow v} \dot{q} \rangle = \langle J_{\dot{q} \rightarrow v}^{*} f_v, \dot{q} \rangle$$$

so $f_q = J_{\dot{q} \rightarrow v}^{*} f_v$.

To compute $J_{\dot{q} \rightarrow v}$ see configuration_derivative_to_velocity_jacobian.

source
RigidBodyDynamics.constraint_wrench_subspaceMethod
constraint_wrench_subspace(joint, joint_transform)


Return a basis for the constraint wrench subspace of the joint, where joint_transform is the transform from the frame after the joint to the frame before the joint.

The constraint wrench subspace is a $6 \times (6 - k)$ matrix, where $k$ is the dimension of the velocity vector $v$, that maps a vector of Lagrange multipliers $\lambda$ to the constraint wrench exerted across the joint onto its successor.

The constraint wrench subspace is orthogonal to the motion subspace.

source
RigidBodyDynamics.isfloatingMethod
isfloating(joint)


Whether the joint is a floating joint, i.e., whether it imposes no constraints on the relative motions of its successor and predecessor bodies.

source
RigidBodyDynamics.joint_torque!Method
joint_torque!(τ, joint, q, joint_wrench)


Given the wrench exerted across the joint on the joint's successor, compute the vector of joint torques $\tau$ (in place), in configuration q.

source
RigidBodyDynamics.joint_transformMethod
joint_transform(joint, q)


Return a Transform3D representing the homogeneous transform from the frame after the joint to the frame before the joint for joint configuration vector $q$.

source
RigidBodyDynamics.joint_twistMethod
joint_twist(joint, q, v)


Return the twist of joint's successor with respect to its predecessor, expressed in the frame after the joint.

Note that this is the same as Twist(motion_subspace(joint, q), v).

source
RigidBodyDynamics.local_coordinates!Method
local_coordinates!(ϕ, ϕ̇, joint, q0, q, v)


Compute a vector of local coordinates $\phi$ around configuration $q_0$ corresponding to configuration $q$ (in place). Also compute the time derivative $\dot{\phi}$ of $\phi$ given the joint velocity vector $v$.

The local coordinate vector $\phi$ must be zero if and only if $q = q_0$.

For revolute or prismatic joint types, the local coordinates can just be $\phi = q - q_0$, but for joint types with configuration vectors that are restricted to a manifold (e.g. when unit quaternions are used to represent orientation), elementwise subtraction may not make sense. For such joints, exponential coordinates could be used as the local coordinate vector $\phi$.

See also global_coordinates!.

source
RigidBodyDynamics.motion_subspaceMethod
motion_subspace(joint, q)


Return a basis for the motion subspace of the joint in configuration $q$.

The motion subspace basis is a $6 \times k$ matrix, where $k$ is the dimension of the velocity vector $v$, that maps $v$ to the twist of the joint's successor with respect to its predecessor. The returned motion subspace is expressed in the frame after the joint, which is attached to the joint's successor.

source
RigidBodyDynamics.principal_value!Method
principal_value!(q, joint)


Applies the principalvalue functions from [Rotations.jl](https://github.com/FugroRoames/Rotations.jl/blob/d080990517f89b56c37962ad53a7fd24bd94b9f7/src/principalvalue.jl) to joint angles. This currently only applies to SPQuatFloating joints.

source

## JointTypes

### Fixed

RigidBodyDynamics.FixedType
struct Fixed{T} <: JointType{T}

The Fixed joint type is a degenerate joint type, in the sense that it allows no motion between its predecessor and successor rigid bodies.

source

### Revolute

RigidBodyDynamics.RevoluteType
struct Revolute{T} <: JointType{T}

A Revolute joint type allows rotation about a fixed axis.

The configuration vector for the Revolute joint type simply consists of the angle of rotation about the specified axis. The velocity vector consists of the angular rate, and is thus the time derivative of the configuration vector.

source

### Planar

RigidBodyDynamics.PlanarType
struct Planar{T} <: JointType{T}

The Planar joint type allows translation along two orthogonal vectors, referred to as $x$ and $y$, as well as rotation about an axis $z = x \times y$.

The components of the 3-dimensional configuration vector $q$ associated with a Planar joint are the $x$- and $y$-coordinates of the translation, and the angle of rotation $\theta$ about $z$, in that order.

The components of the 3-dimension velocity vector $v$ associated with a Planar joint are the $x$- and $y$-coordinates of the linear part of the joint twist, expressed in the frame after the joint, followed by the $z$-component of the angular part of this joint twist.

Warning

For the Planar joint type, $v \neq \dot{q}$! Although the angular parts of $v$ and $\dot{q}$ are the same, their linear parts differ. The linear part of $v$ is the linear part of $\dot{q}$, rotated to the frame after the joint. This parameterization was chosen to allow the translational component of the joint transform to be independent of the rotation angle $\theta$ (i.e., the rotation is applied after the translation), while still retaining a constant motion subspace expressed in the frame after the joint.

source
RigidBodyDynamics.PlanarMethod
Planar(x_axis, y_axis)


Construct a new Planar joint type with the $xy$-plane in which translation is allowed defined by 3-vectors x and y expressed in the frame before the joint.

source

### QuaternionSpherical

RigidBodyDynamics.QuaternionSphericalType
struct QuaternionSpherical{T} <: JointType{T}

The QuaternionSpherical joint type allows rotation in any direction. It is an implementation of a ball-and-socket joint.

The 4-dimensional configuration vector $q$ associated with a QuaternionSpherical joint is the unit quaternion that describes the orientation of the frame after the joint with respect to the frame before the joint. In other words, it is the quaternion that can be used to rotate vectors from the frame after the joint to the frame before the joint.

The 3-dimensional velocity vector $v$ associated with a QuaternionSpherical joint is the angular velocity of the frame after the joint with respect to the frame before the joint, expressed in the frame after the joint (body frame).

source

### QuaternionFloating

RigidBodyDynamics.QuaternionFloatingType
struct QuaternionFloating{T} <: JointType{T}

A floating joint type that uses a unit quaternion representation for orientation.

Floating joints are 6-degree-of-freedom joints that are in a sense degenerate, as they impose no constraints on the relative motion between two bodies.

The full, 7-dimensional configuration vector of a QuaternionFloating joint type consists of a unit quaternion representing the orientation that rotates vectors from the frame 'directly after' the joint to the frame 'directly before' it, and a 3D position vector representing the origin of the frame after the joint in the frame before the joint.

The 6-dimensional velocity vector of a QuaternionFloating joint is the twist of the frame after the joint with respect to the frame before it, expressed in the frame after the joint.

source

### SPQuatFloating

RigidBodyDynamics.SPQuatFloatingType
struct SPQuatFloating{T} <: JointType{T}

A floating joint type that uses a modified Rodrigues parameter (Rotations.MRP, previously known as Rotations.SPQuat) representation for orientation.

Floating joints are 6-degree-of-freedom joints that are in a sense degenerate, as they impose no constraints on the relative motion between two bodies.

The 6-dimensional configuration vector of a SPQuatFloating joint type consists of a SPQuat representing the orientation that rotates vectors from the frame 'directly after' the joint to the frame 'directly before' it, and a 3D position vector representing the origin of the frame after the joint in the frame before the joint.

The 6-dimensional velocity vector of a SPQuatFloating joint is the twist of the frame after the joint with respect to the frame before it, expressed in the frame after the joint.

source

### SinCosRevolute

RigidBodyDynamics.SinCosRevoluteType
struct SinCosRevolute{T} <: JointType{T}

A SinCosRevolute joint type allows rotation about a fixed axis.

In contrast to the Revolute joint type, the configuration vector for the SinCosRevolute joint type consists of the sine and cosine of the angle of rotation about the specified axis (in that order). The velocity vector for the SinCosRevolute joint type is the same as for the Revolute joint type, i.e., the time derivative of the angle about the axis.

source