Drake
Drake C++ Documentation
ConstraintVelProblemData< T > Struct Template Reference

Detailed Description

template<class T>
struct drake::examples::rod2d::ConstraintVelProblemData< T >

Structure for holding constraint data for computing constraint forces at the velocity-level (i.e., impact problems).

#include <drake/examples/rod2d/constraint_problem_data.h>

Public Member Functions

 ConstraintVelProblemData (int gv_dim)
 Constructs velocity problem data for a system with a gv_dim dimensional generalized velocity. More...
 
void Reinitialize (int gv_dim)
 Reinitializes the constraint problem data using the specified dimension of the generalized velocities. More...
 

Public Attributes

std::vector< intr
 The number of spanning vectors in the contact tangents (used to linearize the friction cone) at the nc contact points. More...
 
VectorX< T > mu
 Coefficients of friction for the nc contacts. More...
 
VectorX< T > Mv
 The ℝⁿᵛ generalized momentum immediately before any impulsive forces (from impact) are applied. More...
 
std::function< MatrixX< T >const MatrixX< T > &)> solve_inertia
 A function for solving the equation MX = B for matrix X, given input matrix B, where M is the generalized inertia matrix for the rigid body system. More...
 
Data for bilateral constraints at the velocity level

Problem data for bilateral constraints of functions of system velocity, where the constraint can be formulated as:

0 = G(q)⋅v + kᴳ(t,q)

which implies the constraint definition g(t,q,v) ≡ G(q)⋅v + kᴳ(t,q). G is defined as the ℝⁿᵇˣⁿᵛ Jacobian matrix that transforms generalized velocities (v ∈ ℝⁿᵛ) into the time derivatives of nb bilateral constraint functions. The class of constraint functions naturally includes holonomic constraints, which are constraints posable as g(t,q). Such holonomic constraints must be differentiated with respect to time to yield a velocity-level formulation (i.e., ġ(t, q, v), for the aforementioned definition of g(t,q)). That differentiation yields ġ = G⋅v, which is consistent with the constraint class under the definition kᴳ(t,q) ≡ 0. An example such holonomic constraint function is the transmission (gearing) constraint below:

0 = vᵢ - rvⱼ

which can be read as the velocity at joint i (vᵢ) must equal to r times the velocity at joint j (vⱼ); r is thus the gear ratio. In this example, the corresponding holonomic constraint function is g(q) ≡ qᵢ - rqⱼ, yielding ġ(q, v) = vᵢ - rvⱼ.

std::function< VectorX< T >const VectorX< T > &)> G_mult
 An operator that performs the multiplication G⋅v. More...
 
std::function< VectorX< T >const VectorX< T > &)> G_transpose_mult
 An operator that performs the multiplication Gᵀ⋅f where f ∈ ℝⁿᵇ are the magnitudes of the constraint forces. More...
 
VectorX< T > kG
 This ℝⁿᵇ vector is the vector kᴳ(t,q) defined above. More...
 
Data for constraints on velocities along the contact normal

Problem data for constraining the velocity of two bodies projected along the contact surface normal, for n point contacts.

These data center around the Jacobian matrix N, the ℝⁿᶜˣⁿᵛ Jacobian matrix that transforms generalized velocities (v ∈ ℝⁿᵛ) into velocities projected along the contact normals at the n point contacts. Constraint error (φ < 0, where φ is the signed distance between two bodies) can be incorporated into the constraint solution process (and thereby reduced) through setting the kN term to something other than its nonzero value (typically kN = αφ, where α ≥ 0). The resulting constraint on the motion will be:

0 ≤ N(q) v + kᴺ(t,q)  ⊥  fᶜ ≥ 0

which means that the constraint ċ(q,v) ≡ N(q)⋅v + kᴺ(t,q) is coupled to an impulsive force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(Nv + kᴺ(t,q)) = 0, meaning that the constraint can apply no force if it is inactive (i.e., if ġ(q,v) is strictly greater than zero).

std::function< VectorX< T >const VectorX< T > &)> N_mult
 An operator that performs the multiplication N⋅v. More...
 
std::function< VectorX< T >const VectorX< T > &)> N_transpose_mult
 An operator that performs the multiplication Nᵀ⋅f, where f ∈ ℝⁿᶜ are the the magnitudes of the impulsive forces applied along the contact normals at the nc point contacts. More...
 
VectorX< T > kN
 This ℝⁿᶜ vector is the vector kᴺ(t,q,v) defined above. More...
 
VectorX< T > gammaN
 This ℝⁿᶜ vector represents the diagonal matrix γᴺ. More...
 
