Joints

# Joints

## The Joint type

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

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
configuration_derivative_to_velocity!(v, joint, q, q̇)


Compute joint velocity vector $v$ given the joint configuration vector $q$ and its time derivative $\dot{q}$ (in place).

Note that this mapping is linear.

See also velocity_to_configuration_derivative!, the inverse mapping.

source
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
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
effort_bounds(joint)


Return a Vector{Bounds{T}} giving the upper and lower bounds of the effort for joint

source
global_coordinates!(q, joint, q0, ϕ)


Compute the global parameterization of the joint's configuration, $q$, given a 'base' orientation $q_0$ and a vector of local coordinates $ϕ$ centered around $q_0$.

See also local_coordinates!.

source
has_fixed_subspaces(joint)


Whether the joint's motion subspace and constraint wrench subspace depend on $q$.

source
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
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
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
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
normalize_configuration!(q, joint)


Renormalize the configuration vector $q$ associated with joint so that it lies on the joint's configuration manifold.

source
num_constraints(joint)


Return the number of constraints imposed on the relative twist between the joint's predecessor and successor

source
num_positions(joint)


Return the length of the configuration vector of joint.

source
num_velocities(joint)


Return the length of the velocity vector of joint.

source
position_bounds(joint)


Return a Vector{Bounds{T}} giving the upper and lower bounds of the configuration for joint

source
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
rand_configuration!(q, joint)


Set $q$ to a random configuration. The distribution used depends on the joint type.

source
velocity_bounds(joint)


Return a Vector{Bounds{T}} giving the upper and lower bounds of the velocity for joint

source
velocity_to_configuration_derivative!(q̇, joint, q, v)


Compute the time derivative $\dot{q}$ of the joint configuration vector $q$ given $q$ and the joint velocity vector $v$ (in place).

Note that this mapping is linear.

See also configuration_derivative_to_velocity!, the inverse mapping.

source
zero_configuration!(q, joint)


Set $q$ to the 'zero' configuration, corresponding to an identity joint transform.

source
configuration_derivative_to_velocity_jacobian(joint, q)


Compute the jacobian $J_{\dot{q} \rightarrow v}$ which maps joint configuration derivative to velocity for the given joint:

$v = J_{\dot{q} \rightarrow v} \dot{q}$
source
joint_spatial_acceleration(joint, q, v, vd)


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

source
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
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
velocity_to_configuration_derivative_jacobian(joint, q)


Compute the jacobian $J_{v \rightarrow \dot{q}}$ which maps joint velocity to configuration derivative for the given joint:

$\dot{q} = J_{v \rightarrow \dot{q}} v$
source

## JointTypes

abstract type JointType

The abstract supertype of all concrete joint types.

source

### Fixed

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

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
Revolute(axis)


Construct a new Revolute joint type, allowing rotation about axis (expressed in the frame before the joint).

source

### Prismatic

struct Prismatic{T} <: JointType{T}

A Prismatic joint type allows translation along a fixed axis.

source

Construct a new Prismatic joint type, allowing translation along axis (expressed in the frame before the joint).

source

### Planar

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
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

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

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

struct SPQuatFloating{T} <: JointType{T}

A floating joint type that uses a 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

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

Construct a new SinCosRevolute joint type, allowing rotation about axis (expressed in the frame before the joint).

source