Drake

Structure for holding constraint data for computing constraint forces at the accelerationlevel. More...
#include <multibody/constraint/constraint_problem_data.h>
Public Member Functions  
ConstraintAccelProblemData (int gv_dim)  
Constructs acceleration problem data for a system with a gv_dim dimensional generalized velocity. More...  
Public Attributes  
bool  use_complementarity_problem_solver {true} 
Flag for whether the complementarity problem solver should be used to solve this particular problem instance. More...  
std::vector< int >  sliding_contacts 
The indices of the sliding contacts (those contacts at which there is nonzero relative velocity between bodies in the plane tangent to the point of contact), out of the set of all contact indices (0...n1). More...  
std::vector< int >  non_sliding_contacts 
The indices of the nonsliding contacts (those contacts at which there is zero relative velocity between bodies in the plane tangent to the point of contact), out of the set of all contact indices (0...n1). More...  
std::vector< int >  r 
The number of spanning vectors in the contact tangents (used to linearize the friction cone) at the n nonsliding contact points. More...  
VectorX< T >  mu_sliding 
Coefficients of friction for the s = n  y sliding contacts (where y is the number of nonsliding contacts). More...  
VectorX< T >  mu_non_sliding 
Coefficients of friction for the y = n  s nonsliding contacts (where s is the number of sliding contacts). More...  
VectorX< T >  tau 
The ℝᵐ vector tau, the generalized external force vector that comprises gravitational, centrifugal, Coriolis, actuator, etc. 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 acceleration level  
Problem data for bilateral constraints of functions of system acceleration, where the constraint can be formulated as: 0 = G(q)⋅v̇ + kᴳ(t,q,v) which implies the constraint definition c(t,q,v,v̇) ≡ G(q)⋅v̇ + kᴳ(t,q,v). G is defined as the ℝᵇˣᵐ Jacobian matrix that transforms generalized velocities (v ∈ ℝᵐ) into the time derivatives of b 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 twice differentiated with respect to time to yield an accelerationlevel formulation (i.e., g̈(t, q, v, v̇), for the aforementioned definition of g(t,q)). That differentiation yields g̈ = G⋅v̇ + dG/dt⋅v, which is consistent with the constraint class under the definition kᴳ(t,q,v) ≡ dG/dt⋅v. An example such (holonomic) constraint function is the transmission (gearing) constraint below: 0 = v̇ᵢ  rv̇ⱼ which can be read as the acceleration at joint i (v̇ᵢ) must equal to  
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,v) defined above. More...  
Data for constraints on accelerations along the contact normal  
Problem data for constraining the acceleration of two bodies projected along the contact surface normal, for n point contacts. These data center around two Jacobian matrices, N and Q. N is the ℝⁿˣᵐ Jacobian matrix that transforms generalized velocities (v ∈ ℝᵐ) into velocities projected along the contact normals at the n point contacts. Q ∈ ℝⁿˣᵐ is the Jacobian matrix that transforms generalized velocities (m is the dimension of generalized velocity) into velocities projected along the directions of sliding at the s sliding contact points (rows of Q that correspond to nonsliding contacts should be zero). Finally, the Jacobian matrix N allows formulating the noninterpenetration constraint (a constraint imposed at the velocity level) as: 0 ≤ N(q)⋅v̇ + kᴺ(t,q,v) ⊥ fᶜ ≥ 0 which means that the constraint c̈(q,v,v̇) ≡ N(q)⋅v̇ + kᴺ(t,q,v) is coupled to a force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(Nv̇ + kᴺ(t,q,v)) = 0, meaning that the constraint can apply no force if it is inactive (i.e., if c̈(q,v,v̇) is strictly greater than zero). Note that differentiating the original constraint ċ(t,q,v) ≡ Nv (i.e., the constraint posed at the velocity level) once with respect to time, such that all constraints are imposed at the acceleration level, yields: c̈(t,q,v,v̇) = N(q) v̇ + dN/dt(q,v) v Thus, the constraint at the acceleration level can be realized by setting kᴺ(t,q,v) = dN/dt(q,v)⋅v. If there is preexisting constraint error (e.g., if N(q)⋅v < 0), the kᴺ term can be used to "stabilize" this error. For example, one could set  
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_minus_muQ_transpose_mult 
An operator that performs the multiplication (Nᵀ  μQᵀ)⋅f, where μ is a diagonal matrix with nonzero entries corresponding to the coefficients of friction at the s sliding contact points, and (Nᵀ  μQᵀ) transforms forces (f ∈ ℝⁿ) applied along the contact normals at the n point contacts into generalized forces. 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 nonsliding contact friction constraints  
Problem data for constraining the tangential acceleration 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 r vectors that span the contact tangents at the y nonsliding point contacts. For contact problems in two dimensions, r would be one. For a friction pyramid in three dimensions, r would be two. While the definition of the dimension of the Jacobian matrix above indicates that every one of the y nonsliding contacts uses the same "r", the code imposes no such requirement. Finally, the Jacobian matrix F allows formulating the nonsliding friction force constraints as: 0 ≤ F(q)⋅v̇ + kᶠ(t,q,v) + λe ⊥ fᶜ ≥ 0 which means that the constraint c̈(t,q,v,v̇) ≡ F(q)⋅v̇ + kᶠ(t,q,v) is coupled to a force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(Fv̇ + kᴺ(t,q,v) + λe) = 0: the constraint can apply no force if it is inactive (i.e., if c̈(t,q,v,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. Analogously to the case of kᴺ, kᶠ should be set to dF/dt(q,v)⋅v; also analogously, kᶠ can be used to perform constraint stabilization.  
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 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 acceleration level  
Problem data for unilateral constraints of functions of system acceleration, where the constraint can be formulated as: 0 ≤ L(q)⋅v̇ + kᴸ(t,q,v) ⊥ fᶜ ≥ 0 which means that the constraint c(q,v,v̇) ≡ L(q)⋅v̇ + kᴸ(t,q,v) is coupled to a force constraint (fᶜ ≥ 0) and a complementarity constraint fᶜ⋅(L⋅v̇ + kᴸ(t,q,v)) = 0, meaning that the constraint can apply no force if it is inactive (i.e., if c(q,v,v̇) is strictly greater than zero). L is defined as the ℝˢˣᵐ Jacobian matrix that transforms generalized velocities (v ∈ ℝᵐ) into the time derivatives of s unilateral constraint functions. The class of constraint functions naturally includes holonomic constraints, which are constraints posable as g(t,q). Such holonomic constraints must be twice differentiated with respect to time to yield an accelerationlevel formulation (i.e., g̈(q, v, v̇, t), for the aforementioned definition of g(t,q)). That differentiation yields g̈ = L⋅v̇ + dL/dt⋅v, which is consistent with the constraint class under the definition kᴸ(t,q,v) ≡ dL/dt⋅v. An example such holonomic constraint function is a joint acceleration limit: 0 ≤ v̇ⱼ + r ⊥ fᶜⱼ ≥ 0 which can be read as the acceleration at joint j (v̇ⱼ) must be no larger than r, the force must be applied to limit the acceleration at the joint, and the limiting force cannot be applied if the acceleration at the joint is not at the limit (i.e., v̇ⱼ < r). In this example, the corresponding holonomic constraint function is g(t,q) ≡ qⱼ + rt², yielding ̈g(q, v, 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 constraint forces. More...  
VectorX< T >  kL 
This ℝˢ vector is the vector kᴸ(t,q,v) defined above. More...  
VectorX< T >  gammaL 
This ℝˢ vector represents the diagonal matrix γᴸ. More...  
Structure for holding constraint data for computing constraint forces at the accelerationlevel.

inlineexplicit 
Constructs acceleration problem data for a system with a gv_dim
dimensional generalized velocity.
An operator that performs the multiplication F⋅v.
The default operator returns an empty vector.
An operator that performs the multiplication Fᵀ⋅f, where f ∈ ℝʸʳ corresponds to frictional force magnitudes.
The default operator returns a zero vector of dimension equal to that of the generalized forces.
An operator that performs the multiplication G⋅v.
The default operator returns an empty vector.
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.
VectorX<T> gammaE 
This ℝᴺ vector represents the diagonal matrix γᴱ.
VectorX<T> gammaF 
This ℝʸʳ vector represents the diagonal matrix γᶠ.
VectorX<T> gammaL 
This ℝˢ vector represents the diagonal matrix γᴸ.
VectorX<T> gammaN 
This ℝⁿ vector represents the diagonal matrix γᴺ.
VectorX<T> kF 
This ℝʸʳ vector is the vector kᶠ(t,q,v) defined above.
VectorX<T> kG 
This ℝᵇ vector is the vector kᴳ(t,q,v) defined above.
VectorX<T> kL 
This ℝˢ vector is the vector kᴸ(t,q,v) defined above.
VectorX<T> kN 
This ℝⁿ vector is the vector kᴺ(t,q,v) defined above.
An operator that performs the multiplication L⋅v.
The default operator returns an empty vector.
An operator that performs the multiplication Lᵀ⋅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.
VectorX<T> mu_non_sliding 
Coefficients of friction for the y = n  s nonsliding contacts (where s
is the number of sliding contacts).
The size of this vector should be equal to non_sliding_contacts.size()
.
VectorX<T> mu_sliding 
Coefficients of friction for the s = n  y sliding contacts (where y
is the number of nonsliding contacts).
The size of this vector should be equal to sliding_contacts.size()
.
An operator that performs the multiplication (Nᵀ  μQᵀ)⋅f, where μ is a diagonal matrix with nonzero entries corresponding to the coefficients of friction at the s sliding contact points, and (Nᵀ  μQᵀ) transforms forces (f ∈ ℝⁿ) applied along the contact normals at the n point contacts into generalized forces.
The default operator returns a zero vector of dimension equal to that of the generalized forces.
An operator that performs the multiplication N⋅v.
The default operator returns an empty vector.
std::vector<int> non_sliding_contacts 
The indices of the nonsliding contacts (those contacts at which there is zero relative velocity between bodies in the plane tangent to the point of contact), out of the set of all contact indices (0...n1).
This vector must be in sorted order.
std::vector<int> r 
The number of spanning vectors in the contact tangents (used to linearize the friction cone) at the n nonsliding 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 RigidContactAccelProblemData structure expects that the contact solving mechanism negates the spanning vectors so r
= k/2 spanning vectors will correspond to a kedge polygon friction cone approximation.
std::vector<int> sliding_contacts 
The indices of the sliding contacts (those contacts at which there is nonzero relative velocity between bodies in the plane tangent to the point of contact), out of the set of all contact indices (0...n1).
This vector must be in sorted order.
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.
VectorX<T> tau 
The ℝᵐ vector tau, the generalized external force vector that comprises gravitational, centrifugal, Coriolis, actuator, etc.
forces applied to the rigid body system at q. m is the dimension of the generalized force, which is also equal to the dimension of the generalized velocity.
bool use_complementarity_problem_solver {true} 
Flag for whether the complementarity problem solver should be used to solve this particular problem instance.
If every constraint in the problem data is active, using the linear system solver (use_complementarity_problem_solver=false
) will yield a solution much more quickly. If it is unknown whether every constraint is active, the complementarity problem solver should be used; otherwise, the inequality constraints embedded in the problem data may not be satisfied. The safe (and slower) value of true
is the default.