Data for constraints on contact friction

Problem data for constraining the tangential velocity of two bodies projected along the contact surface tangents, for n point contacts.

These data center around the Jacobian matrix, F ∈ ℝⁿⁿʳˣⁿᵛ, that transforms generalized velocities (v ∈ ℝⁿᵛ) into velocities projected along the nr vectors that span the contact tangents at the nc point contacts (these nc * nr vectors are denoted nnr for brevity). For contact problems in two dimensions, nr will be one and nnr would equal nc. For a friction pyramid at each point contact in three dimensions, nr would be two and nnr would equation 2nc. While the definition of the dimension of the Jacobian matrix above indicates that every one of the nc contacts uses the same "nr", the code imposes no such requirement. Constraint error (F⋅v < 0) can be reduced through the constraint solution process by setting the kF term to something other than its default zero value. The resulting constraint on the motion will be:

0 ≤ F(q)⋅v + kᴺ(t,q) + eλ  ⊥  fᶜ ≥ 0

which means that the constraint ġ(q,v) ≡ F(q)⋅v + kᶠ(t,q) + eλ is coupled to an impulsive force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(Fv + kᶠ(t,q) + eλ) = 0, meaning that the constraint can apply no force if it is inactive (i.e., if ġ(q,v) is strictly greater than zero). The presence of the λe term is taken directly from [Anitescu 1997], where e is a vector of ones and zeros and λ corresponds roughly to the tangential acceleration at the contacts. The interested reader should refer to [Anitescu 1997] for a more thorough explanation of this constraint; the full constraint equation is presented only to elucidate the purpose of the kᶠ term.

std::function< VectorX< T >const VectorX< T > &)> F_mult
 An operator that performs the multiplication F⋅v. More...
 
std::function< VectorX< T >const VectorX< T > &)> F_transpose_mult
 An operator that performs the multiplication Fᵀ⋅f, where f ∈ ℝⁿᶜʳ corresponds to frictional impulsive force magnitudes. More...
 
VectorX< T > kF
 This ℝⁿᶜʳ vector is the vector kᶠ(t,q,v) defined above. More...
 
VectorX< T > gammaF
 This ℝⁿᶜʳ vector represents the diagonal matrix γᶠ. More...
 
VectorX< T > gammaE
 This ℝⁿᶜ vector represents the diagonal matrix γᴱ. More...
 
Data for unilateral constraints at the velocity level

Problem data for unilateral constraints of functions of system velocity, where the constraint can be formulated as:

0 ≤ L(q)⋅v + kᴸ(t,q)  ⊥  fᶜ ≥ 0

which means that the constraint ċ(q,v) ≡ L(q)⋅v + kᴸ(t,q) is coupled to an impulsive force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(L⋅v + kᴸ(t,q)) = 0, meaning that the constraint can apply no force if it is inactive (i.e., if ġ(q,v) is strictly greater than zero). L is defined as the ℝⁿᵘˣⁿᵛ Jacobian matrix that transforms generalized velocities (v ∈ ℝⁿᵛ) into the time derivatives of nu unilateral constraint functions. The class of constraint functions naturally includes holonomic constraints, which are constraints posable as g(q, t). Such holonomic constraints must be differentiated with respect to time to yield a velocity-level formulation (i.e., ġ(q, v, t), for the aforementioned definition of g(q, t)). That differentiation yields ġ = L⋅v, which is consistent with the constraint class under the definition kᴸ(t,q) ≡ 0. An example such holonomic constraint function is a joint velocity limit:

0 ≤ -vⱼ + r  ⊥  fᶜⱼ ≥ 0

which can be read as the velocity at joint j (vⱼ) must be no larger than r, the impulsive force must be applied to limit the acceleration at the joint, and the limiting force cannot be applied if the velocity at the joint is not at the limit (i.e., vⱼ < r). In this example, the constraint function is g(t,q) ≡ qⱼ + rt, yielding ġ(q, v) = -vⱼ + r.

std::function< VectorX< T >const VectorX< T > &)> L_mult
 An operator that performs the multiplication L⋅v. More...
 
std::function< VectorX< T >const VectorX< T > &)> L_transpose_mult
 An operator that performs the multiplication Lᵀ⋅f where f ∈ ℝᵗ are the magnitudes of the impulsive constraint forces. More...
 
VectorX< T > kL
 This ℝⁿᵘ vector is the vector kᴸ(t,q) defined above. More...
 
VectorX< T > gammaL
 This ℝⁿᵘ vector represents the diagonal matrix γᴸ. More...
 

