Function Karana::Dynamics::Algorithms::evalVelocityConstraintMatrix

Function Karana::Dynamics::Algorithms::evalVelocityConstraintMatrix#

Function Documentation#

km::Mat Karana::Dynamics::Algorithms::evalVelocityConstraintMatrix(SubGraph &sg, bool with_constraints)#

Compute the velocity constraint matrix.

Compute the velocity constraint matrix, Gc, such that Gc * U = 0, i.e. the matrix whose null space contains the generalized velocity U values that satisfy the loop and coordinate constraints on the SubGraph.

If “with_constraints” is true, then Gc’s columns include ones for the loop hinge constraint coordinates, and the block row for each constraint contain the mapping to their constraint errors.

On the other hand, if “with_constraints” is false, Gc’s columns exclude ones for the constraint coordinates, and the block row for each loop hinge constraint maps to the residual vector for each constraint. In the latter case, the number of columns and rows shrink equally by the number of constraint coordinates.

Note that the returned matrix may not have full row rank when the constraints are not all independent. The evalIndepVelConstraintCoordIndices() method can be used to check for the rows that are independent.

The SubGraph::constraintErrorAt() and the SubGraph::constraintResidualAt() methods and can be used to look up the constraint instance associated with any specific row index in the returned matrix (based on whether with_constraint is ‘true’ or ‘false’ respectively). Similarly, the SubGraph::coordAt() method can be used to look up the coordinate instance for a specific column index in the returned matrix.

See the Constraints Related Algorithms section for more information.

Parameters:
  • sg – SubGraph instance

  • with_constraints – If true, columns for the cutjoint loop constraint coords are included

Returns:

The velocity constraint matrix.