Constructor & Destructor Documentation

◆ ConstraintVelProblemData()

ConstraintVelProblemData ( int  gv_dim)
explicit

Constructs velocity problem data for a system with a gv_dim dimensional generalized velocity.

Member Function Documentation

◆ Reinitialize()

void Reinitialize ( int  gv_dim)

Reinitializes the constraint problem data using the specified dimension of the generalized velocities.

Member Data Documentation

◆ F_mult

std::function<VectorX<T>const VectorX<T>&)> F_mult

An operator that performs the multiplication F⋅v.

The default operator returns an empty vector.

◆ F_transpose_mult

std::function<VectorX<T>const VectorX<T>&)> F_transpose_mult

An operator that performs the multiplication Fᵀ⋅f, where f ∈ ℝⁿᶜʳ corresponds to frictional impulsive force magnitudes.

The default operator returns a zero vector of dimension equal to that of the generalized forces.

◆ G_mult

std::function<VectorX<T>const VectorX<T>&)> G_mult

An operator that performs the multiplication G⋅v.

The default operator returns an empty vector.

◆ G_transpose_mult

std::function<VectorX<T>const VectorX<T>&)> G_transpose_mult

An operator that performs the multiplication Gᵀ⋅f where f ∈ ℝⁿᵇ are the magnitudes of the constraint forces.

The default operator returns a zero vector of dimension equal to that of the generalized forces.

◆ gammaE

VectorX<T> gammaE

This ℝⁿᶜ vector represents the diagonal matrix γᴱ.

◆ gammaF

VectorX<T> gammaF

This ℝⁿᶜʳ vector represents the diagonal matrix γᶠ.

◆ gammaL

VectorX<T> gammaL

This ℝⁿᵘ vector represents the diagonal matrix γᴸ.

◆ gammaN

VectorX<T> gammaN

This ℝⁿᶜ vector represents the diagonal matrix γᴺ.

◆ kF

VectorX<T> kF

This ℝⁿᶜʳ vector is the vector kᶠ(t,q,v) defined above.

◆ kG

VectorX<T> kG

This ℝⁿᵇ vector is the vector kᴳ(t,q) defined above.

◆ kL

VectorX<T> kL

This ℝⁿᵘ vector is the vector kᴸ(t,q) defined above.

◆ kN

VectorX<T> kN

This ℝⁿᶜ vector is the vector kᴺ(t,q,v) defined above.

◆ L_mult

std::function<VectorX<T>const VectorX<T>&)> L_mult

An operator that performs the multiplication L⋅v.

The default operator returns an empty vector.

◆ L_transpose_mult

std::function<VectorX<T>const VectorX<T>&)> L_transpose_mult

An operator that performs the multiplication Lᵀ⋅f where f ∈ ℝᵗ are the magnitudes of the impulsive constraint forces.

The default operator returns a zero vector of dimension equal to that of the generalized forces.

◆ mu

VectorX<T> mu

Coefficients of friction for the nc contacts.

This problem specification does not distinguish between static and dynamic friction coefficients.

◆ Mv

VectorX<T> Mv

The ℝⁿᵛ generalized momentum immediately before any impulsive forces (from impact) are applied.

◆ N_mult

std::function<VectorX<T>const VectorX<T>&)> N_mult

An operator that performs the multiplication N⋅v.

The default operator returns an empty vector.

◆ N_transpose_mult

std::function<VectorX<T>const VectorX<T>&)> N_transpose_mult

An operator that performs the multiplication Nᵀ⋅f, where f ∈ ℝⁿᶜ are the the magnitudes of the impulsive forces applied along the contact normals at the nc point contacts.

The default operator returns a zero vector of dimension equal to that of the generalized velocities (which should be identical to the dimension of the generalized forces).

◆ r

std::vector<int> r

The number of spanning vectors in the contact tangents (used to linearize the friction cone) at the nc contact points.

For contact problems in two dimensions, each element of r will be one. For contact problems in three dimensions, a friction pyramid (for example), for a contact point i will have rᵢ = 2. [Anitescu 1997] define k such vectors and require that, for each vector w in the spanning set, -w also exists in the spanning set. The RigidContactVelProblemData structure expects that the contact solving mechanism negates the spanning vectors so r = k/2 spanning vectors will correspond to a k-edge polygon friction cone approximation.

◆ solve_inertia

std::function<MatrixX<T>const MatrixX<T>&)> solve_inertia

A function for solving the equation MX = B for matrix X, given input matrix B, where M is the generalized inertia matrix for the rigid body system.


The documentation for this struct was generated from the following file: